| 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 "chrome/browser/ui/browser_init.h" |
| 16 #include "content/public/browser/browser_main_parts.h" | 17 #include "content/public/browser/browser_main_parts.h" |
| 18 #include "content/public/browser/browser_thread.h" |
| 17 | 19 |
| 18 class BrowserProcessImpl; | 20 class BrowserProcessImpl; |
| 19 class FieldTrialSynchronizer; | 21 class FieldTrialSynchronizer; |
| 20 class HistogramSynchronizer; | 22 class HistogramSynchronizer; |
| 21 class MetricsService; | 23 class MetricsService; |
| 22 class PrefService; | 24 class PrefService; |
| 23 class Profile; | 25 class Profile; |
| 24 class ShutdownWatcherHelper; | 26 class ShutdownWatcherHelper; |
| 25 class TranslateManager; | 27 class TranslateManager; |
| 26 | 28 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 explicit ChromeBrowserMainParts( | 60 explicit ChromeBrowserMainParts( |
| 59 const content::MainFunctionParams& parameters); | 61 const content::MainFunctionParams& parameters); |
| 60 | 62 |
| 61 // content::BrowserParts overrides | 63 // content::BrowserParts overrides |
| 62 virtual void PreEarlyInitialization() OVERRIDE {} | 64 virtual void PreEarlyInitialization() OVERRIDE {} |
| 63 virtual void PostEarlyInitialization() OVERRIDE {} | 65 virtual void PostEarlyInitialization() OVERRIDE {} |
| 64 virtual void PreMainMessageLoopStart() OVERRIDE {} | 66 virtual void PreMainMessageLoopStart() OVERRIDE {} |
| 65 virtual void ToolkitInitialized() OVERRIDE; | 67 virtual void ToolkitInitialized() OVERRIDE; |
| 66 virtual void PostMainMessageLoopStart() OVERRIDE {} | 68 virtual void PostMainMessageLoopStart() OVERRIDE {} |
| 67 virtual void PreMainMessageLoopRun() OVERRIDE; | 69 virtual void PreMainMessageLoopRun() OVERRIDE; |
| 70 virtual void PreMainMessageLoopRunThreadsCreated() OVERRIDE; |
| 68 virtual bool MainMessageLoopRun(int* result_code) OVERRIDE; | 71 virtual bool MainMessageLoopRun(int* result_code) OVERRIDE; |
| 69 virtual void PostMainMessageLoopRun(); | 72 virtual void PostMainMessageLoopRun() OVERRIDE; |
| 73 virtual void PreStopThread(content::BrowserThread::ID identifier) OVERRIDE; |
| 74 virtual void PostStopThread(content::BrowserThread::ID identifier) OVERRIDE; |
| 75 virtual void FinalCleanup() OVERRIDE; |
| 70 | 76 |
| 71 // Displays a warning message that we can't find any locale data files. | 77 // Displays a warning message that we can't find any locale data files. |
| 72 virtual void ShowMissingLocaleMessageBox() = 0; | 78 virtual void ShowMissingLocaleMessageBox() = 0; |
| 73 | 79 |
| 74 private: | 80 private: |
| 75 // Methods for |EarlyInitialization()| --------------------------------------- | 81 // Methods for |EarlyInitialization()| --------------------------------------- |
| 76 | 82 |
| 77 // A/B test for the maximum number of persistent connections per host. | 83 // A/B test for the maximum number of persistent connections per host. |
| 78 void ConnectionFieldTrial(); | 84 void ConnectionFieldTrial(); |
| 79 | 85 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 107 const CommandLine& parsed_command_line, | 113 const CommandLine& parsed_command_line, |
| 108 const PrefService* local_state); | 114 const PrefService* local_state); |
| 109 | 115 |
| 110 // Add an invocation of your field trial init function to this method. | 116 // Add an invocation of your field trial init function to this method. |
| 111 void SetupFieldTrials(bool metrics_recording_enabled, | 117 void SetupFieldTrials(bool metrics_recording_enabled, |
| 112 bool proxy_policy_is_set); | 118 bool proxy_policy_is_set); |
| 113 | 119 |
| 114 // Methods for Main Message Loop ------------------------------------------- | 120 // Methods for Main Message Loop ------------------------------------------- |
| 115 | 121 |
| 116 int PreMainMessageLoopRunImpl(); | 122 int PreMainMessageLoopRunImpl(); |
| 123 int PreMainMessageLoopRunThreadsCreatedImpl(); |
| 117 | 124 |
| 118 // Members initialized on construction --------------------------------------- | 125 // Members initialized on construction --------------------------------------- |
| 119 | 126 |
| 120 const content::MainFunctionParams& parameters_; | 127 const content::MainFunctionParams& parameters_; |
| 121 const CommandLine& parsed_command_line_; | 128 const CommandLine& parsed_command_line_; |
| 122 int result_code_; | 129 int result_code_; |
| 123 | 130 |
| 124 // Create ShutdownWatcherHelper object for watching jank during shutdown. | 131 // Create ShutdownWatcherHelper object for watching jank during shutdown. |
| 125 // Please keep |shutdown_watcher| as the first object constructed, and hence | 132 // Please keep |shutdown_watcher| as the first object constructed, and hence |
| 126 // it is destroyed last. | 133 // it is destroyed last. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 145 scoped_ptr<FirstRun::MasterPrefs> master_prefs_; | 152 scoped_ptr<FirstRun::MasterPrefs> master_prefs_; |
| 146 bool record_search_engine_; | 153 bool record_search_engine_; |
| 147 TranslateManager* translate_manager_; | 154 TranslateManager* translate_manager_; |
| 148 Profile* profile_; | 155 Profile* profile_; |
| 149 bool run_message_loop_; | 156 bool run_message_loop_; |
| 150 ProcessSingleton::NotifyResult notify_result_; | 157 ProcessSingleton::NotifyResult notify_result_; |
| 151 | 158 |
| 152 // Initialized in SetupMetricsAndFieldTrials. | 159 // Initialized in SetupMetricsAndFieldTrials. |
| 153 scoped_refptr<FieldTrialSynchronizer> field_trial_synchronizer_; | 160 scoped_refptr<FieldTrialSynchronizer> field_trial_synchronizer_; |
| 154 | 161 |
| 162 // Members initialized in PreMainMessageLoopRun, needed in |
| 163 // PreMainMessageLoopRunThreadsCreated. |
| 164 bool is_first_run_; |
| 165 bool first_run_ui_bypass_; |
| 166 MetricsService* metrics_; |
| 167 BrowserInit browser_init_; |
| 168 PrefService* local_state_; |
| 169 FilePath user_data_dir_; |
| 170 |
| 155 FRIEND_TEST(BrowserMainTest, WarmConnectionFieldTrial_WarmestSocket); | 171 FRIEND_TEST(BrowserMainTest, WarmConnectionFieldTrial_WarmestSocket); |
| 156 FRIEND_TEST(BrowserMainTest, WarmConnectionFieldTrial_Random); | 172 FRIEND_TEST(BrowserMainTest, WarmConnectionFieldTrial_Random); |
| 157 FRIEND_TEST(BrowserMainTest, WarmConnectionFieldTrial_Invalid); | 173 FRIEND_TEST(BrowserMainTest, WarmConnectionFieldTrial_Invalid); |
| 158 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainParts); | 174 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainParts); |
| 159 }; | 175 }; |
| 160 | 176 |
| 161 // Records the conditions that can prevent Breakpad from generating and | 177 // Records the conditions that can prevent Breakpad from generating and |
| 162 // sending crash reports. The presence of a Breakpad handler (after | 178 // sending crash reports. The presence of a Breakpad handler (after |
| 163 // attempting to initialize crash reporting) and the presence of a debugger | 179 // attempting to initialize crash reporting) and the presence of a debugger |
| 164 // are registered with the UMA metrics service. | 180 // are registered with the UMA metrics service. |
| 165 void RecordBreakpadStatusUMA(MetricsService* metrics); | 181 void RecordBreakpadStatusUMA(MetricsService* metrics); |
| 166 | 182 |
| 167 // Displays a warning message if some minimum level of OS support is not | 183 // Displays a warning message if some minimum level of OS support is not |
| 168 // present on the current platform. | 184 // present on the current platform. |
| 169 void WarnAboutMinimumSystemRequirements(); | 185 void WarnAboutMinimumSystemRequirements(); |
| 170 | 186 |
| 171 // Records the time from our process' startup to the present time in | 187 // Records the time from our process' startup to the present time in |
| 172 // the UMA histogram |metric_name|. | 188 // the UMA histogram |metric_name|. |
| 173 void RecordBrowserStartupTime(); | 189 void RecordBrowserStartupTime(); |
| 174 | 190 |
| 175 // Records a time value to an UMA histogram in the context of the | 191 // Records a time value to an UMA histogram in the context of the |
| 176 // PreReadExperiment field-trial. This also reports to the appropriate | 192 // PreReadExperiment field-trial. This also reports to the appropriate |
| 177 // sub-histogram (_PreRead(Enabled|Disabled)). | 193 // sub-histogram (_PreRead(Enabled|Disabled)). |
| 178 void RecordPreReadExperimentTime(const char* name, base::TimeDelta time); | 194 void RecordPreReadExperimentTime(const char* name, base::TimeDelta time); |
| 179 | 195 |
| 180 #endif // CHROME_BROWSER_CHROME_BROWSER_MAIN_H_ | 196 #endif // CHROME_BROWSER_CHROME_BROWSER_MAIN_H_ |
| OLD | NEW |