diff options
author | sdefresne <sdefresne@chromium.org> | 2015-11-26 07:20:59 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-11-26 15:22:11 +0000 |
commit | 7c2671f0eaf3f55b3c36858f651d414689d63365 (patch) | |
tree | b3336ee2fe90f3db1117649fa7212db502cf4f5d /ios | |
parent | 8ba8facd8fa7124768bbfa52d8a7425fa12a8f21 (diff) | |
download | chromium_src-7c2671f0eaf3f55b3c36858f651d414689d63365.zip chromium_src-7c2671f0eaf3f55b3c36858f651d414689d63365.tar.gz chromium_src-7c2671f0eaf3f55b3c36858f651d414689d63365.tar.bz2 |
Move ownership of ComponentUpdateService to ApplicationContextImpl.
BUG=540702
Review URL: https://codereview.chromium.org/1473903002
Cr-Commit-Position: refs/heads/master@{#361895}
Diffstat (limited to 'ios')
-rw-r--r-- | ios/chrome/browser/application_context.h | 8 | ||||
-rw-r--r-- | ios/chrome/browser/application_context_impl.cc | 24 | ||||
-rw-r--r-- | ios/chrome/browser/application_context_impl.h | 3 | ||||
-rw-r--r-- | ios/chrome/test/testing_application_context.cc | 6 | ||||
-rw-r--r-- | ios/chrome/test/testing_application_context.h | 2 |
5 files changed, 43 insertions, 0 deletions
diff --git a/ios/chrome/browser/application_context.h b/ios/chrome/browser/application_context.h index b2c1c73..8e5fd05 100644 --- a/ios/chrome/browser/application_context.h +++ b/ios/chrome/browser/application_context.h @@ -9,6 +9,10 @@ #include "base/macros.h" +namespace component_updater { +class ComponentUpdateService; +} + namespace gcm { class GCMDriver; } @@ -115,6 +119,10 @@ class ApplicationContext { // Gets the PromoResourceService. virtual web_resource::PromoResourceService* GetPromoResourceService() = 0; + // Gets the ComponentUpdateService. + virtual component_updater::ComponentUpdateService* + GetComponentUpdateService() = 0; + protected: // Sets the global ApplicationContext instance. static void SetApplicationContext(ApplicationContext* context); diff --git a/ios/chrome/browser/application_context_impl.cc b/ios/chrome/browser/application_context_impl.cc index 6087d5f..143aea1 100644 --- a/ios/chrome/browser/application_context_impl.cc +++ b/ios/chrome/browser/application_context_impl.cc @@ -15,6 +15,8 @@ #include "base/prefs/pref_registry_simple.h" #include "base/prefs/pref_service.h" #include "base/time/default_tick_clock.h" +#include "components/component_updater/component_updater_service.h" +#include "components/component_updater/component_updater_service.h" #include "components/gcm_driver/gcm_client_factory.h" #include "components/gcm_driver/gcm_desktop_utils.h" #include "components/gcm_driver/gcm_driver.h" @@ -26,17 +28,21 @@ #include "components/net_log/chrome_net_log.h" #include "components/network_time/network_time_tracker.h" #include "components/translate/core/browser/translate_download_manager.h" +#include "components/update_client/configurator.h" +#include "components/update_client/update_query_params.h" #include "components/variations/service/variations_service.h" #include "components/web_resource/promo_resource_service.h" #include "components/web_resource/web_resource_pref_names.h" #include "ios/chrome/browser/chrome_paths.h" #include "ios/chrome/browser/chrome_switches.h" +#include "ios/chrome/browser/component_updater/ios_component_updater_configurator.h" #include "ios/chrome/browser/history/history_service_factory.h" #include "ios/chrome/browser/ios_chrome_io_thread.h" #include "ios/chrome/browser/metrics/ios_chrome_metrics_services_manager_client.h" #include "ios/chrome/browser/pref_names.h" #include "ios/chrome/browser/prefs/browser_prefs.h" #include "ios/chrome/browser/prefs/ios_chrome_pref_service_factory.h" +#include "ios/chrome/browser/update_client/ios_chrome_update_query_params_delegate.h" #include "ios/chrome/browser/web_resource/web_resource_util.h" #include "ios/chrome/common/channel_info.h" #include "ios/public/provider/chrome/browser/browser_state/chrome_browser_state.h" @@ -45,6 +51,7 @@ #include "ios/web/public/web_thread.h" #include "net/log/net_log_capture_mode.h" #include "net/socket/client_socket_pool_manager.h" +#include "net/url_request/url_request_context_getter.h" namespace { @@ -69,6 +76,9 @@ ApplicationContextImpl::ApplicationContextImpl( command_line.GetCommandLineString(), GetChannelString())); SetApplicationLocale(locale); + + update_client::UpdateQueryParams::SetDelegate( + IOSChromeUpdateQueryParamsDelegate::GetInstance()); } ApplicationContextImpl::~ApplicationContextImpl() { @@ -285,6 +295,20 @@ ApplicationContextImpl::GetPromoResourceService() { return promo_resource_service_.get(); } +component_updater::ComponentUpdateService* +ApplicationContextImpl::GetComponentUpdateService() { + DCHECK(thread_checker_.CalledOnValidThread()); + if (!component_updater_) { + // Creating the component updater does not do anything, components need to + // be registered and Start() needs to be called. + component_updater_ = component_updater::ComponentUpdateServiceFactory( + component_updater::MakeIOSComponentUpdaterConfigurator( + base::CommandLine::ForCurrentProcess(), + GetSystemURLRequestContext())); + } + return component_updater_.get(); +} + void ApplicationContextImpl::SetApplicationLocale(const std::string& locale) { DCHECK(thread_checker_.CalledOnValidThread()); application_locale_ = locale; diff --git a/ios/chrome/browser/application_context_impl.h b/ios/chrome/browser/application_context_impl.h index 2f1f45b..a86fa1b 100644 --- a/ios/chrome/browser/application_context_impl.h +++ b/ios/chrome/browser/application_context_impl.h @@ -62,6 +62,8 @@ class ApplicationContextImpl : public ApplicationContext { IOSChromeIOThread* GetIOSChromeIOThread() override; gcm::GCMDriver* GetGCMDriver() override; web_resource::PromoResourceService* GetPromoResourceService() override; + component_updater::ComponentUpdateService* GetComponentUpdateService() + override; private: // Sets the locale used by the application. @@ -82,6 +84,7 @@ class ApplicationContextImpl : public ApplicationContext { metrics_services_manager_; scoped_ptr<gcm::GCMDriver> gcm_driver_; scoped_ptr<web_resource::PromoResourceService> promo_resource_service_; + scoped_ptr<component_updater::ComponentUpdateService> component_updater_; std::string application_locale_; // Sequenced task runner for local state related I/O tasks. diff --git a/ios/chrome/test/testing_application_context.cc b/ios/chrome/test/testing_application_context.cc index d0bbc8b..ca14b86 100644 --- a/ios/chrome/test/testing_application_context.cc +++ b/ios/chrome/test/testing_application_context.cc @@ -132,3 +132,9 @@ TestingApplicationContext::GetPromoResourceService() { DCHECK(thread_checker_.CalledOnValidThread()); return nullptr; } + +component_updater::ComponentUpdateService* +TestingApplicationContext::GetComponentUpdateService() { + DCHECK(thread_checker_.CalledOnValidThread()); + return nullptr; +} diff --git a/ios/chrome/test/testing_application_context.h b/ios/chrome/test/testing_application_context.h index 8cef8f0..4d539bc 100644 --- a/ios/chrome/test/testing_application_context.h +++ b/ios/chrome/test/testing_application_context.h @@ -46,6 +46,8 @@ class TestingApplicationContext : public ApplicationContext { IOSChromeIOThread* GetIOSChromeIOThread() override; gcm::GCMDriver* GetGCMDriver() override; web_resource::PromoResourceService* GetPromoResourceService() override; + component_updater::ComponentUpdateService* GetComponentUpdateService() + override; private: base::ThreadChecker thread_checker_; |