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 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 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 virtual void ShowMissingLocaleMessageBox() = 0; | 94 virtual void ShowMissingLocaleMessageBox() = 0; |
95 | 95 |
96 const content::MainFunctionParams& parameters() const { | 96 const content::MainFunctionParams& parameters() const { |
97 return parameters_; | 97 return parameters_; |
98 } | 98 } |
99 const CommandLine& parsed_command_line() const { | 99 const CommandLine& parsed_command_line() const { |
100 return parsed_command_line_; | 100 return parsed_command_line_; |
101 } | 101 } |
102 | 102 |
103 Profile* profile() { return profile_; } | 103 Profile* profile() { return profile_; } |
| 104 bool do_first_run_tasks() const { return do_first_run_tasks_; } |
104 | 105 |
105 const PrefService* local_state() const { return local_state_; } | 106 const PrefService* local_state() const { return local_state_; } |
106 | 107 |
107 private: | 108 private: |
108 // Methods for |SetupMetricsAndFieldTrials()| -------------------------------- | 109 // Methods for |SetupMetricsAndFieldTrials()| -------------------------------- |
109 | 110 |
110 // Constructs metrics service and does related initialization, including | 111 // Constructs metrics service and does related initialization, including |
111 // creation of field trials. Call only after labs have been converted to | 112 // creation of field trials. Call only after labs have been converted to |
112 // switches. | 113 // switches. |
113 void SetupMetricsAndFieldTrials(); | 114 void SetupMetricsAndFieldTrials(); |
114 | 115 |
115 // Starts recording of metrics. This can only be called after we have a file | 116 // Starts recording of metrics. This can only be called after we have a file |
116 // thread. | 117 // thread. |
117 void StartMetricsRecording(); | 118 void StartMetricsRecording(); |
118 | 119 |
119 // Returns true if the user opted in to sending metric reports. | 120 // Returns true if the user opted in to sending metric reports. |
120 bool IsMetricsReportingEnabled(); | 121 bool IsMetricsReportingEnabled(); |
121 | 122 |
| 123 // Record time from process startup to present time in an UMA histogram. |
| 124 // |is_first_run| - is the current launch part of a first run. |
| 125 void RecordBrowserStartupTime(bool is_first_run); |
| 126 |
| 127 // Records a time value to an UMA histogram in the context of the |
| 128 // PreReadExperiment field-trial. This also reports to the appropriate |
| 129 // sub-histogram (_PreRead(Enabled|Disabled)). |
| 130 void RecordPreReadExperimentTime(const char* name, base::TimeDelta time); |
| 131 |
122 // Methods for Main Message Loop ------------------------------------------- | 132 // Methods for Main Message Loop ------------------------------------------- |
123 | 133 |
124 int PreCreateThreadsImpl(); | 134 int PreCreateThreadsImpl(); |
125 int PreMainMessageLoopRunImpl(); | 135 int PreMainMessageLoopRunImpl(); |
126 | 136 |
127 // Members initialized on construction --------------------------------------- | 137 // Members initialized on construction --------------------------------------- |
128 | 138 |
129 const content::MainFunctionParams& parameters_; | 139 const content::MainFunctionParams& parameters_; |
130 const CommandLine& parsed_command_line_; | 140 const CommandLine& parsed_command_line_; |
131 int result_code_; | 141 int result_code_; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 tracking_synchronizer_; | 177 tracking_synchronizer_; |
168 #if !defined(OS_ANDROID) | 178 #if !defined(OS_ANDROID) |
169 // Browser creation happens on the Java side in Android. | 179 // Browser creation happens on the Java side in Android. |
170 scoped_ptr<StartupBrowserCreator> browser_creator_; | 180 scoped_ptr<StartupBrowserCreator> browser_creator_; |
171 | 181 |
172 // Android doesn't support multiple browser processes, so it doesn't implement | 182 // Android doesn't support multiple browser processes, so it doesn't implement |
173 // ProcessSingleton. | 183 // ProcessSingleton. |
174 scoped_ptr<ChromeProcessSingleton> process_singleton_; | 184 scoped_ptr<ChromeProcessSingleton> process_singleton_; |
175 #endif | 185 #endif |
176 scoped_ptr<first_run::MasterPrefs> master_prefs_; | 186 scoped_ptr<first_run::MasterPrefs> master_prefs_; |
177 bool record_search_engine_; | |
178 TranslateManager* translate_manager_; | 187 TranslateManager* translate_manager_; |
179 Profile* profile_; | 188 Profile* profile_; |
180 bool run_message_loop_; | 189 bool run_message_loop_; |
181 ProcessSingleton::NotifyResult notify_result_; | 190 ProcessSingleton::NotifyResult notify_result_; |
182 scoped_ptr<ThreeDAPIObserver> three_d_observer_; | 191 scoped_ptr<ThreeDAPIObserver> three_d_observer_; |
183 | 192 |
184 // Initialized in SetupMetricsAndFieldTrials. | 193 // Initialized in SetupMetricsAndFieldTrials. |
185 scoped_refptr<FieldTrialSynchronizer> field_trial_synchronizer_; | 194 scoped_refptr<FieldTrialSynchronizer> field_trial_synchronizer_; |
186 | 195 |
187 // Members initialized in PreMainMessageLoopRun, needed in | 196 // Members initialized in PreMainMessageLoopRun, needed in |
188 // PreMainMessageLoopRunThreadsCreated. | 197 // PreMainMessageLoopRunThreadsCreated. |
189 bool do_first_run_tasks_; | 198 bool do_first_run_tasks_; |
190 PrefService* local_state_; | 199 PrefService* local_state_; |
191 base::FilePath user_data_dir_; | 200 base::FilePath user_data_dir_; |
192 | 201 |
193 #if !defined(OS_ANDROID) | 202 #if !defined(OS_ANDROID) |
194 scoped_ptr<ActiveTabTracker> active_tab_tracker_; | 203 scoped_ptr<ActiveTabTracker> active_tab_tracker_; |
195 #endif | 204 #endif |
196 | 205 |
197 // Members needed across shutdown methods. | 206 // Members needed across shutdown methods. |
198 bool restart_last_session_; | 207 bool restart_last_session_; |
199 | 208 |
200 // Tests can set this to true to disable restricting cookie access in the | 209 // Tests can set this to true to disable restricting cookie access in the |
201 // network stack, as this can only be done once. | 210 // network stack, as this can only be done once. |
202 static bool disable_enforcing_cookie_policies_for_tests_; | 211 static bool disable_enforcing_cookie_policies_for_tests_; |
203 | 212 |
204 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainParts); | 213 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainParts); |
205 }; | 214 }; |
206 | 215 |
207 // Records the conditions that can prevent Breakpad from generating and | |
208 // sending crash reports. The presence of a Breakpad handler (after | |
209 // attempting to initialize crash reporting) and the presence of a debugger | |
210 // are registered with the UMA metrics service. | |
211 void RecordBreakpadStatusUMA(MetricsService* metrics); | |
212 | |
213 // Displays a warning message if some minimum level of OS support is not | |
214 // present on the current platform. | |
215 void WarnAboutMinimumSystemRequirements(); | |
216 | |
217 // Record time from process startup to present time in an UMA histogram. | |
218 // |is_first_run| - is the current launch part of a first run. | |
219 void RecordBrowserStartupTime(bool is_first_run); | |
220 | |
221 // Records a time value to an UMA histogram in the context of the | |
222 // PreReadExperiment field-trial. This also reports to the appropriate | |
223 // sub-histogram (_PreRead(Enabled|Disabled)). | |
224 void RecordPreReadExperimentTime(const char* name, base::TimeDelta time); | |
225 | |
226 #endif // CHROME_BROWSER_CHROME_BROWSER_MAIN_H_ | 216 #endif // CHROME_BROWSER_CHROME_BROWSER_MAIN_H_ |
OLD | NEW |