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

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: app_list_demo.cc using example_main 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 views {
18 namespace examples {
19
20 // Creates a multiprocess views runtime for running an example application.
21 //
22 // Sample usage:
23 //
24 // void InitMyApp(content::BrowserContext* browser_context,
25 // gfx::NativeView window_context) {
26 // // Create desired windows and views here. Runs on the UI thread.
27 // }
28 //
29 // #if defined(OS_WIN)
30 // int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t*, int) {
31 // views::examples::ExamplesMainParams params(instance);
32 // #else
33 // int main(int argc, const char** argv) {
34 // views::examples::ExamplesMainParams params(argc, argv);
35 // #endif
36 //
37 // params.set_task(base::Bind(&InitMyApp));
38 // return params.RunMain();
39 // }
40 class VIEWS_EXAMPLES_WITH_CONTENT_EXPORT ExamplesMainParams {
41 public:
42 typedef base::Callback<
43 void(content::BrowserContext* browser_context,
44 gfx::NativeView window_context)> Task;
45
46 #if defined(OS_WIN)
47 ExamplesMainParams(HINSTANCE instance);
48 #else
49 ExamplesMainParams(int argc, const char** argv);
50 #endif
51
52 // Runs content::ContentMain().
53 int RunMain();
54
55 // The task to run at the end of BrowserMainParts::PreMainMessageLoopRun().
56 // Ignored if this is not the main process.
57 void set_task(const Task& task) { task_ = task; }
58 const Task& task() const { return task_; }
59
60 private:
61 #if defined(OS_WIN)
62 HINSTANCE instance_;
63 #else
64 int argc_;
65 const char** argv_;
66 #endif
67 Task task_;
68
69 DISALLOW_COPY_AND_ASSIGN(ExamplesMainParams);
70 };
71
72 } // namespace examples
73 } // namespace views
74
75 #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