Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Side by Side Diff: ui/views/examples/content_client/examples_main.h

Issue 284113011: Repurpose views+content example into a generic multiprocess views runtime (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use sandbox boilerplate for now Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 #ifndef UI_VIEWS_EXAMPLES_CONTENT_CLIENT_EXAMPLES_MAIN_H_
6 #define UI_VIEWS_EXAMPLES_CONTENT_CLIENT_EXAMPLES_MAIN_H_
7
8 #include "base/callback.h"
9 #include "base/macros.h"
10 #include "ui/gfx/native_widget_types.h"
11 #include "ui/views/examples/views_examples_with_content_export.h"
12
13 namespace content {
14 class BrowserContext;
15 }
16
17 namespace sandbox {
18 struct SandboxInterfaceInfo;
19 }
20
21 namespace views {
22 namespace examples {
23
24 // Creates a multiprocess views runtime for running an example application.
25 //
26 // Sample usage:
27 //
28 // void InitMyApp(content::BrowserContext* browser_context,
29 // gfx::NativeView window_context) {
30 // // Create desired windows and views here. Runs on the UI thread.
31 // }
32 //
33 // #if defined(OS_WIN)
34 // int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t*, int) {
35 // sandbox::SandboxInterfaceInfo sandbox_info = {0};
tapted 2014/05/20 08:45:35 note: I think I can get rid of some of this boiler
36 // content::InitializeSandboxInfo(&sandbox_info);
37 // views::examples::ExamplesMainParams params(instance, &sandbox_info);
38 // #else
39 // int main(int argc, const char** argv) {
40 // views::examples::ExamplesMainParams params(argc, argv);
41 // #endif
42 //
43 // params.set_task(base::Bind(&InitMyApp));
44 // return params.RunMain();
45 // }
46 class VIEWS_EXAMPLES_WITH_CONTENT_EXPORT ExamplesMainParams {
47 public:
48 typedef base::Callback<
49 void(content::BrowserContext* browser_context,
50 gfx::NativeView window_context)> Task;
51
52 #if defined(OS_WIN)
53 ExamplesMainParams(HINSTANCE instance,
54 sandbox::SandboxInterfaceInfo* sandbox_info);
55 #else
56 ExamplesMainParams(int argc, const char** argv);
57 #endif
58
59 ~ExamplesMainParams();
60
61 // Runs content::ContentMain() using the ExamplesMainDelegate.
62 int RunMain();
63
64 // The task to run at the end of BrowserMainParts::PreMainMessageLoopRun().
65 // Ignored if this is not the main process.
66 void set_task(const Task& task) { task_ = task; }
67 const Task& task() const { return task_; }
68
69 private:
70 #if defined(OS_WIN)
71 HINSTANCE instance_;
72 sandbox::SandboxInterfaceInfo* sandbox_info_;
73 #else
74 int argc_;
75 const char** argv_;
76 #endif
77 Task task_;
78
79 DISALLOW_COPY_AND_ASSIGN(ExamplesMainParams);
80 };
81
82 } // namespace examples
83 } // namespace views
84
85 #endif // UI_VIEWS_EXAMPLES_CONTENT_CLIENT_EXAMPLES_MAIN_H_
OLDNEW
« no previous file with comments | « ui/views/examples/content_client/examples_content_browser_client.cc ('k') | ui/views/examples/content_client/examples_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698