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

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

Issue 2257363002: Define EnabledComponentUpdates group policy for the component updater. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@callback
Patch Set: Removed policy group. Reworded comment. Created 4 years, 4 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
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/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
11 #include "base/threading/sequenced_worker_pool.h" 11 #include "base/threading/sequenced_worker_pool.h"
12 #include "base/version.h" 12 #include "base/version.h"
13 #if defined(OS_WIN) 13 #if defined(OS_WIN)
14 #include "base/win/win_util.h" 14 #include "base/win/win_util.h"
15 #endif 15 #endif
16 #include "chrome/browser/browser_process.h" 16 #include "chrome/browser/browser_process.h"
17 #include "chrome/browser/component_updater/component_patcher_operation_out_of_pr ocess.h" 17 #include "chrome/browser/component_updater/component_patcher_operation_out_of_pr ocess.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 #if defined(OS_WIN) 22 #if defined(OS_WIN)
22 #include "chrome/installer/util/google_update_settings.h" 23 #include "chrome/installer/util/google_update_settings.h"
23 #endif 24 #endif
24 #include "components/component_updater/configurator_impl.h" 25 #include "components/component_updater/configurator_impl.h"
26 #include "components/prefs/pref_registry_simple.h"
25 #include "components/prefs/pref_service.h" 27 #include "components/prefs/pref_service.h"
26 #include "content/public/browser/browser_thread.h" 28 #include "content/public/browser/browser_thread.h"
27 29
28 namespace component_updater { 30 namespace component_updater {
29 31
30 namespace { 32 namespace {
31 33
32 class ChromeConfigurator : public update_client::Configurator { 34 class ChromeConfigurator : public update_client::Configurator {
33 public: 35 public:
34 ChromeConfigurator(const base::CommandLine* cmdline, 36 ChromeConfigurator(const base::CommandLine* cmdline,
(...skipping 23 matching lines...) Expand all
58 bool EnabledBackgroundDownloader() const override; 60 bool EnabledBackgroundDownloader() const override;
59 bool EnabledCupSigning() const override; 61 bool EnabledCupSigning() const override;
60 scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner() 62 scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner()
61 const override; 63 const override;
62 PrefService* GetPrefService() const override; 64 PrefService* GetPrefService() const override;
63 65
64 private: 66 private:
65 friend class base::RefCountedThreadSafe<ChromeConfigurator>; 67 friend class base::RefCountedThreadSafe<ChromeConfigurator>;
66 68
67 ConfiguratorImpl configurator_impl_; 69 ConfiguratorImpl configurator_impl_;
68
69 PrefService* pref_service_; // This member is not owned by this class. 70 PrefService* pref_service_; // This member is not owned by this class.
70 71
71 ~ChromeConfigurator() override {} 72 ~ChromeConfigurator() override {}
72 }; 73 };
73 74
74 // Allows the component updater to use non-encrypted communication with the 75 // Allows the component updater to use non-encrypted communication with the
75 // update backend. The security of the update checks is enforced using 76 // update backend. The security of the update checks is enforced using
76 // a custom message signing protocol and it does not depend on using HTTPS. 77 // a custom message signing protocol and it does not depend on using HTTPS.
77 ChromeConfigurator::ChromeConfigurator( 78 ChromeConfigurator::ChromeConfigurator(
78 const base::CommandLine* cmdline, 79 const base::CommandLine* cmdline,
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 scoped_refptr<update_client::OutOfProcessPatcher> 158 scoped_refptr<update_client::OutOfProcessPatcher>
158 ChromeConfigurator::CreateOutOfProcessPatcher() const { 159 ChromeConfigurator::CreateOutOfProcessPatcher() const {
159 return make_scoped_refptr(new ChromeOutOfProcessPatcher); 160 return make_scoped_refptr(new ChromeOutOfProcessPatcher);
160 } 161 }
161 162
162 bool ChromeConfigurator::EnabledDeltas() const { 163 bool ChromeConfigurator::EnabledDeltas() const {
163 return configurator_impl_.EnabledDeltas(); 164 return configurator_impl_.EnabledDeltas();
164 } 165 }
165 166
166 bool ChromeConfigurator::EnabledComponentUpdates() const { 167 bool ChromeConfigurator::EnabledComponentUpdates() const {
167 return configurator_impl_.EnabledComponentUpdates(); 168 return pref_service_->GetBoolean(prefs::kComponentUpdatesEnabled);
168 } 169 }
169 170
170 bool ChromeConfigurator::EnabledBackgroundDownloader() const { 171 bool ChromeConfigurator::EnabledBackgroundDownloader() const {
171 return configurator_impl_.EnabledBackgroundDownloader(); 172 return configurator_impl_.EnabledBackgroundDownloader();
172 } 173 }
173 174
174 bool ChromeConfigurator::EnabledCupSigning() const { 175 bool ChromeConfigurator::EnabledCupSigning() const {
175 return configurator_impl_.EnabledCupSigning(); 176 return configurator_impl_.EnabledCupSigning();
176 } 177 }
177 178
178 // Returns a task runner to run blocking tasks. The task runner continues to run 179 // Returns a task runner to run blocking tasks. The task runner continues to run
179 // after the browser shuts down, until the OS terminates the process. This 180 // after the browser shuts down, until the OS terminates the process. This
180 // imposes certain requirements for the code using the task runner, such as 181 // imposes certain requirements for the code using the task runner, such as
181 // not accessing any global browser state while the code is running. 182 // not accessing any global browser state while the code is running.
182 scoped_refptr<base::SequencedTaskRunner> 183 scoped_refptr<base::SequencedTaskRunner>
183 ChromeConfigurator::GetSequencedTaskRunner() const { 184 ChromeConfigurator::GetSequencedTaskRunner() const {
184 return content::BrowserThread::GetBlockingPool() 185 return content::BrowserThread::GetBlockingPool()
185 ->GetSequencedTaskRunnerWithShutdownBehavior( 186 ->GetSequencedTaskRunnerWithShutdownBehavior(
186 base::SequencedWorkerPool::GetSequenceToken(), 187 base::SequencedWorkerPool::GetSequenceToken(),
187 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN); 188 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN);
188 } 189 }
189 190
190 PrefService* ChromeConfigurator::GetPrefService() const { 191 PrefService* ChromeConfigurator::GetPrefService() const {
191 DCHECK(pref_service_); 192 DCHECK(pref_service_);
192 return pref_service_; 193 return pref_service_;
193 } 194 }
194 195
195 } // namespace 196 } // namespace
196 197
198 void RegisterPrefsForChromeComponentUpdaterConfigurator(
199 PrefRegistrySimple* registry) {
200 // The component updates are enabled by default, if the preference is not set.
201 registry->RegisterBooleanPref(prefs::kComponentUpdatesEnabled, true);
202 }
203
197 scoped_refptr<update_client::Configurator> 204 scoped_refptr<update_client::Configurator>
198 MakeChromeComponentUpdaterConfigurator( 205 MakeChromeComponentUpdaterConfigurator(
199 const base::CommandLine* cmdline, 206 const base::CommandLine* cmdline,
200 net::URLRequestContextGetter* context_getter, 207 net::URLRequestContextGetter* context_getter,
201 PrefService* pref_service) { 208 PrefService* pref_service) {
202 return new ChromeConfigurator(cmdline, context_getter, pref_service); 209 return new ChromeConfigurator(cmdline, context_getter, pref_service);
203 } 210 }
204 211
205 } // namespace component_updater 212 } // namespace component_updater
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698