OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/chrome_browser_main.h" | 5 #include "chrome/browser/chrome_browser_main.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <set> | 10 #include <set> |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 #include "chrome/browser/component_updater/origin_trials_component_installer.h" | 52 #include "chrome/browser/component_updater/origin_trials_component_installer.h" |
53 #include "chrome/browser/component_updater/pepper_flash_component_installer.h" | 53 #include "chrome/browser/component_updater/pepper_flash_component_installer.h" |
54 #include "chrome/browser/component_updater/recovery_component_installer.h" | 54 #include "chrome/browser/component_updater/recovery_component_installer.h" |
55 #include "chrome/browser/component_updater/sth_set_component_installer.h" | 55 #include "chrome/browser/component_updater/sth_set_component_installer.h" |
56 #include "chrome/browser/component_updater/subresource_filter_component_installe
r.h" | 56 #include "chrome/browser/component_updater/subresource_filter_component_installe
r.h" |
57 #include "chrome/browser/component_updater/supervised_user_whitelist_installer.h
" | 57 #include "chrome/browser/component_updater/supervised_user_whitelist_installer.h
" |
58 #include "chrome/browser/component_updater/swiftshader_component_installer.h" | 58 #include "chrome/browser/component_updater/swiftshader_component_installer.h" |
59 #include "chrome/browser/component_updater/widevine_cdm_component_installer.h" | 59 #include "chrome/browser/component_updater/widevine_cdm_component_installer.h" |
60 #include "chrome/browser/defaults.h" | 60 #include "chrome/browser/defaults.h" |
61 #include "chrome/browser/first_run/first_run.h" | 61 #include "chrome/browser/first_run/first_run.h" |
| 62 #include "chrome/browser/geolocation/chrome_access_token_store.h" |
62 #include "chrome/browser/gpu/gl_string_manager.h" | 63 #include "chrome/browser/gpu/gl_string_manager.h" |
63 #include "chrome/browser/gpu/three_d_api_observer.h" | 64 #include "chrome/browser/gpu/three_d_api_observer.h" |
64 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | 65 #include "chrome/browser/media/media_capture_devices_dispatcher.h" |
65 #include "chrome/browser/memory/tab_manager.h" | 66 #include "chrome/browser/memory/tab_manager.h" |
66 #include "chrome/browser/metrics/field_trial_synchronizer.h" | 67 #include "chrome/browser/metrics/field_trial_synchronizer.h" |
67 #include "chrome/browser/metrics/thread_watcher.h" | 68 #include "chrome/browser/metrics/thread_watcher.h" |
68 #include "chrome/browser/nacl_host/nacl_browser_delegate_impl.h" | 69 #include "chrome/browser/nacl_host/nacl_browser_delegate_impl.h" |
69 #include "chrome/browser/net/crl_set_fetcher.h" | 70 #include "chrome/browser/net/crl_set_fetcher.h" |
70 #include "chrome/browser/performance_monitor/performance_monitor.h" | 71 #include "chrome/browser/performance_monitor/performance_monitor.h" |
71 #include "chrome/browser/plugins/plugin_prefs.h" | 72 #include "chrome/browser/plugins/plugin_prefs.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 #include "components/startup_metric_utils/browser/startup_metric_utils.h" | 134 #include "components/startup_metric_utils/browser/startup_metric_utils.h" |
134 #include "components/tracing/common/tracing_switches.h" | 135 #include "components/tracing/common/tracing_switches.h" |
135 #include "components/translate/core/browser/translate_download_manager.h" | 136 #include "components/translate/core/browser/translate_download_manager.h" |
136 #include "components/variations/pref_names.h" | 137 #include "components/variations/pref_names.h" |
137 #include "components/variations/service/variations_service.h" | 138 #include "components/variations/service/variations_service.h" |
138 #include "components/variations/variations_associated_data.h" | 139 #include "components/variations/variations_associated_data.h" |
139 #include "components/variations/variations_http_header_provider.h" | 140 #include "components/variations/variations_http_header_provider.h" |
140 #include "components/variations/variations_switches.h" | 141 #include "components/variations/variations_switches.h" |
141 #include "components/version_info/version_info.h" | 142 #include "components/version_info/version_info.h" |
142 #include "content/public/browser/browser_thread.h" | 143 #include "content/public/browser/browser_thread.h" |
| 144 #include "content/public/browser/geolocation_delegate.h" |
| 145 #include "content/public/browser/geolocation_provider.h" |
143 #include "content/public/browser/notification_observer.h" | 146 #include "content/public/browser/notification_observer.h" |
144 #include "content/public/browser/notification_registrar.h" | 147 #include "content/public/browser/notification_registrar.h" |
145 #include "content/public/browser/notification_service.h" | 148 #include "content/public/browser/notification_service.h" |
146 #include "content/public/browser/notification_types.h" | 149 #include "content/public/browser/notification_types.h" |
147 #include "content/public/browser/power_usage_monitor.h" | 150 #include "content/public/browser/power_usage_monitor.h" |
148 #include "content/public/browser/site_instance.h" | 151 #include "content/public/browser/site_instance.h" |
149 #include "content/public/common/content_client.h" | 152 #include "content/public/common/content_client.h" |
150 #include "content/public/common/content_features.h" | 153 #include "content/public/common/content_features.h" |
151 #include "content/public/common/content_switches.h" | 154 #include "content/public/common/content_switches.h" |
152 #include "content/public/common/main_function_params.h" | 155 #include "content/public/common/main_function_params.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 #if defined(MOJO_SHELL_CLIENT) | 266 #if defined(MOJO_SHELL_CLIENT) |
264 #include "chrome/browser/lifetime/application_lifetime.h" | 267 #include "chrome/browser/lifetime/application_lifetime.h" |
265 #include "content/public/common/mojo_shell_connection.h" | 268 #include "content/public/common/mojo_shell_connection.h" |
266 #include "services/shell/runner/common/client_util.h" | 269 #include "services/shell/runner/common/client_util.h" |
267 #endif | 270 #endif |
268 | 271 |
269 using content::BrowserThread; | 272 using content::BrowserThread; |
270 | 273 |
271 namespace { | 274 namespace { |
272 | 275 |
| 276 // A provider of Geolocation services to override AccessTokenStore. |
| 277 class ChromeGeolocationDelegate : public content::GeolocationDelegate { |
| 278 public: |
| 279 ChromeGeolocationDelegate() = default; |
| 280 |
| 281 scoped_refptr<content::AccessTokenStore> CreateAccessTokenStore() final { |
| 282 return new ChromeAccessTokenStore(); |
| 283 } |
| 284 |
| 285 private: |
| 286 DISALLOW_COPY_AND_ASSIGN(ChromeGeolocationDelegate); |
| 287 }; |
| 288 |
273 // This function provides some ways to test crash and assertion handling | 289 // This function provides some ways to test crash and assertion handling |
274 // behavior of the program. | 290 // behavior of the program. |
275 void HandleTestParameters(const base::CommandLine& command_line) { | 291 void HandleTestParameters(const base::CommandLine& command_line) { |
276 // This parameter causes a null pointer crash (crash reporter trigger). | 292 // This parameter causes a null pointer crash (crash reporter trigger). |
277 if (command_line.HasSwitch(switches::kBrowserCrashTest)) { | 293 if (command_line.HasSwitch(switches::kBrowserCrashTest)) { |
278 int* bad_pointer = NULL; | 294 int* bad_pointer = NULL; |
279 *bad_pointer = 0; | 295 *bad_pointer = 0; |
280 } | 296 } |
281 } | 297 } |
282 | 298 |
(...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1194 SetupOriginTrialsCommandLine(); | 1210 SetupOriginTrialsCommandLine(); |
1195 | 1211 |
1196 // Now the command line has been mutated based on about:flags, we can setup | 1212 // Now the command line has been mutated based on about:flags, we can setup |
1197 // metrics and initialize field trials. The field trials are needed by | 1213 // metrics and initialize field trials. The field trials are needed by |
1198 // IOThread's initialization which happens in BrowserProcess:PreCreateThreads. | 1214 // IOThread's initialization which happens in BrowserProcess:PreCreateThreads. |
1199 SetupMetricsAndFieldTrials(); | 1215 SetupMetricsAndFieldTrials(); |
1200 | 1216 |
1201 // ChromeOS needs ResourceBundle::InitSharedInstance to be called before this. | 1217 // ChromeOS needs ResourceBundle::InitSharedInstance to be called before this. |
1202 browser_process_->PreCreateThreads(); | 1218 browser_process_->PreCreateThreads(); |
1203 | 1219 |
| 1220 content::GeolocationProvider::SetGeolocationDelegate( |
| 1221 new ChromeGeolocationDelegate()); |
| 1222 |
1204 return content::RESULT_CODE_NORMAL_EXIT; | 1223 return content::RESULT_CODE_NORMAL_EXIT; |
1205 } | 1224 } |
1206 | 1225 |
1207 void ChromeBrowserMainParts::PreMainMessageLoopRun() { | 1226 void ChromeBrowserMainParts::PreMainMessageLoopRun() { |
1208 #if defined(MOJO_SHELL_CLIENT) | 1227 #if defined(MOJO_SHELL_CLIENT) |
1209 if (content::MojoShellConnection::GetForProcess() && shell::ShellIsRemote()) { | 1228 if (content::MojoShellConnection::GetForProcess() && shell::ShellIsRemote()) { |
1210 content::MojoShellConnection::GetForProcess()->SetConnectionLostClosure( | 1229 content::MojoShellConnection::GetForProcess()->SetConnectionLostClosure( |
1211 base::Bind(&chrome::SessionEnding)); | 1230 base::Bind(&chrome::SessionEnding)); |
1212 } | 1231 } |
1213 #endif | 1232 #endif |
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2036 chromeos::CrosSettings::Shutdown(); | 2055 chromeos::CrosSettings::Shutdown(); |
2037 #endif // defined(OS_CHROMEOS) | 2056 #endif // defined(OS_CHROMEOS) |
2038 #endif // defined(OS_ANDROID) | 2057 #endif // defined(OS_ANDROID) |
2039 } | 2058 } |
2040 | 2059 |
2041 // Public members: | 2060 // Public members: |
2042 | 2061 |
2043 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { | 2062 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { |
2044 chrome_extra_parts_.push_back(parts); | 2063 chrome_extra_parts_.push_back(parts); |
2045 } | 2064 } |
OLD | NEW |