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 |
| 53 // content::BrowserParts overrides |
| 54 virtual void PreEarlyInitialization() OVERRIDE {} |
| 55 virtual void PostEarlyInitialization() OVERRIDE {} |
| 56 virtual void PreMainMessageLoopStart() OVERRIDE {} |
| 57 virtual void ToolkitInitialized() OVERRIDE; |
| 58 virtual void PostMainMessageLoopStart() OVERRIDE {} |
46 virtual void PreMainMessageLoopRun() OVERRIDE; | 59 virtual void PreMainMessageLoopRun() OVERRIDE; |
47 int PreMainMessageLoopRunInternal(); | 60 virtual bool MainMessageLoopRun(int* result_code) OVERRIDE; |
48 virtual void MainMessageLoopRun() OVERRIDE; | 61 virtual void PostMainMessageLoopRun(); |
49 virtual void PostMainMessageLoopRun() OVERRIDE; | 62 |
50 virtual void ToolkitInitialized() OVERRIDE; | 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 21 matching lines...) Expand all Loading... |
82 // Methods for |SetupMetricsAndFieldTrials()| -------------------------------- | 96 // Methods for |SetupMetricsAndFieldTrials()| -------------------------------- |
83 | 97 |
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 |
| 106 // Methods for Main Message Loop ------------------------------------------- |
| 107 |
| 108 int PreMainMessageLoopRunImpl(); |
| 109 |
92 // Members initialized on construction --------------------------------------- | 110 // Members initialized on construction --------------------------------------- |
93 | 111 |
| 112 const MainFunctionParams& parameters_; |
| 113 const CommandLine& parsed_command_line_; |
| 114 int result_code_; |
| 115 |
94 // Create ShutdownWatcherHelper object for watching jank during shutdown. | 116 // Create ShutdownWatcherHelper object for watching jank during shutdown. |
95 // Please keep |shutdown_watcher| as the first object constructed, and hence | 117 // Please keep |shutdown_watcher| as the first object constructed, and hence |
96 // it is destroyed last. | 118 // it is destroyed last. |
97 scoped_ptr<ShutdownWatcherHelper> shutdown_watcher_; | 119 scoped_ptr<ShutdownWatcherHelper> shutdown_watcher_; |
98 | 120 |
99 #if defined(TRACK_ALL_TASK_OBJECTS) | 121 #if defined(TRACK_ALL_TASK_OBJECTS) |
100 // Creating this object starts tracking the creation and deletion of Task | 122 // 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 | 123 // instance. This MUST be done before main_message_loop, so that it is |
102 // destroyed after the main_message_loop. | 124 // destroyed after the main_message_loop. |
103 tracked_objects::AutoTracking tracking_objects_; | 125 tracked_objects::AutoTracking tracking_objects_; |
(...skipping 27 matching lines...) Expand all Loading... |
131 // Records the conditions that can prevent Breakpad from generating and | 153 // Records the conditions that can prevent Breakpad from generating and |
132 // sending crash reports. The presence of a Breakpad handler (after | 154 // sending crash reports. The presence of a Breakpad handler (after |
133 // attempting to initialize crash reporting) and the presence of a debugger | 155 // attempting to initialize crash reporting) and the presence of a debugger |
134 // are registered with the UMA metrics service. | 156 // are registered with the UMA metrics service. |
135 void RecordBreakpadStatusUMA(MetricsService* metrics); | 157 void RecordBreakpadStatusUMA(MetricsService* metrics); |
136 | 158 |
137 // Displays a warning message if some minimum level of OS support is not | 159 // Displays a warning message if some minimum level of OS support is not |
138 // present on the current platform. | 160 // present on the current platform. |
139 void WarnAboutMinimumSystemRequirements(); | 161 void WarnAboutMinimumSystemRequirements(); |
140 | 162 |
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 | 163 // Records the time from our process' startup to the present time in |
145 // the UMA histogram |metric_name|. | 164 // the UMA histogram |metric_name|. |
146 void RecordBrowserStartupTime(); | 165 void RecordBrowserStartupTime(); |
147 | 166 |
148 // Records a time value to an UMA histogram in the context of the | 167 // Records a time value to an UMA histogram in the context of the |
149 // PreReadExperiment field-trial. This also reports to the appropriate | 168 // PreReadExperiment field-trial. This also reports to the appropriate |
150 // sub-histogram (_PreRead(Enabled|Disabled)). | 169 // sub-histogram (_PreRead(Enabled|Disabled)). |
151 void RecordPreReadExperimentTime(const char* name, base::TimeDelta time); | 170 void RecordPreReadExperimentTime(const char* name, base::TimeDelta time); |
152 | 171 |
153 #endif // CHROME_BROWSER_CHROME_BROWSER_MAIN_H_ | 172 #endif // CHROME_BROWSER_CHROME_BROWSER_MAIN_H_ |
OLD | NEW |