| 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 "chrome/browser/component_updater/chrome_component_updater_configurator
.h" | 5 #include "chrome/browser/component_updater/chrome_component_updater_configurator
.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
| 11 #include "base/task_scheduler/post_task.h" | 11 #include "base/task_scheduler/post_task.h" |
| 12 #include "base/version.h" | 12 #include "base/version.h" |
| 13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
| 15 #include "chrome/browser/component_updater/component_patcher_operation_out_of_pr
ocess.h" | 15 #include "chrome/browser/component_updater/component_patcher_operation_out_of_pr
ocess.h" |
| 16 #include "chrome/browser/component_updater/component_updater_utils.h" | 16 #include "chrome/browser/component_updater/component_updater_utils.h" |
| 17 #include "chrome/browser/google/google_brand.h" | 17 #include "chrome/browser/google/google_brand.h" |
| 18 #include "chrome/browser/update_client/chrome_update_query_params_delegate.h" | 18 #include "chrome/browser/update_client/chrome_update_query_params_delegate.h" |
| 19 #include "chrome/common/channel_info.h" | 19 #include "chrome/common/channel_info.h" |
| 20 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
| 21 #include "components/component_updater/configurator_impl.h" | 21 #include "components/component_updater/configurator_impl.h" |
| 22 #include "components/prefs/pref_registry_simple.h" | 22 #include "components/prefs/pref_registry_simple.h" |
| 23 #include "components/prefs/pref_service.h" | 23 #include "components/prefs/pref_service.h" |
| 24 #include "components/update_client/persisted_data.h" |
| 24 #include "components/update_client/update_query_params.h" | 25 #include "components/update_client/update_query_params.h" |
| 25 | 26 |
| 26 #if defined(OS_WIN) | 27 #if defined(OS_WIN) |
| 27 #include "base/win/win_util.h" | 28 #include "base/win/win_util.h" |
| 28 #include "chrome/installer/util/google_update_settings.h" | 29 #include "chrome/installer/util/google_update_settings.h" |
| 29 #endif | 30 #endif |
| 30 | 31 |
| 31 namespace component_updater { | 32 namespace component_updater { |
| 32 | 33 |
| 33 namespace { | 34 namespace { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 57 scoped_refptr<update_client::OutOfProcessPatcher> CreateOutOfProcessPatcher() | 58 scoped_refptr<update_client::OutOfProcessPatcher> CreateOutOfProcessPatcher() |
| 58 const override; | 59 const override; |
| 59 bool EnabledDeltas() const override; | 60 bool EnabledDeltas() const override; |
| 60 bool EnabledComponentUpdates() const override; | 61 bool EnabledComponentUpdates() const override; |
| 61 bool EnabledBackgroundDownloader() const override; | 62 bool EnabledBackgroundDownloader() const override; |
| 62 bool EnabledCupSigning() const override; | 63 bool EnabledCupSigning() const override; |
| 63 scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner() | 64 scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner() |
| 64 const override; | 65 const override; |
| 65 PrefService* GetPrefService() const override; | 66 PrefService* GetPrefService() const override; |
| 66 bool IsPerUserInstall() const override; | 67 bool IsPerUserInstall() const override; |
| 68 std::unique_ptr<update_client::PersistedData> CreateMetadata() const override; |
| 67 | 69 |
| 68 private: | 70 private: |
| 69 friend class base::RefCountedThreadSafe<ChromeConfigurator>; | 71 friend class base::RefCountedThreadSafe<ChromeConfigurator>; |
| 70 | 72 |
| 71 ConfiguratorImpl configurator_impl_; | 73 ConfiguratorImpl configurator_impl_; |
| 72 PrefService* pref_service_; // This member is not owned by this class. | 74 PrefService* pref_service_; // This member is not owned by this class. |
| 73 | 75 |
| 74 ~ChromeConfigurator() override {} | 76 ~ChromeConfigurator() override {} |
| 75 }; | 77 }; |
| 76 | 78 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 | 193 |
| 192 PrefService* ChromeConfigurator::GetPrefService() const { | 194 PrefService* ChromeConfigurator::GetPrefService() const { |
| 193 DCHECK(pref_service_); | 195 DCHECK(pref_service_); |
| 194 return pref_service_; | 196 return pref_service_; |
| 195 } | 197 } |
| 196 | 198 |
| 197 bool ChromeConfigurator::IsPerUserInstall() const { | 199 bool ChromeConfigurator::IsPerUserInstall() const { |
| 198 return component_updater::IsPerUserInstall(); | 200 return component_updater::IsPerUserInstall(); |
| 199 } | 201 } |
| 200 | 202 |
| 203 std::unique_ptr<update_client::PersistedData> |
| 204 ChromeConfigurator::CreateMetadata() const { |
| 205 return base::MakeUnique<update_client::PersistedData>(GetPrefService()); |
| 206 } |
| 207 |
| 201 } // namespace | 208 } // namespace |
| 202 | 209 |
| 203 void RegisterPrefsForChromeComponentUpdaterConfigurator( | 210 void RegisterPrefsForChromeComponentUpdaterConfigurator( |
| 204 PrefRegistrySimple* registry) { | 211 PrefRegistrySimple* registry) { |
| 205 // The component updates are enabled by default, if the preference is not set. | 212 // The component updates are enabled by default, if the preference is not set. |
| 206 registry->RegisterBooleanPref(prefs::kComponentUpdatesEnabled, true); | 213 registry->RegisterBooleanPref(prefs::kComponentUpdatesEnabled, true); |
| 207 } | 214 } |
| 208 | 215 |
| 209 scoped_refptr<update_client::Configurator> | 216 scoped_refptr<update_client::Configurator> |
| 210 MakeChromeComponentUpdaterConfigurator( | 217 MakeChromeComponentUpdaterConfigurator( |
| 211 const base::CommandLine* cmdline, | 218 const base::CommandLine* cmdline, |
| 212 net::URLRequestContextGetter* context_getter, | 219 net::URLRequestContextGetter* context_getter, |
| 213 PrefService* pref_service) { | 220 PrefService* pref_service) { |
| 214 return base::MakeShared<ChromeConfigurator>(cmdline, context_getter, | 221 return base::MakeShared<ChromeConfigurator>(cmdline, context_getter, |
| 215 pref_service); | 222 pref_service); |
| 216 } | 223 } |
| 217 | 224 |
| 218 } // namespace component_updater | 225 } // namespace component_updater |
| OLD | NEW |