OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_PUBLIC_APP_CONTENT_MAIN_H_ | 5 #ifndef CONTENT_PUBLIC_APP_CONTENT_MAIN_H_ |
6 #define CONTENT_PUBLIC_APP_CONTENT_MAIN_H_ | 6 #define CONTENT_PUBLIC_APP_CONTENT_MAIN_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
| 10 #include "base/callback_forward.h" |
10 #include "build/build_config.h" | 11 #include "build/build_config.h" |
11 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
12 | 13 |
13 #if defined(OS_WIN) | 14 #if defined(OS_WIN) |
14 #include <windows.h> | 15 #include <windows.h> |
15 #endif | 16 #endif |
16 | 17 |
17 namespace sandbox { | 18 namespace sandbox { |
18 struct SandboxInterfaceInfo; | 19 struct SandboxInterfaceInfo; |
19 } | 20 } |
20 | 21 |
21 namespace content { | 22 namespace content { |
22 class ContentMainDelegate; | 23 class ContentMainDelegate; |
23 | 24 |
24 struct ContentMainParams { | 25 struct ContentMainParams { |
25 explicit ContentMainParams(ContentMainDelegate* delegate) | 26 explicit ContentMainParams(ContentMainDelegate* delegate) |
26 : delegate(delegate) | 27 : delegate(delegate), |
27 #if defined(OS_WIN) | 28 #if defined(OS_WIN) |
28 , instance(NULL), | 29 instance(NULL), |
29 sandbox_info(NULL) | 30 sandbox_info(NULL), |
30 #elif !defined(OS_ANDROID) | 31 #elif !defined(OS_ANDROID) |
31 , argc(0), | 32 argc(0), |
32 argv(NULL) | 33 argv(NULL), |
33 #endif | 34 #endif |
34 { | 35 ui_task(NULL) { |
35 } | 36 } |
36 | 37 |
37 ContentMainDelegate* delegate; | 38 ContentMainDelegate* delegate; |
38 | 39 |
39 #if defined(OS_WIN) | 40 #if defined(OS_WIN) |
40 HINSTANCE instance; | 41 HINSTANCE instance; |
41 | 42 |
42 // |sandbox_info| should be initialized using InitializeSandboxInfo from | 43 // |sandbox_info| should be initialized using InitializeSandboxInfo from |
43 // content_main_win.h | 44 // content_main_win.h |
44 sandbox::SandboxInterfaceInfo* sandbox_info; | 45 sandbox::SandboxInterfaceInfo* sandbox_info; |
45 #elif !defined(OS_ANDROID) | 46 #elif !defined(OS_ANDROID) |
46 int argc; | 47 int argc; |
47 const char** argv; | 48 const char** argv; |
48 #endif | 49 #endif |
| 50 |
| 51 // Used by browser_tests. If non-null BrowserMain schedules this task to run |
| 52 // on the MessageLoop. It's owned by the test code. |
| 53 base::Closure* ui_task; |
49 }; | 54 }; |
50 | 55 |
51 #if defined(OS_ANDROID) | 56 #if defined(OS_ANDROID) |
52 // In the Android, the content main starts from ContentMain.java, This function | 57 // In the Android, the content main starts from ContentMain.java, This function |
53 // provides a way to set the |delegate| as ContentMainDelegate for | 58 // provides a way to set the |delegate| as ContentMainDelegate for |
54 // ContentMainRunner. | 59 // ContentMainRunner. |
55 // This should only be called once before ContentMainRunner actually running. | 60 // This should only be called once before ContentMainRunner actually running. |
56 // The ownership of |delegate| is transferred. | 61 // The ownership of |delegate| is transferred. |
57 CONTENT_EXPORT void SetContentMainDelegate(ContentMainDelegate* delegate); | 62 CONTENT_EXPORT void SetContentMainDelegate(ContentMainDelegate* delegate); |
58 #else | 63 #else |
59 // ContentMain should be called from the embedder's main() function to do the | 64 // ContentMain should be called from the embedder's main() function to do the |
60 // initial setup for every process. The embedder has a chance to customize | 65 // initial setup for every process. The embedder has a chance to customize |
61 // startup using the ContentMainDelegate interface. The embedder can also pass | 66 // startup using the ContentMainDelegate interface. The embedder can also pass |
62 // in NULL for |delegate| if they don't want to override default startup. | 67 // in NULL for |delegate| if they don't want to override default startup. |
63 CONTENT_EXPORT int ContentMain(const ContentMainParams& params); | 68 CONTENT_EXPORT int ContentMain(const ContentMainParams& params); |
64 #endif | 69 #endif |
65 | 70 |
66 } // namespace content | 71 } // namespace content |
67 | 72 |
68 #endif // CONTENT_PUBLIC_APP_CONTENT_MAIN_H_ | 73 #endif // CONTENT_PUBLIC_APP_CONTENT_MAIN_H_ |
OLD | NEW |