Chromium Code Reviews| 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> | |
| 9 | |
| 8 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 9 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
| 10 | 12 |
| 11 #if defined(OS_WIN) | 13 #if defined(OS_WIN) |
| 12 #include <windows.h> | 14 #include <windows.h> |
| 13 #endif | 15 #endif |
| 14 | 16 |
| 15 namespace sandbox { | 17 namespace sandbox { |
| 16 struct SandboxInterfaceInfo; | 18 struct SandboxInterfaceInfo; |
| 17 } | 19 } |
| 18 | 20 |
| 19 namespace content { | 21 namespace content { |
| 22 class ContentMainDelegate; | |
| 20 | 23 |
| 21 class ContentMainDelegate; | 24 struct ContentMainParams { |
| 25 explicit ContentMainParams(ContentMainDelegate* delegate) | |
| 26 : delegate(delegate), | |
| 27 #if defined(OS_WIN) | |
| 28 instance(NULL), | |
| 29 sandbox_info(NULL) | |
| 30 #elif !defined(OS_ANDROID) | |
| 31 argc(0), | |
| 32 argv(NULL) | |
| 33 #endif | |
| 34 { | |
| 35 } | |
| 36 | |
| 37 ContentMainDelegate* delegate; | |
| 38 | |
| 39 #if defined(OS_WIN) | |
| 40 HINSTANCE instance; | |
| 41 | |
| 42 // |sandbox_info| should be initialized using InitializeSandboxInfo from | |
| 43 // content_main_win.h | |
| 44 sandbox::SandboxInterfaceInfo* sandbox_info; | |
| 45 #elif !defined(OS_ANDROID) | |
| 46 int argc; | |
|
sky
2014/03/07 23:14:22
nit: I think you have 2 spaces here.
jam
2014/03/07 23:29:12
Done.
| |
| 47 const char** argv; | |
| 48 #endif | |
| 49 }; | |
| 22 | 50 |
| 23 // ContentMain should be called from the embedder's main() function to do the | 51 // ContentMain should be called from the embedder's main() function to do the |
| 24 // initial setup for every process. The embedder has a chance to customize | 52 // initial setup for every process. The embedder has a chance to customize |
| 25 // startup using the ContentMainDelegate interface. The embedder can also pass | 53 // startup using the ContentMainDelegate interface. The embedder can also pass |
| 26 // in NULL for |delegate| if they don't want to override default startup. | 54 // in NULL for |delegate| if they don't want to override default startup. |
| 27 #if defined(OS_WIN) | 55 #if defined(OS_ANDROID) |
| 28 | |
| 29 // |sandbox_info| should be initialized using InitializeSandboxInfo from | |
| 30 // content_main_win.h | |
| 31 CONTENT_EXPORT int ContentMain(HINSTANCE instance, | |
| 32 sandbox::SandboxInterfaceInfo* sandbox_info, | |
| 33 ContentMainDelegate* delegate); | |
| 34 #elif defined(OS_ANDROID) | |
| 35 // In the Android, the content main starts from ContentMain.java, This function | 56 // In the Android, the content main starts from ContentMain.java, This function |
| 36 // provides a way to set the |delegate| as ContentMainDelegate for | 57 // provides a way to set the |delegate| as ContentMainDelegate for |
| 37 // ContentMainRunner. | 58 // ContentMainRunner. |
| 38 // This should only be called once before ContentMainRunner actually running. | 59 // This should only be called once before ContentMainRunner actually running. |
| 39 // The ownership of |delegate| is transferred. | 60 // The ownership of |delegate| is transferred. |
| 40 CONTENT_EXPORT void SetContentMainDelegate(ContentMainDelegate* delegate); | 61 CONTENT_EXPORT void SetContentMainDelegate(ContentMainDelegate* delegate); |
| 41 #else | 62 #else |
| 42 CONTENT_EXPORT int ContentMain(int argc, | 63 CONTENT_EXPORT int ContentMain(ContentMainParams* params); |
| 43 const char** argv, | 64 #endif |
| 44 ContentMainDelegate* delegate); | |
| 45 #endif // defined(OS_WIN) | |
| 46 | 65 |
| 47 } // namespace content | 66 } // namespace content |
| 48 | 67 |
| 49 #endif // CONTENT_PUBLIC_APP_CONTENT_MAIN_H_ | 68 #endif // CONTENT_PUBLIC_APP_CONTENT_MAIN_H_ |
| OLD | NEW |