OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ios/chrome/browser/application_context_impl.h" | 5 #include "ios/chrome/browser/application_context_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 10 matching lines...) Expand all Loading... | |
21 #include "components/gcm_driver/gcm_client_factory.h" | 21 #include "components/gcm_driver/gcm_client_factory.h" |
22 #include "components/gcm_driver/gcm_desktop_utils.h" | 22 #include "components/gcm_driver/gcm_desktop_utils.h" |
23 #include "components/gcm_driver/gcm_driver.h" | 23 #include "components/gcm_driver/gcm_driver.h" |
24 #include "components/history/core/browser/history_service.h" | 24 #include "components/history/core/browser/history_service.h" |
25 #include "components/keyed_service/core/service_access_type.h" | 25 #include "components/keyed_service/core/service_access_type.h" |
26 #include "components/metrics/metrics_pref_names.h" | 26 #include "components/metrics/metrics_pref_names.h" |
27 #include "components/metrics/metrics_service.h" | 27 #include "components/metrics/metrics_service.h" |
28 #include "components/metrics_services_manager/metrics_services_manager.h" | 28 #include "components/metrics_services_manager/metrics_services_manager.h" |
29 #include "components/net_log/chrome_net_log.h" | 29 #include "components/net_log/chrome_net_log.h" |
30 #include "components/network_time/network_time_tracker.h" | 30 #include "components/network_time/network_time_tracker.h" |
31 #include "components/physical_web/data_source/physical_web_data_source.h" | |
31 #include "components/prefs/pref_registry_simple.h" | 32 #include "components/prefs/pref_registry_simple.h" |
32 #include "components/prefs/pref_service.h" | 33 #include "components/prefs/pref_service.h" |
33 #include "components/translate/core/browser/translate_download_manager.h" | 34 #include "components/translate/core/browser/translate_download_manager.h" |
34 #include "components/update_client/configurator.h" | 35 #include "components/update_client/configurator.h" |
35 #include "components/update_client/update_query_params.h" | 36 #include "components/update_client/update_query_params.h" |
36 #include "components/variations/service/variations_service.h" | 37 #include "components/variations/service/variations_service.h" |
37 #include "components/web_resource/web_resource_pref_names.h" | 38 #include "components/web_resource/web_resource_pref_names.h" |
38 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | 39 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
39 #include "ios/chrome/browser/browser_state/chrome_browser_state_manager_impl.h" | 40 #include "ios/chrome/browser/browser_state/chrome_browser_state_manager_impl.h" |
40 #include "ios/chrome/browser/chrome_paths.h" | 41 #include "ios/chrome/browser/chrome_paths.h" |
41 #include "ios/chrome/browser/component_updater/ios_component_updater_configurato r.h" | 42 #include "ios/chrome/browser/component_updater/ios_component_updater_configurato r.h" |
42 #include "ios/chrome/browser/history/history_service_factory.h" | 43 #include "ios/chrome/browser/history/history_service_factory.h" |
43 #include "ios/chrome/browser/ios_chrome_io_thread.h" | 44 #include "ios/chrome/browser/ios_chrome_io_thread.h" |
44 #include "ios/chrome/browser/metrics/ios_chrome_metrics_services_manager_client. h" | 45 #include "ios/chrome/browser/metrics/ios_chrome_metrics_services_manager_client. h" |
45 #include "ios/chrome/browser/net/crl_set_fetcher.h" | 46 #include "ios/chrome/browser/net/crl_set_fetcher.h" |
47 #include "ios/chrome/browser/physical_web/create_physical_web_data_source.h" | |
46 #include "ios/chrome/browser/pref_names.h" | 48 #include "ios/chrome/browser/pref_names.h" |
47 #include "ios/chrome/browser/prefs/browser_prefs.h" | 49 #include "ios/chrome/browser/prefs/browser_prefs.h" |
48 #include "ios/chrome/browser/prefs/ios_chrome_pref_service_factory.h" | 50 #include "ios/chrome/browser/prefs/ios_chrome_pref_service_factory.h" |
49 #include "ios/chrome/browser/update_client/ios_chrome_update_query_params_delega te.h" | 51 #include "ios/chrome/browser/update_client/ios_chrome_update_query_params_delega te.h" |
50 #include "ios/chrome/browser/web_resource/web_resource_util.h" | 52 #include "ios/chrome/browser/web_resource/web_resource_util.h" |
51 #include "ios/chrome/common/channel_info.h" | 53 #include "ios/chrome/common/channel_info.h" |
52 #include "ios/web/public/web_thread.h" | 54 #include "ios/web/public/web_thread.h" |
53 #include "net/log/net_log_capture_mode.h" | 55 #include "net/log/net_log_capture_mode.h" |
54 #include "net/socket/client_socket_pool_manager.h" | 56 #include "net/socket/client_socket_pool_manager.h" |
55 #include "net/url_request/url_request_context_getter.h" | 57 #include "net/url_request/url_request_context_getter.h" |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
290 } | 292 } |
291 | 293 |
292 CRLSetFetcher* ApplicationContextImpl::GetCRLSetFetcher() { | 294 CRLSetFetcher* ApplicationContextImpl::GetCRLSetFetcher() { |
293 DCHECK(thread_checker_.CalledOnValidThread()); | 295 DCHECK(thread_checker_.CalledOnValidThread()); |
294 if (!crl_set_fetcher_) { | 296 if (!crl_set_fetcher_) { |
295 crl_set_fetcher_ = new CRLSetFetcher; | 297 crl_set_fetcher_ = new CRLSetFetcher; |
296 } | 298 } |
297 return crl_set_fetcher_.get(); | 299 return crl_set_fetcher_.get(); |
298 } | 300 } |
299 | 301 |
302 PhysicalWebDataSource* ApplicationContextImpl::GetPhysicalWebDataSource() { | |
303 DCHECK(thread_checker_.CalledOnValidThread()); | |
304 if (!physical_web_data_source_) { | |
305 physical_web_data_source_ = CreateIOSChromePhysicalWebDataSource(); | |
306 } | |
307 DCHECK(physical_web_data_source_); | |
sdefresne
2016/08/04 19:23:47
Move this DCHECK into the if block.
mattreynolds
2016/08/04 21:14:34
Done.
| |
308 return physical_web_data_source_.get(); | |
309 } | |
310 | |
300 void ApplicationContextImpl::SetApplicationLocale(const std::string& locale) { | 311 void ApplicationContextImpl::SetApplicationLocale(const std::string& locale) { |
301 DCHECK(thread_checker_.CalledOnValidThread()); | 312 DCHECK(thread_checker_.CalledOnValidThread()); |
302 application_locale_ = locale; | 313 application_locale_ = locale; |
303 translate::TranslateDownloadManager::GetInstance()->set_application_locale( | 314 translate::TranslateDownloadManager::GetInstance()->set_application_locale( |
304 application_locale_); | 315 application_locale_); |
305 } | 316 } |
306 | 317 |
307 void ApplicationContextImpl::CreateLocalState() { | 318 void ApplicationContextImpl::CreateLocalState() { |
308 DCHECK(thread_checker_.CalledOnValidThread()); | 319 DCHECK(thread_checker_.CalledOnValidThread()); |
309 DCHECK(!created_local_state_ && !local_state_); | 320 DCHECK(!created_local_state_ && !local_state_); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
344 worker_pool->GetSequenceToken(), | 355 worker_pool->GetSequenceToken(), |
345 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); | 356 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); |
346 | 357 |
347 gcm_driver_ = gcm::CreateGCMDriverDesktop( | 358 gcm_driver_ = gcm::CreateGCMDriverDesktop( |
348 base::WrapUnique(new gcm::GCMClientFactory), GetLocalState(), store_path, | 359 base::WrapUnique(new gcm::GCMClientFactory), GetLocalState(), store_path, |
349 GetSystemURLRequestContext(), ::GetChannel(), | 360 GetSystemURLRequestContext(), ::GetChannel(), |
350 web::WebThread::GetTaskRunnerForThread(web::WebThread::UI), | 361 web::WebThread::GetTaskRunnerForThread(web::WebThread::UI), |
351 web::WebThread::GetTaskRunnerForThread(web::WebThread::IO), | 362 web::WebThread::GetTaskRunnerForThread(web::WebThread::IO), |
352 blocking_task_runner); | 363 blocking_task_runner); |
353 } | 364 } |
OLD | NEW |