| 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_vector.h" |
| 11 #include "base/metrics/field_trial.h" | 12 #include "base/metrics/field_trial.h" |
| 12 #include "base/tracked_objects.h" | 13 #include "base/tracked_objects.h" |
| 13 #include "chrome/browser/first_run/first_run.h" | 14 #include "chrome/browser/first_run/first_run.h" |
| 14 #include "chrome/browser/process_singleton.h" | 15 #include "chrome/browser/process_singleton.h" |
| 15 #include "content/browser/browser_main.h" | 16 #include "content/browser/browser_main.h" |
| 16 | 17 |
| 17 class BrowserProcessImpl; | 18 class BrowserProcessImpl; |
| 18 class FieldTrialSynchronizer; | 19 class FieldTrialSynchronizer; |
| 19 class HistogramSynchronizer; | 20 class HistogramSynchronizer; |
| 20 class MetricsService; | 21 class MetricsService; |
| 21 class PrefService; | 22 class PrefService; |
| 22 class Profile; | 23 class Profile; |
| 23 class ShutdownWatcherHelper; | 24 class ShutdownWatcherHelper; |
| 24 class TranslateManager; | 25 class TranslateManager; |
| 25 | 26 |
| 26 namespace chrome_browser { | 27 namespace chrome_browser { |
| 27 // For use by ShowMissingLocaleMessageBox. | 28 // For use by ShowMissingLocaleMessageBox. |
| 28 extern const char kMissingLocaleDataTitle[]; | 29 extern const char kMissingLocaleDataTitle[]; |
| 29 extern const char kMissingLocaleDataMessage[]; | 30 extern const char kMissingLocaleDataMessage[]; |
| 30 } | 31 } |
| 31 | 32 |
| 32 class ChromeBrowserMainParts : public content::BrowserMainParts { | 33 class ChromeBrowserMainParts : public content::BrowserMainParts { |
| 33 public: | 34 public: |
| 34 virtual ~ChromeBrowserMainParts(); | 35 virtual ~ChromeBrowserMainParts(); |
| 35 | 36 |
| 37 // Subclass to handle setup for parts orthagonal to the OS (GTK, Aura, etc). |
| 38 class ExtraParts { |
| 39 public: |
| 40 explicit ExtraParts(ChromeBrowserMainParts* main_parts); |
| 41 virtual ~ExtraParts(); |
| 42 |
| 43 virtual void PreEarlyInitialization(); |
| 44 virtual void PostEarlyInitialization(); |
| 45 virtual void PreMainMessageLoopRun(); |
| 46 virtual void PostMainMessageLoopRun(); |
| 47 |
| 48 protected: |
| 49 ChromeBrowserMainParts* main_parts() { return main_parts_; } |
| 50 |
| 51 private: |
| 52 ChromeBrowserMainParts* main_parts_; |
| 53 |
| 54 DISALLOW_COPY_AND_ASSIGN(ExtraParts); |
| 55 }; |
| 56 |
| 36 // Constructs metrics service and does related initialization, including | 57 // Constructs metrics service and does related initialization, including |
| 37 // creation of field trials. Call only after labs have been converted to | 58 // creation of field trials. Call only after labs have been converted to |
| 38 // switches. | 59 // switches. |
| 39 MetricsService* SetupMetricsAndFieldTrials( | 60 MetricsService* SetupMetricsAndFieldTrials( |
| 40 const CommandLine& parsed_command_line, | 61 const CommandLine& parsed_command_line, |
| 41 PrefService* local_state); | 62 PrefService* local_state); |
| 42 | 63 |
| 43 protected: | 64 protected: |
| 44 explicit ChromeBrowserMainParts(const MainFunctionParams& parameters); | 65 explicit ChromeBrowserMainParts(const MainFunctionParams& parameters); |
| 45 | 66 |
| 67 // content::BrowserMainParts overrides |
| 68 virtual void PreEarlyInitialization() OVERRIDE; |
| 69 virtual void PostEarlyInitialization() OVERRIDE; |
| 46 virtual void PreMainMessageLoopRun() OVERRIDE; | 70 virtual void PreMainMessageLoopRun() OVERRIDE; |
| 47 int PreMainMessageLoopRunInternal(); | |
| 48 virtual void MainMessageLoopRun() OVERRIDE; | 71 virtual void MainMessageLoopRun() OVERRIDE; |
| 49 virtual void PostMainMessageLoopRun() OVERRIDE; | 72 virtual void PostMainMessageLoopRun() OVERRIDE; |
| 50 virtual void ToolkitInitialized() OVERRIDE; | 73 virtual void ToolkitInitialized() OVERRIDE; |
| 51 | 74 |
| 75 // New virtuals |
| 76 |
| 77 // Displays a warning message that we can't find any locale data files. |
| 78 virtual void ShowMissingLocaleMessageBox() = 0; |
| 79 // Handles the --hide-icons and --show-icons command line options. |
| 80 virtual int HandleIconsCommands() = 0; |
| 81 // Check if there is any machine level Chrome installed. If so, handle it |
| 82 // and return true. |
| 83 virtual bool CheckMachineLevelInstall() = 0; |
| 84 // Prepare localization, etc for handling crashes. |
| 85 virtual void PrepareRestartOnCrashEnviroment() = 0; |
| 86 |
| 52 private: | 87 private: |
| 88 int PreMainMessageLoopRunInternal(); |
| 89 |
| 53 // Methods for |EarlyInitialization()| --------------------------------------- | 90 // Methods for |EarlyInitialization()| --------------------------------------- |
| 54 | 91 |
| 55 // A/B test for the maximum number of persistent connections per host. | 92 // A/B test for the maximum number of persistent connections per host. |
| 56 void ConnectionFieldTrial(); | 93 void ConnectionFieldTrial(); |
| 57 | 94 |
| 58 // A/B test for determining a value for unused socket timeout. | 95 // A/B test for determining a value for unused socket timeout. |
| 59 void SocketTimeoutFieldTrial(); | 96 void SocketTimeoutFieldTrial(); |
| 60 | 97 |
| 61 // A/B test for the maximum number of connections per proxy server. | 98 // A/B test for the maximum number of connections per proxy server. |
| 62 void ProxyConnectionsFieldTrial(); | 99 void ProxyConnectionsFieldTrial(); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 // Creating this object starts tracking the creation and deletion of Task | 137 // Creating this object starts tracking the creation and deletion of Task |
| 101 // instance. This MUST be done before main_message_loop, so that it is | 138 // instance. This MUST be done before main_message_loop, so that it is |
| 102 // destroyed after the main_message_loop. | 139 // destroyed after the main_message_loop. |
| 103 tracked_objects::AutoTracking tracking_objects_; | 140 tracked_objects::AutoTracking tracking_objects_; |
| 104 #endif | 141 #endif |
| 105 | 142 |
| 106 // Statistical testing infrastructure for the entire browser. NULL until | 143 // Statistical testing infrastructure for the entire browser. NULL until |
| 107 // SetupMetricsAndFieldTrials is called. | 144 // SetupMetricsAndFieldTrials is called. |
| 108 scoped_ptr<base::FieldTrialList> field_trial_list_; | 145 scoped_ptr<base::FieldTrialList> field_trial_list_; |
| 109 | 146 |
| 147 // Vector of extra parts instantiated in the constructor. |
| 148 // The virtual methods on each of these are called in the order added. |
| 149 // They are releaed (destroyed) in the opposite order. |
| 150 typedef ScopedVector<ExtraParts> PartsList; |
| 151 PartsList extra_parts_; |
| 152 |
| 110 // Members initialized after / released before main_message_loop_ ------------ | 153 // Members initialized after / released before main_message_loop_ ------------ |
| 111 | 154 |
| 112 scoped_ptr<BrowserProcessImpl> browser_process_; | 155 scoped_ptr<BrowserProcessImpl> browser_process_; |
| 113 scoped_refptr<HistogramSynchronizer> histogram_synchronizer_; | 156 scoped_refptr<HistogramSynchronizer> histogram_synchronizer_; |
| 114 scoped_ptr<ProcessSingleton> process_singleton_; | 157 scoped_ptr<ProcessSingleton> process_singleton_; |
| 115 scoped_ptr<FirstRun::MasterPrefs> master_prefs_; | 158 scoped_ptr<FirstRun::MasterPrefs> master_prefs_; |
| 116 bool record_search_engine_; | 159 bool record_search_engine_; |
| 117 TranslateManager* translate_manager_; | 160 TranslateManager* translate_manager_; |
| 118 Profile* profile_; | 161 Profile* profile_; |
| 119 bool run_message_loop_; | 162 bool run_message_loop_; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 131 // Records the conditions that can prevent Breakpad from generating and | 174 // Records the conditions that can prevent Breakpad from generating and |
| 132 // sending crash reports. The presence of a Breakpad handler (after | 175 // sending crash reports. The presence of a Breakpad handler (after |
| 133 // attempting to initialize crash reporting) and the presence of a debugger | 176 // attempting to initialize crash reporting) and the presence of a debugger |
| 134 // are registered with the UMA metrics service. | 177 // are registered with the UMA metrics service. |
| 135 void RecordBreakpadStatusUMA(MetricsService* metrics); | 178 void RecordBreakpadStatusUMA(MetricsService* metrics); |
| 136 | 179 |
| 137 // Displays a warning message if some minimum level of OS support is not | 180 // Displays a warning message if some minimum level of OS support is not |
| 138 // present on the current platform. | 181 // present on the current platform. |
| 139 void WarnAboutMinimumSystemRequirements(); | 182 void WarnAboutMinimumSystemRequirements(); |
| 140 | 183 |
| 141 // Displays a warning message that we can't find any locale data files. | |
| 142 void ShowMissingLocaleMessageBox(); | |
| 143 | |
| 144 // Records the time from our process' startup to the present time in | 184 // Records the time from our process' startup to the present time in |
| 145 // the UMA histogram |metric_name|. | 185 // the UMA histogram |metric_name|. |
| 146 void RecordBrowserStartupTime(); | 186 void RecordBrowserStartupTime(); |
| 147 | 187 |
| 148 // Records a time value to an UMA histogram in the context of the | 188 // Records a time value to an UMA histogram in the context of the |
| 149 // PreReadExperiment field-trial. This also reports to the appropriate | 189 // PreReadExperiment field-trial. This also reports to the appropriate |
| 150 // sub-histogram (_PreRead(Enabled|Disabled)). | 190 // sub-histogram (_PreRead(Enabled|Disabled)). |
| 151 void RecordPreReadExperimentTime(const char* name, base::TimeDelta time); | 191 void RecordPreReadExperimentTime(const char* name, base::TimeDelta time); |
| 152 | 192 |
| 153 #endif // CHROME_BROWSER_CHROME_BROWSER_MAIN_H_ | 193 #endif // CHROME_BROWSER_CHROME_BROWSER_MAIN_H_ |
| OLD | NEW |