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_BROWSER_CHROME_BROWSER_MAIN_H_ | 5 #ifndef CHROME_BROWSER_CHROME_BROWSER_MAIN_H_ |
6 #define CHROME_BROWSER_CHROME_BROWSER_MAIN_H_ | 6 #define CHROME_BROWSER_CHROME_BROWSER_MAIN_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/metrics/field_trial.h" | 12 #include "base/metrics/field_trial.h" |
13 #include "base/tracked_objects.h" | 13 #include "base/tracked_objects.h" |
14 #include "chrome/browser/first_run/first_run.h" | 14 #include "chrome/browser/first_run/first_run.h" |
15 #include "chrome/browser/process_singleton.h" | 15 #include "chrome/browser/process_singleton.h" |
16 #include "content/public/browser/browser_main_parts.h" | 16 #include "content/public/browser/browser_main_parts.h" |
17 | 17 |
18 class BrowserProcessImpl; | 18 class BrowserProcessImpl; |
19 class FieldTrialSynchronizer; | 19 class FieldTrialSynchronizer; |
20 class HistogramSynchronizer; | 20 class HistogramSynchronizer; |
21 class MetricsService; | 21 class MetricsService; |
22 class PrefService; | 22 class PrefService; |
23 class Profile; | 23 class Profile; |
24 class ShutdownWatcherHelper; | 24 class ShutdownWatcherHelper; |
25 class TranslateManager; | 25 class TranslateManager; |
26 struct MainFunctionParams; | |
27 | 26 |
28 namespace chrome_browser { | 27 namespace chrome_browser { |
29 // For use by ShowMissingLocaleMessageBox. | 28 // For use by ShowMissingLocaleMessageBox. |
30 extern const char kMissingLocaleDataTitle[]; | 29 extern const char kMissingLocaleDataTitle[]; |
31 extern const char kMissingLocaleDataMessage[]; | 30 extern const char kMissingLocaleDataMessage[]; |
32 } | 31 } |
33 | 32 |
| 33 namespace content { |
| 34 struct MainFunctionParams; |
| 35 } |
| 36 |
34 class ChromeBrowserMainParts : public content::BrowserMainParts { | 37 class ChromeBrowserMainParts : public content::BrowserMainParts { |
35 public: | 38 public: |
36 virtual ~ChromeBrowserMainParts(); | 39 virtual ~ChromeBrowserMainParts(); |
37 | 40 |
38 // Constructs metrics service and does related initialization, including | 41 // Constructs metrics service and does related initialization, including |
39 // creation of field trials. Call only after labs have been converted to | 42 // creation of field trials. Call only after labs have been converted to |
40 // switches. | 43 // switches. |
41 MetricsService* SetupMetricsAndFieldTrials(PrefService* local_state); | 44 MetricsService* SetupMetricsAndFieldTrials(PrefService* local_state); |
42 | 45 |
43 const MainFunctionParams& parameters() const { | 46 const content::MainFunctionParams& parameters() const { |
44 return parameters_; | 47 return parameters_; |
45 } | 48 } |
46 const CommandLine& parsed_command_line() const { | 49 const CommandLine& parsed_command_line() const { |
47 return parsed_command_line_; | 50 return parsed_command_line_; |
48 } | 51 } |
49 | 52 |
50 protected: | 53 protected: |
51 explicit ChromeBrowserMainParts(const MainFunctionParams& parameters); | 54 explicit ChromeBrowserMainParts( |
| 55 const content::MainFunctionParams& parameters); |
52 | 56 |
53 // content::BrowserParts overrides | 57 // content::BrowserParts overrides |
54 virtual void PreEarlyInitialization() OVERRIDE {} | 58 virtual void PreEarlyInitialization() OVERRIDE {} |
55 virtual void PostEarlyInitialization() OVERRIDE {} | 59 virtual void PostEarlyInitialization() OVERRIDE {} |
56 virtual void PreMainMessageLoopStart() OVERRIDE {} | 60 virtual void PreMainMessageLoopStart() OVERRIDE {} |
57 virtual void ToolkitInitialized() OVERRIDE; | 61 virtual void ToolkitInitialized() OVERRIDE; |
58 virtual void PostMainMessageLoopStart() OVERRIDE {} | 62 virtual void PostMainMessageLoopStart() OVERRIDE {} |
59 virtual void PreMainMessageLoopRun() OVERRIDE; | 63 virtual void PreMainMessageLoopRun() OVERRIDE; |
60 virtual bool MainMessageLoopRun(int* result_code) OVERRIDE; | 64 virtual bool MainMessageLoopRun(int* result_code) OVERRIDE; |
61 virtual void PostMainMessageLoopRun(); | 65 virtual void PostMainMessageLoopRun(); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 // Add an invocation of your field trial init function to this method. | 106 // Add an invocation of your field trial init function to this method. |
103 void SetupFieldTrials(bool metrics_recording_enabled, | 107 void SetupFieldTrials(bool metrics_recording_enabled, |
104 bool proxy_policy_is_set); | 108 bool proxy_policy_is_set); |
105 | 109 |
106 // Methods for Main Message Loop ------------------------------------------- | 110 // Methods for Main Message Loop ------------------------------------------- |
107 | 111 |
108 int PreMainMessageLoopRunImpl(); | 112 int PreMainMessageLoopRunImpl(); |
109 | 113 |
110 // Members initialized on construction --------------------------------------- | 114 // Members initialized on construction --------------------------------------- |
111 | 115 |
112 const MainFunctionParams& parameters_; | 116 const content::MainFunctionParams& parameters_; |
113 const CommandLine& parsed_command_line_; | 117 const CommandLine& parsed_command_line_; |
114 int result_code_; | 118 int result_code_; |
115 | 119 |
116 // Create ShutdownWatcherHelper object for watching jank during shutdown. | 120 // Create ShutdownWatcherHelper object for watching jank during shutdown. |
117 // Please keep |shutdown_watcher| as the first object constructed, and hence | 121 // Please keep |shutdown_watcher| as the first object constructed, and hence |
118 // it is destroyed last. | 122 // it is destroyed last. |
119 scoped_ptr<ShutdownWatcherHelper> shutdown_watcher_; | 123 scoped_ptr<ShutdownWatcherHelper> shutdown_watcher_; |
120 | 124 |
121 // Creating this object starts tracking the creation and deletion of Task | 125 // Creating this object starts tracking the creation and deletion of Task |
122 // instance. This MUST be done before main_message_loop, so that it is | 126 // instance. This MUST be done before main_message_loop, so that it is |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 // Records the time from our process' startup to the present time in | 165 // Records the time from our process' startup to the present time in |
162 // the UMA histogram |metric_name|. | 166 // the UMA histogram |metric_name|. |
163 void RecordBrowserStartupTime(); | 167 void RecordBrowserStartupTime(); |
164 | 168 |
165 // Records a time value to an UMA histogram in the context of the | 169 // Records a time value to an UMA histogram in the context of the |
166 // PreReadExperiment field-trial. This also reports to the appropriate | 170 // PreReadExperiment field-trial. This also reports to the appropriate |
167 // sub-histogram (_PreRead(Enabled|Disabled)). | 171 // sub-histogram (_PreRead(Enabled|Disabled)). |
168 void RecordPreReadExperimentTime(const char* name, base::TimeDelta time); | 172 void RecordPreReadExperimentTime(const char* name, base::TimeDelta time); |
169 | 173 |
170 #endif // CHROME_BROWSER_CHROME_BROWSER_MAIN_H_ | 174 #endif // CHROME_BROWSER_CHROME_BROWSER_MAIN_H_ |
OLD | NEW |