Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(246)

Side by Side Diff: chrome/browser/component_updater/chrome_component_updater_configurator.cc

Issue 2873533002: Prepare to abstract PersistedData by making it part of the configurator.
Patch Set: Rename pref_ to pref_service_. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/extensions/updater/chrome_update_client_config.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/sequenced_task_runner.h" 10 #include "base/sequenced_task_runner.h"
11 #include "base/strings/sys_string_conversions.h" 11 #include "base/strings/sys_string_conversions.h"
12 #include "base/task_scheduler/post_task.h" 12 #include "base/task_scheduler/post_task.h"
13 #include "base/version.h" 13 #include "base/version.h"
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "chrome/browser/browser_process.h" 15 #include "chrome/browser/browser_process.h"
16 #include "chrome/browser/component_updater/component_patcher_operation_out_of_pr ocess.h" 16 #include "chrome/browser/component_updater/component_patcher_operation_out_of_pr ocess.h"
17 #include "chrome/browser/component_updater/component_updater_utils.h" 17 #include "chrome/browser/component_updater/component_updater_utils.h"
18 #include "chrome/browser/google/google_brand.h" 18 #include "chrome/browser/google/google_brand.h"
19 #include "chrome/browser/update_client/chrome_update_query_params_delegate.h" 19 #include "chrome/browser/update_client/chrome_update_query_params_delegate.h"
20 #include "chrome/common/channel_info.h" 20 #include "chrome/common/channel_info.h"
21 #include "chrome/common/pref_names.h" 21 #include "chrome/common/pref_names.h"
22 #include "components/component_updater/configurator_impl.h" 22 #include "components/component_updater/configurator_impl.h"
23 #include "components/prefs/pref_registry_simple.h" 23 #include "components/prefs/pref_registry_simple.h"
24 #include "components/prefs/pref_service.h" 24 #include "components/prefs/pref_service.h"
25 #include "components/update_client/persisted_data.h"
25 #include "components/update_client/update_query_params.h" 26 #include "components/update_client/update_query_params.h"
26 27
27 #if defined(OS_WIN) 28 #if defined(OS_WIN)
28 #include "base/win/win_util.h" 29 #include "base/win/win_util.h"
29 #include "chrome/installer/util/google_update_settings.h" 30 #include "chrome/installer/util/google_update_settings.h"
30 #endif 31 #endif
31 32
32 namespace component_updater { 33 namespace component_updater {
33 34
34 namespace { 35 namespace {
(...skipping 21 matching lines...) Expand all
56 std::string GetDownloadPreference() const override; 57 std::string GetDownloadPreference() const override;
57 net::URLRequestContextGetter* RequestContext() const override; 58 net::URLRequestContextGetter* RequestContext() const override;
58 scoped_refptr<update_client::OutOfProcessPatcher> CreateOutOfProcessPatcher() 59 scoped_refptr<update_client::OutOfProcessPatcher> CreateOutOfProcessPatcher()
59 const override; 60 const override;
60 bool EnabledDeltas() const override; 61 bool EnabledDeltas() const override;
61 bool EnabledComponentUpdates() const override; 62 bool EnabledComponentUpdates() const override;
62 bool EnabledBackgroundDownloader() const override; 63 bool EnabledBackgroundDownloader() const override;
63 bool EnabledCupSigning() const override; 64 bool EnabledCupSigning() const override;
64 scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner() 65 scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner()
65 const override; 66 const override;
66 PrefService* GetPrefService() const override;
67 bool IsPerUserInstall() const override; 67 bool IsPerUserInstall() const override;
68 std::unique_ptr<update_client::PersistedData> CreateMetadata() const override;
68 69
69 private: 70 private:
70 friend class base::RefCountedThreadSafe<ChromeConfigurator>; 71 friend class base::RefCountedThreadSafe<ChromeConfigurator>;
71 72
72 ConfiguratorImpl configurator_impl_; 73 ConfiguratorImpl configurator_impl_;
73 PrefService* pref_service_; // This member is not owned by this class. 74 PrefService* pref_service_; // This member is not owned by this class.
74 75
75 ~ChromeConfigurator() override {} 76 ~ChromeConfigurator() override {}
76 }; 77 };
77 78
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 // after the browser shuts down, until the OS terminates the process. This 184 // after the browser shuts down, until the OS terminates the process. This
184 // imposes certain requirements for the code using the task runner, such as 185 // imposes certain requirements for the code using the task runner, such as
185 // not accessing any global browser state while the code is running. 186 // not accessing any global browser state while the code is running.
186 scoped_refptr<base::SequencedTaskRunner> 187 scoped_refptr<base::SequencedTaskRunner>
187 ChromeConfigurator::GetSequencedTaskRunner() const { 188 ChromeConfigurator::GetSequencedTaskRunner() const {
188 return base::CreateSequencedTaskRunnerWithTraits( 189 return base::CreateSequencedTaskRunnerWithTraits(
189 {base::MayBlock(), base::TaskPriority::BACKGROUND, 190 {base::MayBlock(), base::TaskPriority::BACKGROUND,
190 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}); 191 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN});
191 } 192 }
192 193
193 PrefService* ChromeConfigurator::GetPrefService() const {
194 DCHECK(pref_service_);
195 return pref_service_;
196 }
197
198 bool ChromeConfigurator::IsPerUserInstall() const { 194 bool ChromeConfigurator::IsPerUserInstall() const {
199 return component_updater::IsPerUserInstall(); 195 return component_updater::IsPerUserInstall();
200 } 196 }
201 197
198 std::unique_ptr<update_client::PersistedData>
199 ChromeConfigurator::CreateMetadata() const {
200 DCHECK(pref_service_);
201 return base::MakeUnique<update_client::PersistedData>(pref_service_);
202 }
203
202 } // namespace 204 } // namespace
203 205
204 void RegisterPrefsForChromeComponentUpdaterConfigurator( 206 void RegisterPrefsForChromeComponentUpdaterConfigurator(
205 PrefRegistrySimple* registry) { 207 PrefRegistrySimple* registry) {
206 // The component updates are enabled by default, if the preference is not set. 208 // The component updates are enabled by default, if the preference is not set.
207 registry->RegisterBooleanPref(prefs::kComponentUpdatesEnabled, true); 209 registry->RegisterBooleanPref(prefs::kComponentUpdatesEnabled, true);
208 } 210 }
209 211
210 scoped_refptr<update_client::Configurator> 212 scoped_refptr<update_client::Configurator>
211 MakeChromeComponentUpdaterConfigurator( 213 MakeChromeComponentUpdaterConfigurator(
212 const base::CommandLine* cmdline, 214 const base::CommandLine* cmdline,
213 net::URLRequestContextGetter* context_getter, 215 net::URLRequestContextGetter* context_getter,
214 PrefService* pref_service) { 216 PrefService* pref_service) {
215 return base::MakeRefCounted<ChromeConfigurator>(cmdline, context_getter, 217 return base::MakeRefCounted<ChromeConfigurator>(cmdline, context_getter,
216 pref_service); 218 pref_service);
217 } 219 }
218 220
219 } // namespace component_updater 221 } // namespace component_updater
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/updater/chrome_update_client_config.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698