1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef UI_VIEWS_CONTENT_CLIENT_VIEWS_CONTENT_CLIENT_H_
6 #define UI_VIEWS_CONTENT_CLIENT_VIEWS_CONTENT_CLIENT_H_
8 #include "base/callback.h"
9 #include "base/macros.h"
10 #include "ui/gfx/native_widget_types.h"
11 #include "ui/views_content_client/views_content_client_export.h"
18 struct SandboxInterfaceInfo
;
23 // Creates a multiprocess views runtime for running an example application.
27 // void InitMyApp(content::BrowserContext* browser_context,
28 // gfx::NativeWindow window_context) {
29 // // Create desired windows and views here. Runs on the UI thread.
32 // #if defined(OS_WIN)
33 // int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t*, int) {
34 // sandbox::SandboxInterfaceInfo sandbox_info = {0};
35 // content::InitializeSandboxInfo(&sandbox_info);
36 // ui::ViewsContentClient params(instance, &sandbox_info);
38 // int main(int argc, const char** argv) {
39 // ui::ViewsContentClient params(argc, argv);
42 // params.set_task(base::Bind(&InitMyApp));
43 // return params.RunMain();
45 class VIEWS_CONTENT_CLIENT_EXPORT ViewsContentClient
{
47 typedef base::Callback
<
48 void(content::BrowserContext
* browser_context
,
49 gfx::NativeWindow window_context
)> Task
;
52 ViewsContentClient(HINSTANCE instance
,
53 sandbox::SandboxInterfaceInfo
* sandbox_info
);
55 ViewsContentClient(int argc
, const char** argv
);
58 ~ViewsContentClient();
60 // Runs content::ContentMain() using the ExamplesMainDelegate.
63 // The task to run at the end of BrowserMainParts::PreMainMessageLoopRun().
64 // Ignored if this is not the main process.
65 void set_task(const Task
& task
) { task_
= task
; }
66 const Task
& task() const { return task_
; }
71 sandbox::SandboxInterfaceInfo
* sandbox_info_
;
78 DISALLOW_COPY_AND_ASSIGN(ViewsContentClient
);
83 #endif // UI_VIEWS_CONTENT_CLIENT_VIEWS_CONTENT_CLIENT_H_