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/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/public/browser/browser_main_parts.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; |
| 26 struct MainFunctionParams; |
25 | 27 |
26 namespace chrome_browser { | 28 namespace chrome_browser { |
27 // For use by ShowMissingLocaleMessageBox. | 29 // For use by ShowMissingLocaleMessageBox. |
28 extern const char kMissingLocaleDataTitle[]; | 30 extern const char kMissingLocaleDataTitle[]; |
29 extern const char kMissingLocaleDataMessage[]; | 31 extern const char kMissingLocaleDataMessage[]; |
30 } | 32 } |
31 | 33 |
32 class ChromeBrowserMainParts : public content::BrowserMainParts { | 34 class ChromeBrowserMainParts : public content::BrowserMainParts { |
33 public: | 35 public: |
34 virtual ~ChromeBrowserMainParts(); | 36 virtual ~ChromeBrowserMainParts(); |
35 | 37 |
36 // Constructs metrics service and does related initialization, including | 38 // Constructs metrics service and does related initialization, including |
37 // creation of field trials. Call only after labs have been converted to | 39 // creation of field trials. Call only after labs have been converted to |
38 // switches. | 40 // switches. |
39 MetricsService* SetupMetricsAndFieldTrials( | 41 MetricsService* SetupMetricsAndFieldTrials(PrefService* local_state); |
40 const CommandLine& parsed_command_line, | 42 |
41 PrefService* local_state); | 43 const MainFunctionParams& parameters() const { |
| 44 return parameters_; |
| 45 } |
| 46 const CommandLine& parsed_command_line() const { |
| 47 return parsed_command_line_; |
| 48 } |
42 | 49 |
43 protected: | 50 protected: |
44 explicit ChromeBrowserMainParts(const MainFunctionParams& parameters); | 51 explicit ChromeBrowserMainParts(const MainFunctionParams& parameters); |
45 | 52 |
46 virtual void PreMainMessageLoopRun() OVERRIDE; | 53 // content::BrowserParts overrides |
47 int PreMainMessageLoopRunInternal(); | 54 virtual void PreEarlyInitialization() OVERRIDE {} |
48 virtual void MainMessageLoopRun() OVERRIDE; | 55 virtual void PostEarlyInitialization() OVERRIDE {} |
49 virtual void PostMainMessageLoopRun() OVERRIDE; | 56 virtual void PreMainMessageLoopStart() OVERRIDE {} |
50 virtual void ToolkitInitialized() OVERRIDE; | 57 virtual void ToolkitInitialized() OVERRIDE; |
| 58 virtual void PostMainMessageLoopStart() OVERRIDE {} |
| 59 virtual int PreMainMessageLoopRun() OVERRIDE; |
| 60 virtual bool MainMessageLoopRun() OVERRIDE; |
| 61 virtual void PostMainMessageLoopRun(); |
| 62 |
| 63 // Displays a warning message that we can't find any locale data files. |
| 64 virtual void ShowMissingLocaleMessageBox() = 0; |
51 | 65 |
52 private: | 66 private: |
53 // Methods for |EarlyInitialization()| --------------------------------------- | 67 // Methods for |EarlyInitialization()| --------------------------------------- |
54 | 68 |
55 // A/B test for the maximum number of persistent connections per host. | 69 // A/B test for the maximum number of persistent connections per host. |
56 void ConnectionFieldTrial(); | 70 void ConnectionFieldTrial(); |
57 | 71 |
58 // A/B test for determining a value for unused socket timeout. | 72 // A/B test for determining a value for unused socket timeout. |
59 void SocketTimeoutFieldTrial(); | 73 void SocketTimeoutFieldTrial(); |
60 | 74 |
(...skipping 23 matching lines...) Expand all Loading... |
84 static MetricsService* InitializeMetrics( | 98 static MetricsService* InitializeMetrics( |
85 const CommandLine& parsed_command_line, | 99 const CommandLine& parsed_command_line, |
86 const PrefService* local_state); | 100 const PrefService* local_state); |
87 | 101 |
88 // Add an invocation of your field trial init function to this method. | 102 // Add an invocation of your field trial init function to this method. |
89 void SetupFieldTrials(bool metrics_recording_enabled, | 103 void SetupFieldTrials(bool metrics_recording_enabled, |
90 bool proxy_policy_is_set); | 104 bool proxy_policy_is_set); |
91 | 105 |
92 // Members initialized on construction --------------------------------------- | 106 // Members initialized on construction --------------------------------------- |
93 | 107 |
| 108 const MainFunctionParams& parameters_; |
| 109 const CommandLine& parsed_command_line_; |
| 110 |
94 // Create ShutdownWatcherHelper object for watching jank during shutdown. | 111 // Create ShutdownWatcherHelper object for watching jank during shutdown. |
95 // Please keep |shutdown_watcher| as the first object constructed, and hence | 112 // Please keep |shutdown_watcher| as the first object constructed, and hence |
96 // it is destroyed last. | 113 // it is destroyed last. |
97 scoped_ptr<ShutdownWatcherHelper> shutdown_watcher_; | 114 scoped_ptr<ShutdownWatcherHelper> shutdown_watcher_; |
98 | 115 |
99 #if defined(TRACK_ALL_TASK_OBJECTS) | 116 #if defined(TRACK_ALL_TASK_OBJECTS) |
100 // Creating this object starts tracking the creation and deletion of Task | 117 // 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 | 118 // instance. This MUST be done before main_message_loop, so that it is |
102 // destroyed after the main_message_loop. | 119 // destroyed after the main_message_loop. |
103 tracked_objects::AutoTracking tracking_objects_; | 120 tracked_objects::AutoTracking tracking_objects_; |
(...skipping 27 matching lines...) Expand all Loading... |
131 // Records the conditions that can prevent Breakpad from generating and | 148 // Records the conditions that can prevent Breakpad from generating and |
132 // sending crash reports. The presence of a Breakpad handler (after | 149 // sending crash reports. The presence of a Breakpad handler (after |
133 // attempting to initialize crash reporting) and the presence of a debugger | 150 // attempting to initialize crash reporting) and the presence of a debugger |
134 // are registered with the UMA metrics service. | 151 // are registered with the UMA metrics service. |
135 void RecordBreakpadStatusUMA(MetricsService* metrics); | 152 void RecordBreakpadStatusUMA(MetricsService* metrics); |
136 | 153 |
137 // Displays a warning message if some minimum level of OS support is not | 154 // Displays a warning message if some minimum level of OS support is not |
138 // present on the current platform. | 155 // present on the current platform. |
139 void WarnAboutMinimumSystemRequirements(); | 156 void WarnAboutMinimumSystemRequirements(); |
140 | 157 |
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 | 158 // Records the time from our process' startup to the present time in |
145 // the UMA histogram |metric_name|. | 159 // the UMA histogram |metric_name|. |
146 void RecordBrowserStartupTime(); | 160 void RecordBrowserStartupTime(); |
147 | 161 |
148 // Records a time value to an UMA histogram in the context of the | 162 // Records a time value to an UMA histogram in the context of the |
149 // PreReadExperiment field-trial. This also reports to the appropriate | 163 // PreReadExperiment field-trial. This also reports to the appropriate |
150 // sub-histogram (_PreRead(Enabled|Disabled)). | 164 // sub-histogram (_PreRead(Enabled|Disabled)). |
151 void RecordPreReadExperimentTime(const char* name, base::TimeDelta time); | 165 void RecordPreReadExperimentTime(const char* name, base::TimeDelta time); |
152 | 166 |
153 #endif // CHROME_BROWSER_CHROME_BROWSER_MAIN_H_ | 167 #endif // CHROME_BROWSER_CHROME_BROWSER_MAIN_H_ |
OLD | NEW |