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 CHROME_APP_CHROME_MAIN_DELEGATE_H_ | 5 #ifndef CHROME_APP_CHROME_MAIN_DELEGATE_H_ |
6 #define CHROME_APP_CHROME_MAIN_DELEGATE_H_ | 6 #define CHROME_APP_CHROME_MAIN_DELEGATE_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/metrics/stats_counters.h" | 9 #include "base/metrics/stats_counters.h" |
10 #include "chrome/common/chrome_content_client.h" | 10 #include "chrome/common/chrome_content_client.h" |
11 #include "content/public/app/content_main_delegate.h" | 11 #include "content/public/app/content_main_delegate.h" |
12 | 12 |
| 13 template <typename> |
| 14 class ScopedVector; |
| 15 |
13 namespace base { | 16 namespace base { |
14 class CommandLine; | 17 class CommandLine; |
15 } | 18 } |
16 | 19 |
17 // Chrome implementation of ContentMainDelegate. | 20 // Chrome implementation of ContentMainDelegate. |
18 class ChromeMainDelegate : public content::ContentMainDelegate { | 21 class ChromeMainDelegate : public content::ContentMainDelegate { |
19 public: | 22 public: |
20 ChromeMainDelegate(); | 23 ChromeMainDelegate(); |
21 virtual ~ChromeMainDelegate(); | 24 virtual ~ChromeMainDelegate(); |
22 | 25 |
23 protected: | 26 protected: |
24 // content::ContentMainDelegate implementation: | 27 // content::ContentMainDelegate implementation: |
25 virtual bool BasicStartupComplete(int* exit_code) OVERRIDE; | 28 virtual bool BasicStartupComplete(int* exit_code) OVERRIDE; |
26 virtual void PreSandboxStartup() OVERRIDE; | 29 virtual void PreSandboxStartup() OVERRIDE; |
27 virtual void SandboxInitialized(const std::string& process_type) OVERRIDE; | 30 virtual void SandboxInitialized(const std::string& process_type) OVERRIDE; |
28 virtual int RunProcess( | 31 virtual int RunProcess( |
29 const std::string& process_type, | 32 const std::string& process_type, |
30 const content::MainFunctionParams& main_function_params) OVERRIDE; | 33 const content::MainFunctionParams& main_function_params) OVERRIDE; |
31 virtual void ProcessExiting(const std::string& process_type) OVERRIDE; | 34 virtual void ProcessExiting(const std::string& process_type) OVERRIDE; |
32 #if defined(OS_MACOSX) | 35 #if defined(OS_MACOSX) |
33 virtual bool ProcessRegistersWithSystemProcess( | 36 virtual bool ProcessRegistersWithSystemProcess( |
34 const std::string& process_type) OVERRIDE; | 37 const std::string& process_type) OVERRIDE; |
35 virtual bool ShouldSendMachPort(const std::string& process_type) OVERRIDE; | 38 virtual bool ShouldSendMachPort(const std::string& process_type) OVERRIDE; |
36 virtual bool DelaySandboxInitialization( | 39 virtual bool DelaySandboxInitialization( |
37 const std::string& process_type) OVERRIDE; | 40 const std::string& process_type) OVERRIDE; |
38 #elif defined(OS_POSIX) && !defined(OS_ANDROID) | 41 #elif defined(OS_POSIX) && !defined(OS_ANDROID) |
39 virtual content::ZygoteForkDelegate* ZygoteStarting() OVERRIDE; | 42 virtual void ZygoteStarting( |
| 43 ScopedVector<content::ZygoteForkDelegate>* delegates) OVERRIDE; |
40 virtual void ZygoteForked() OVERRIDE; | 44 virtual void ZygoteForked() OVERRIDE; |
41 #endif | 45 #endif |
42 virtual content::ContentBrowserClient* CreateContentBrowserClient() OVERRIDE; | 46 virtual content::ContentBrowserClient* CreateContentBrowserClient() OVERRIDE; |
43 virtual content::ContentPluginClient* CreateContentPluginClient() OVERRIDE; | 47 virtual content::ContentPluginClient* CreateContentPluginClient() OVERRIDE; |
44 virtual content::ContentRendererClient* | 48 virtual content::ContentRendererClient* |
45 CreateContentRendererClient() OVERRIDE; | 49 CreateContentRendererClient() OVERRIDE; |
46 virtual content::ContentUtilityClient* CreateContentUtilityClient() OVERRIDE; | 50 virtual content::ContentUtilityClient* CreateContentUtilityClient() OVERRIDE; |
47 | 51 |
48 #if defined(OS_MACOSX) | 52 #if defined(OS_MACOSX) |
49 void InitMacCrashReporter(const base::CommandLine& command_line, | 53 void InitMacCrashReporter(const base::CommandLine& command_line, |
50 const std::string& process_type); | 54 const std::string& process_type); |
51 #endif // defined(OS_MACOSX) | 55 #endif // defined(OS_MACOSX) |
52 | 56 |
53 ChromeContentClient chrome_content_client_; | 57 ChromeContentClient chrome_content_client_; |
54 | 58 |
55 // startup_timer_ will hold a reference to stats_counter_timer_. Therefore, | 59 // startup_timer_ will hold a reference to stats_counter_timer_. Therefore, |
56 // the declaration order of these variables matters. Changing this order will | 60 // the declaration order of these variables matters. Changing this order will |
57 // cause startup_timer_ to be freed before stats_counter_timer_, leaving a | 61 // cause startup_timer_ to be freed before stats_counter_timer_, leaving a |
58 // dangling reference. | 62 // dangling reference. |
59 scoped_ptr<base::StatsCounterTimer> stats_counter_timer_; | 63 scoped_ptr<base::StatsCounterTimer> stats_counter_timer_; |
60 scoped_ptr<base::StatsScope<base::StatsCounterTimer> > startup_timer_; | 64 scoped_ptr<base::StatsScope<base::StatsCounterTimer> > startup_timer_; |
61 | 65 |
62 DISALLOW_COPY_AND_ASSIGN(ChromeMainDelegate); | 66 DISALLOW_COPY_AND_ASSIGN(ChromeMainDelegate); |
63 }; | 67 }; |
64 | 68 |
65 #endif // CHROME_APP_CHROME_MAIN_DELEGATE_H_ | 69 #endif // CHROME_APP_CHROME_MAIN_DELEGATE_H_ |
OLD | NEW |