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/memory/scoped_vector.h" | |
12 #include "base/metrics/field_trial.h" | 13 #include "base/metrics/field_trial.h" |
13 #include "base/tracked_objects.h" | 14 #include "base/tracked_objects.h" |
14 #include "chrome/browser/first_run/first_run.h" | 15 #include "chrome/browser/first_run/first_run.h" |
15 #include "chrome/browser/process_singleton.h" | 16 #include "chrome/browser/process_singleton.h" |
16 #include "content/public/browser/browser_main_parts.h" | 17 #include "content/public/browser/browser_main_parts.h" |
17 | 18 |
18 class BrowserInit; | 19 class BrowserInit; |
19 class BrowserProcessImpl; | 20 class BrowserProcessImpl; |
20 class FieldTrialSynchronizer; | 21 class FieldTrialSynchronizer; |
21 class HistogramSynchronizer; | 22 class HistogramSynchronizer; |
22 class MetricsService; | 23 class MetricsService; |
23 class PrefService; | 24 class PrefService; |
24 class Profile; | 25 class Profile; |
25 class ShutdownWatcherHelper; | 26 class ShutdownWatcherHelper; |
26 class TranslateManager; | 27 class TranslateManager; |
28 class ChromeBrowserParts; | |
jam
2011/11/14 19:45:55
nit: order
stevenjb
2011/11/14 23:31:10
Done.
| |
27 | 29 |
28 namespace chrome_browser { | 30 namespace chrome_browser { |
29 // For use by ShowMissingLocaleMessageBox. | 31 // For use by ShowMissingLocaleMessageBox. |
30 extern const char kMissingLocaleDataTitle[]; | 32 extern const char kMissingLocaleDataTitle[]; |
31 extern const char kMissingLocaleDataMessage[]; | 33 extern const char kMissingLocaleDataMessage[]; |
32 } | 34 } |
33 | 35 |
34 namespace chrome_browser_metrics { | 36 namespace chrome_browser_metrics { |
35 class TrackingSynchronizer; | 37 class TrackingSynchronizer; |
36 } | 38 } |
37 | 39 |
38 namespace content { | 40 namespace content { |
39 struct MainFunctionParams; | 41 struct MainFunctionParams; |
40 } | 42 } |
41 | 43 |
42 class ChromeBrowserMainParts : public content::BrowserMainParts { | 44 class ChromeBrowserMainParts : public content::BrowserMainParts { |
43 public: | 45 public: |
44 virtual ~ChromeBrowserMainParts(); | 46 virtual ~ChromeBrowserMainParts(); |
45 | 47 |
46 // Constructs metrics service and does related initialization, including | 48 // Add additional ChromeBrowserParts. |
47 // creation of field trials. Call only after labs have been converted to | 49 virtual void AddParts(ChromeBrowserParts* parts); |
48 // switches. | |
49 MetricsService* SetupMetricsAndFieldTrials(PrefService* local_state); | |
50 | |
51 const content::MainFunctionParams& parameters() const { | |
52 return parameters_; | |
53 } | |
54 const CommandLine& parsed_command_line() const { | |
55 return parsed_command_line_; | |
56 } | |
57 | 50 |
58 protected: | 51 protected: |
59 explicit ChromeBrowserMainParts( | 52 explicit ChromeBrowserMainParts( |
60 const content::MainFunctionParams& parameters); | 53 const content::MainFunctionParams& parameters); |
61 | 54 |
62 // content::BrowserParts overrides | 55 // content::BrowserMainParts overrides. |
63 virtual void PreEarlyInitialization() OVERRIDE; | 56 virtual void PreEarlyInitialization() OVERRIDE; |
64 virtual void PostEarlyInitialization() OVERRIDE; | 57 virtual void PostEarlyInitialization() OVERRIDE; |
65 virtual void ToolkitInitialized() OVERRIDE; | 58 virtual void ToolkitInitialized() OVERRIDE; |
66 virtual void PreMainMessageLoopStart() OVERRIDE; | 59 virtual void PreMainMessageLoopStart() OVERRIDE; |
67 virtual void PostMainMessageLoopStart() OVERRIDE; | 60 virtual void PostMainMessageLoopStart() OVERRIDE; |
68 virtual void PreMainMessageLoopRun() OVERRIDE; | 61 virtual void PreMainMessageLoopRun() OVERRIDE; |
69 virtual bool MainMessageLoopRun(int* result_code) OVERRIDE; | 62 virtual bool MainMessageLoopRun(int* result_code) OVERRIDE; |
70 virtual void PostMainMessageLoopRun() OVERRIDE; | 63 virtual void PostMainMessageLoopRun() OVERRIDE; |
71 | 64 |
72 // Displays a warning message that we can't find any locale data files. | 65 // Displays a warning message that we can't find any locale data files. |
73 virtual void ShowMissingLocaleMessageBox() = 0; | 66 virtual void ShowMissingLocaleMessageBox() = 0; |
74 | 67 |
68 const content::MainFunctionParams& parameters() const { | |
69 return parameters_; | |
70 } | |
71 const CommandLine& parsed_command_line() const { | |
72 return parsed_command_line_; | |
73 } | |
74 | |
75 Profile* profile() { return profile_; } | |
76 | |
75 private: | 77 private: |
76 // Methods for |EarlyInitialization()| --------------------------------------- | 78 // Methods for |EarlyInitialization()| --------------------------------------- |
77 | 79 |
78 // A/B test for the maximum number of persistent connections per host. | 80 // A/B test for the maximum number of persistent connections per host. |
79 void ConnectionFieldTrial(); | 81 void ConnectionFieldTrial(); |
80 | 82 |
81 // A/B test for determining a value for unused socket timeout. | 83 // A/B test for determining a value for unused socket timeout. |
82 void SocketTimeoutFieldTrial(); | 84 void SocketTimeoutFieldTrial(); |
83 | 85 |
84 // A/B test for the maximum number of connections per proxy server. | 86 // A/B test for the maximum number of connections per proxy server. |
(...skipping 12 matching lines...) Expand all Loading... | |
97 // Field trial to see what disabling DNS pre-resolution does to | 99 // Field trial to see what disabling DNS pre-resolution does to |
98 // latency of page loads. | 100 // latency of page loads. |
99 void PredictorFieldTrial(); | 101 void PredictorFieldTrial(); |
100 | 102 |
101 // Field trial to see what effect installing defaults in the NTP apps pane | 103 // Field trial to see what effect installing defaults in the NTP apps pane |
102 // has on retention and general apps/webstore usage. | 104 // has on retention and general apps/webstore usage. |
103 void DefaultAppsFieldTrial(); | 105 void DefaultAppsFieldTrial(); |
104 | 106 |
105 // Methods for |SetupMetricsAndFieldTrials()| -------------------------------- | 107 // Methods for |SetupMetricsAndFieldTrials()| -------------------------------- |
106 | 108 |
109 // Constructs metrics service and does related initialization, including | |
110 // creation of field trials. Call only after labs have been converted to | |
111 // switches. | |
112 MetricsService* SetupMetricsAndFieldTrials(PrefService* local_state); | |
113 | |
107 static MetricsService* InitializeMetrics( | 114 static MetricsService* InitializeMetrics( |
108 const CommandLine& parsed_command_line, | 115 const CommandLine& parsed_command_line, |
109 const PrefService* local_state); | 116 const PrefService* local_state); |
110 | 117 |
111 // Add an invocation of your field trial init function to this method. | 118 // Add an invocation of your field trial init function to this method. |
112 void SetupFieldTrials(bool metrics_recording_enabled, | 119 void SetupFieldTrials(bool metrics_recording_enabled, |
113 bool proxy_policy_is_set); | 120 bool proxy_policy_is_set); |
114 | 121 |
115 // Methods for Main Message Loop ------------------------------------------- | 122 // Methods for Main Message Loop ------------------------------------------- |
116 | 123 |
117 int PreMainMessageLoopRunImpl(); | 124 int PreMainMessageLoopRunImpl(); |
118 void StartBrowserOrUITask(); | |
119 | 125 |
120 // Members initialized on construction --------------------------------------- | 126 // Members initialized on construction --------------------------------------- |
121 | 127 |
122 const content::MainFunctionParams& parameters_; | 128 const content::MainFunctionParams& parameters_; |
123 const CommandLine& parsed_command_line_; | 129 const CommandLine& parsed_command_line_; |
124 int result_code_; | 130 int result_code_; |
125 | 131 |
126 // Create ShutdownWatcherHelper object for watching jank during shutdown. | 132 // Create ShutdownWatcherHelper object for watching jank during shutdown. |
127 // Please keep |shutdown_watcher| as the first object constructed, and hence | 133 // Please keep |shutdown_watcher| as the first object constructed, and hence |
128 // it is destroyed last. | 134 // it is destroyed last. |
129 scoped_ptr<ShutdownWatcherHelper> shutdown_watcher_; | 135 scoped_ptr<ShutdownWatcherHelper> shutdown_watcher_; |
130 | 136 |
131 // Creating this object starts tracking the creation and deletion of Task | 137 // Creating this object starts tracking the creation and deletion of Task |
132 // 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 |
133 // destroyed after the main_message_loop. | 139 // destroyed after the main_message_loop. |
134 tracked_objects::AutoTracking tracking_objects_; | 140 tracked_objects::AutoTracking tracking_objects_; |
135 | 141 |
136 // Statistical testing infrastructure for the entire browser. NULL until | 142 // Statistical testing infrastructure for the entire browser. NULL until |
137 // SetupMetricsAndFieldTrials is called. | 143 // SetupMetricsAndFieldTrials is called. |
138 scoped_ptr<base::FieldTrialList> field_trial_list_; | 144 scoped_ptr<base::FieldTrialList> field_trial_list_; |
139 | 145 |
146 // Vector of additional ChromeBrowserParts. | |
147 ScopedVector<ChromeBrowserParts> chrome_parts_; | |
148 | |
140 // Members initialized after / released before main_message_loop_ ------------ | 149 // Members initialized after / released before main_message_loop_ ------------ |
141 | 150 |
142 scoped_ptr<BrowserInit> browser_init_; | 151 scoped_ptr<BrowserInit> browser_init_; |
143 scoped_ptr<BrowserProcessImpl> browser_process_; | 152 scoped_ptr<BrowserProcessImpl> browser_process_; |
144 scoped_refptr<HistogramSynchronizer> histogram_synchronizer_; | 153 scoped_refptr<HistogramSynchronizer> histogram_synchronizer_; |
145 scoped_refptr<chrome_browser_metrics::TrackingSynchronizer> | 154 scoped_refptr<chrome_browser_metrics::TrackingSynchronizer> |
146 tracking_synchronizer_; | 155 tracking_synchronizer_; |
147 scoped_ptr<ProcessSingleton> process_singleton_; | 156 scoped_ptr<ProcessSingleton> process_singleton_; |
148 scoped_ptr<FirstRun::MasterPrefs> master_prefs_; | 157 scoped_ptr<FirstRun::MasterPrefs> master_prefs_; |
149 bool record_search_engine_; | 158 bool record_search_engine_; |
(...skipping 24 matching lines...) Expand all Loading... | |
174 // Records the time from our process' startup to the present time in | 183 // Records the time from our process' startup to the present time in |
175 // the UMA histogram |metric_name|. | 184 // the UMA histogram |metric_name|. |
176 void RecordBrowserStartupTime(); | 185 void RecordBrowserStartupTime(); |
177 | 186 |
178 // Records a time value to an UMA histogram in the context of the | 187 // Records a time value to an UMA histogram in the context of the |
179 // PreReadExperiment field-trial. This also reports to the appropriate | 188 // PreReadExperiment field-trial. This also reports to the appropriate |
180 // sub-histogram (_PreRead(Enabled|Disabled)). | 189 // sub-histogram (_PreRead(Enabled|Disabled)). |
181 void RecordPreReadExperimentTime(const char* name, base::TimeDelta time); | 190 void RecordPreReadExperimentTime(const char* name, base::TimeDelta time); |
182 | 191 |
183 #endif // CHROME_BROWSER_CHROME_BROWSER_MAIN_H_ | 192 #endif // CHROME_BROWSER_CHROME_BROWSER_MAIN_H_ |
OLD | NEW |