| 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 #include "components/startup_metric_utils/browser/startup_metric_utils.h" | 134 #include "components/startup_metric_utils/browser/startup_metric_utils.h" |
| 135 #include "components/tracing/common/tracing_switches.h" | 135 #include "components/tracing/common/tracing_switches.h" |
| 136 #include "components/translate/core/browser/translate_download_manager.h" | 136 #include "components/translate/core/browser/translate_download_manager.h" |
| 137 #include "components/variations/pref_names.h" | 137 #include "components/variations/pref_names.h" |
| 138 #include "components/variations/service/variations_service.h" | 138 #include "components/variations/service/variations_service.h" |
| 139 #include "components/variations/variations_associated_data.h" | 139 #include "components/variations/variations_associated_data.h" |
| 140 #include "components/variations/variations_http_header_provider.h" | 140 #include "components/variations/variations_http_header_provider.h" |
| 141 #include "components/variations/variations_switches.h" | 141 #include "components/variations/variations_switches.h" |
| 142 #include "components/version_info/version_info.h" | 142 #include "components/version_info/version_info.h" |
| 143 #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" | |
| 146 #include "content/public/browser/notification_observer.h" | 144 #include "content/public/browser/notification_observer.h" |
| 147 #include "content/public/browser/notification_registrar.h" | 145 #include "content/public/browser/notification_registrar.h" |
| 148 #include "content/public/browser/notification_service.h" | 146 #include "content/public/browser/notification_service.h" |
| 149 #include "content/public/browser/notification_types.h" | 147 #include "content/public/browser/notification_types.h" |
| 150 #include "content/public/browser/power_usage_monitor.h" | 148 #include "content/public/browser/power_usage_monitor.h" |
| 151 #include "content/public/browser/site_instance.h" | 149 #include "content/public/browser/site_instance.h" |
| 152 #include "content/public/common/content_client.h" | 150 #include "content/public/common/content_client.h" |
| 153 #include "content/public/common/content_features.h" | 151 #include "content/public/common/content_features.h" |
| 154 #include "content/public/common/content_switches.h" | 152 #include "content/public/common/content_switches.h" |
| 155 #include "content/public/common/main_function_params.h" | 153 #include "content/public/common/main_function_params.h" |
| 154 #include "device/geolocation/geolocation_delegate.h" |
| 155 #include "device/geolocation/geolocation_provider.h" |
| 156 #include "grit/platform_locale_settings.h" | 156 #include "grit/platform_locale_settings.h" |
| 157 #include "media/base/media_resources.h" | 157 #include "media/base/media_resources.h" |
| 158 #include "net/base/net_module.h" | 158 #include "net/base/net_module.h" |
| 159 #include "net/cookies/cookie_monster.h" | 159 #include "net/cookies/cookie_monster.h" |
| 160 #include "net/http/http_network_layer.h" | 160 #include "net/http/http_network_layer.h" |
| 161 #include "net/http/http_stream_factory.h" | 161 #include "net/http/http_stream_factory.h" |
| 162 #include "net/url_request/url_request.h" | 162 #include "net/url_request/url_request.h" |
| 163 #include "ui/base/l10n/l10n_util.h" | 163 #include "ui/base/l10n/l10n_util.h" |
| 164 #include "ui/base/layout.h" | 164 #include "ui/base/layout.h" |
| 165 #include "ui/base/material_design/material_design_controller.h" | 165 #include "ui/base/material_design/material_design_controller.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 #include "chrome/browser/lifetime/application_lifetime.h" | 267 #include "chrome/browser/lifetime/application_lifetime.h" |
| 268 #include "content/public/common/mojo_shell_connection.h" | 268 #include "content/public/common/mojo_shell_connection.h" |
| 269 #include "services/shell/runner/common/client_util.h" | 269 #include "services/shell/runner/common/client_util.h" |
| 270 #endif | 270 #endif |
| 271 | 271 |
| 272 using content::BrowserThread; | 272 using content::BrowserThread; |
| 273 | 273 |
| 274 namespace { | 274 namespace { |
| 275 | 275 |
| 276 // A provider of Geolocation services to override AccessTokenStore. | 276 // A provider of Geolocation services to override AccessTokenStore. |
| 277 class ChromeGeolocationDelegate : public content::GeolocationDelegate { | 277 class ChromeGeolocationDelegate : public device::GeolocationDelegate { |
| 278 public: | 278 public: |
| 279 ChromeGeolocationDelegate() = default; | 279 ChromeGeolocationDelegate() = default; |
| 280 | 280 |
| 281 scoped_refptr<content::AccessTokenStore> CreateAccessTokenStore() final { | 281 scoped_refptr<device::AccessTokenStore> CreateAccessTokenStore() final { |
| 282 return new ChromeAccessTokenStore(); | 282 return new ChromeAccessTokenStore(); |
| 283 } | 283 } |
| 284 | 284 |
| 285 private: | 285 private: |
| 286 DISALLOW_COPY_AND_ASSIGN(ChromeGeolocationDelegate); | 286 DISALLOW_COPY_AND_ASSIGN(ChromeGeolocationDelegate); |
| 287 }; | 287 }; |
| 288 | 288 |
| 289 // This function provides some ways to test crash and assertion handling | 289 // This function provides some ways to test crash and assertion handling |
| 290 // behavior of the program. | 290 // behavior of the program. |
| 291 void HandleTestParameters(const base::CommandLine& command_line) { | 291 void HandleTestParameters(const base::CommandLine& command_line) { |
| (...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1210 SetupOriginTrialsCommandLine(); | 1210 SetupOriginTrialsCommandLine(); |
| 1211 | 1211 |
| 1212 // 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 |
| 1213 // metrics and initialize field trials. The field trials are needed by | 1213 // metrics and initialize field trials. The field trials are needed by |
| 1214 // IOThread's initialization which happens in BrowserProcess:PreCreateThreads. | 1214 // IOThread's initialization which happens in BrowserProcess:PreCreateThreads. |
| 1215 SetupMetricsAndFieldTrials(); | 1215 SetupMetricsAndFieldTrials(); |
| 1216 | 1216 |
| 1217 // ChromeOS needs ResourceBundle::InitSharedInstance to be called before this. | 1217 // ChromeOS needs ResourceBundle::InitSharedInstance to be called before this. |
| 1218 browser_process_->PreCreateThreads(); | 1218 browser_process_->PreCreateThreads(); |
| 1219 | 1219 |
| 1220 content::GeolocationProvider::SetGeolocationDelegate( | 1220 device::GeolocationProvider::SetGeolocationDelegate( |
| 1221 new ChromeGeolocationDelegate()); | 1221 new ChromeGeolocationDelegate()); |
| 1222 | 1222 |
| 1223 return content::RESULT_CODE_NORMAL_EXIT; | 1223 return content::RESULT_CODE_NORMAL_EXIT; |
| 1224 } | 1224 } |
| 1225 | 1225 |
| 1226 void ChromeBrowserMainParts::PreMainMessageLoopRun() { | 1226 void ChromeBrowserMainParts::PreMainMessageLoopRun() { |
| 1227 #if defined(MOJO_SHELL_CLIENT) | 1227 #if defined(MOJO_SHELL_CLIENT) |
| 1228 if (content::MojoShellConnection::GetForProcess() && shell::ShellIsRemote()) { | 1228 if (content::MojoShellConnection::GetForProcess() && shell::ShellIsRemote()) { |
| 1229 content::MojoShellConnection::GetForProcess()->SetConnectionLostClosure( | 1229 content::MojoShellConnection::GetForProcess()->SetConnectionLostClosure( |
| 1230 base::Bind(&chrome::SessionEnding)); | 1230 base::Bind(&chrome::SessionEnding)); |
| (...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2055 chromeos::CrosSettings::Shutdown(); | 2055 chromeos::CrosSettings::Shutdown(); |
| 2056 #endif // defined(OS_CHROMEOS) | 2056 #endif // defined(OS_CHROMEOS) |
| 2057 #endif // defined(OS_ANDROID) | 2057 #endif // defined(OS_ANDROID) |
| 2058 } | 2058 } |
| 2059 | 2059 |
| 2060 // Public members: | 2060 // Public members: |
| 2061 | 2061 |
| 2062 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { | 2062 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { |
| 2063 chrome_extra_parts_.push_back(parts); | 2063 chrome_extra_parts_.push_back(parts); |
| 2064 } | 2064 } |
| OLD | NEW |