Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / ui / views_content_client / views_content_client.h
blobb11cf637fdf51217f8816a303647ebb97acb7cb9
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"
13 namespace content {
14 class BrowserContext;
17 namespace sandbox {
18 struct SandboxInterfaceInfo;
21 namespace ui {
23 // Creates a multiprocess views runtime for running an example application.
25 // Sample usage:
27 // void InitMyApp(content::BrowserContext* browser_context,
28 // gfx::NativeWindow window_context) {
29 // // Create desired windows and views here. Runs on the UI thread.
30 // }
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);
37 // #else
38 // int main(int argc, const char** argv) {
39 // ui::ViewsContentClient params(argc, argv);
40 // #endif
42 // params.set_task(base::Bind(&InitMyApp));
43 // return params.RunMain();
44 // }
45 class VIEWS_CONTENT_CLIENT_EXPORT ViewsContentClient {
46 public:
47 typedef base::Callback<
48 void(content::BrowserContext* browser_context,
49 gfx::NativeWindow window_context)> Task;
51 #if defined(OS_WIN)
52 ViewsContentClient(HINSTANCE instance,
53 sandbox::SandboxInterfaceInfo* sandbox_info);
54 #else
55 ViewsContentClient(int argc, const char** argv);
56 #endif
58 ~ViewsContentClient();
60 // Runs content::ContentMain() using the ExamplesMainDelegate.
61 int RunMain();
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_; }
68 private:
69 #if defined(OS_WIN)
70 HINSTANCE instance_;
71 sandbox::SandboxInterfaceInfo* sandbox_info_;
72 #else
73 int argc_;
74 const char** argv_;
75 #endif
76 Task task_;
78 DISALLOW_COPY_AND_ASSIGN(ViewsContentClient);
81 } // namespace ui
83 #endif // UI_VIEWS_CONTENT_CLIENT_VIEWS_CONTENT_CLIENT_H_