OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_SHELL_SHELL_MAIN_DELEGATE_H_ | 5 #ifndef CONTENT_SHELL_SHELL_MAIN_DELEGATE_H_ |
6 #define CONTENT_SHELL_SHELL_MAIN_DELEGATE_H_ | 6 #define CONTENT_SHELL_SHELL_MAIN_DELEGATE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "content/shell/shell.h" |
11 #include "content/shell/shell_content_client.h" | 12 #include "content/shell/shell_content_client.h" |
12 #include "content/public/app/content_main_delegate.h" | 13 #include "content/public/app/content_main_delegate.h" |
13 | 14 |
| 15 #if defined(TEST_EMBEDDED_MESSAGE_LOOP) |
| 16 #include "content/browser/browser_main_runner.h" |
| 17 #endif |
| 18 |
| 19 class MessageLoop; |
| 20 |
14 namespace content { | 21 namespace content { |
15 class ShellContentBrowserClient; | 22 class ShellContentBrowserClient; |
16 class ShellContentRendererClient; | 23 class ShellContentRendererClient; |
17 class ShellContentPluginClient; | 24 class ShellContentPluginClient; |
18 class ShellContentUtilityClient; | 25 class ShellContentUtilityClient; |
19 } // namespace content | 26 } // namespace content |
20 | 27 |
21 class ShellMainDelegate : public content::ContentMainDelegate { | 28 class ShellMainDelegate : public content::ContentMainDelegate { |
22 public: | 29 public: |
23 ShellMainDelegate(); | 30 ShellMainDelegate(); |
24 virtual ~ShellMainDelegate(); | 31 virtual ~ShellMainDelegate(); |
25 | 32 |
26 virtual bool BasicStartupComplete(int* exit_code) OVERRIDE; | 33 virtual bool BasicStartupComplete(int* exit_code) OVERRIDE; |
27 virtual void PreSandboxStartup() OVERRIDE; | 34 virtual void PreSandboxStartup() OVERRIDE; |
28 virtual void SandboxInitialized(const std::string& process_type) OVERRIDE; | 35 virtual void SandboxInitialized(const std::string& process_type) OVERRIDE; |
29 virtual int RunProcess( | 36 virtual int RunKnownProcess( |
| 37 const std::string& process_type, |
| 38 const content::MainFunctionParams& main_function_params) OVERRIDE; |
| 39 virtual int RunUnknownProcess( |
30 const std::string& process_type, | 40 const std::string& process_type, |
31 const content::MainFunctionParams& main_function_params) OVERRIDE; | 41 const content::MainFunctionParams& main_function_params) OVERRIDE; |
32 virtual void ProcessExiting(const std::string& process_type) OVERRIDE; | 42 virtual void ProcessExiting(const std::string& process_type) OVERRIDE; |
33 #if defined(OS_MACOSX) | 43 #if defined(OS_MACOSX) |
34 virtual bool ProcessRegistersWithSystemProcess( | 44 virtual bool ProcessRegistersWithSystemProcess( |
35 const std::string& process_type) OVERRIDE; | 45 const std::string& process_type) OVERRIDE; |
36 virtual bool ShouldSendMachPort(const std::string& process_type) OVERRIDE; | 46 virtual bool ShouldSendMachPort(const std::string& process_type) OVERRIDE; |
37 virtual bool DelaySandboxInitialization( | 47 virtual bool DelaySandboxInitialization( |
38 const std::string& process_type) OVERRIDE; | 48 const std::string& process_type) OVERRIDE; |
39 #elif defined(OS_POSIX) | 49 #elif defined(OS_POSIX) |
40 virtual content::ZygoteForkDelegate* ZygoteStarting() OVERRIDE; | 50 virtual content::ZygoteForkDelegate* ZygoteStarting() OVERRIDE; |
41 virtual void ZygoteForked() OVERRIDE; | 51 virtual void ZygoteForked() OVERRIDE; |
42 #endif // OS_MACOSX | 52 #endif // OS_MACOSX |
43 | 53 |
| 54 #if defined(TEST_EMBEDDED_MESSAGE_LOOP) |
| 55 MessageLoop* CreateBrowserMessageLoop(); |
| 56 void DoBrowserMessageLoopWork(); |
| 57 void ShutdownBrowser(); |
| 58 #endif |
| 59 |
44 private: | 60 private: |
45 void InitializeShellContentClient(const std::string& process_type); | 61 void InitializeShellContentClient(const std::string& process_type); |
46 | 62 |
| 63 #if defined(TEST_EMBEDDED_MESSAGE_LOOP) |
| 64 scoped_ptr<content::BrowserMainRunner> browser_runner_; |
| 65 #endif |
| 66 |
47 scoped_ptr<content::ShellContentBrowserClient> browser_client_; | 67 scoped_ptr<content::ShellContentBrowserClient> browser_client_; |
48 scoped_ptr<content::ShellContentRendererClient> renderer_client_; | 68 scoped_ptr<content::ShellContentRendererClient> renderer_client_; |
49 scoped_ptr<content::ShellContentPluginClient> plugin_client_; | 69 scoped_ptr<content::ShellContentPluginClient> plugin_client_; |
50 scoped_ptr<content::ShellContentUtilityClient> utility_client_; | 70 scoped_ptr<content::ShellContentUtilityClient> utility_client_; |
51 content::ShellContentClient content_client_; | 71 content::ShellContentClient content_client_; |
52 | 72 |
53 DISALLOW_COPY_AND_ASSIGN(ShellMainDelegate); | 73 DISALLOW_COPY_AND_ASSIGN(ShellMainDelegate); |
54 }; | 74 }; |
55 | 75 |
56 #endif // CONTENT_SHELL_SHELL_MAIN_DELEGATE_H_ | 76 #endif // CONTENT_SHELL_SHELL_MAIN_DELEGATE_H_ |
OLD | NEW |