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

Side by Side Diff: ios/chrome/browser/component_updater/ios_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 | « components/update_client/update_engine.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/component_updater/ios_component_updater_configurato r.h" 5 #include "ios/chrome/browser/component_updater/ios_component_updater_configurato r.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/ptr_util.h"
10 #include "base/task_scheduler/post_task.h" 11 #include "base/task_scheduler/post_task.h"
12 #include "base/threading/sequenced_worker_pool.h"
11 #include "base/version.h" 13 #include "base/version.h"
12 #include "components/component_updater/configurator_impl.h" 14 #include "components/component_updater/configurator_impl.h"
13 #include "components/update_client/out_of_process_patcher.h" 15 #include "components/update_client/component_patcher_operation.h"
16 #include "components/update_client/persisted_data.h"
14 #include "components/update_client/update_query_params.h" 17 #include "components/update_client/update_query_params.h"
15 #include "ios/chrome/browser/application_context.h" 18 #include "ios/chrome/browser/application_context.h"
16 #include "ios/chrome/browser/google/google_brand.h" 19 #include "ios/chrome/browser/google/google_brand.h"
17 #include "ios/chrome/common/channel_info.h" 20 #include "ios/chrome/common/channel_info.h"
18 21
19 namespace component_updater { 22 namespace component_updater {
20 23
21 namespace { 24 namespace {
22 25
23 class IOSConfigurator : public update_client::Configurator { 26 class IOSConfigurator : public update_client::Configurator {
(...skipping 18 matching lines...) Expand all
42 std::string GetDownloadPreference() const override; 45 std::string GetDownloadPreference() const override;
43 net::URLRequestContextGetter* RequestContext() const override; 46 net::URLRequestContextGetter* RequestContext() const override;
44 scoped_refptr<update_client::OutOfProcessPatcher> CreateOutOfProcessPatcher() 47 scoped_refptr<update_client::OutOfProcessPatcher> CreateOutOfProcessPatcher()
45 const override; 48 const override;
46 bool EnabledDeltas() const override; 49 bool EnabledDeltas() const override;
47 bool EnabledComponentUpdates() const override; 50 bool EnabledComponentUpdates() const override;
48 bool EnabledBackgroundDownloader() const override; 51 bool EnabledBackgroundDownloader() const override;
49 bool EnabledCupSigning() const override; 52 bool EnabledCupSigning() const override;
50 scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner() 53 scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner()
51 const override; 54 const override;
52 PrefService* GetPrefService() const override;
53 bool IsPerUserInstall() const override; 55 bool IsPerUserInstall() const override;
56 std::unique_ptr<update_client::PersistedData> CreateMetadata() const override;
54 57
55 private: 58 private:
56 friend class base::RefCountedThreadSafe<IOSConfigurator>; 59 friend class base::RefCountedThreadSafe<IOSConfigurator>;
57 60
58 ConfiguratorImpl configurator_impl_; 61 ConfiguratorImpl configurator_impl_;
59 62
60 ~IOSConfigurator() override {} 63 ~IOSConfigurator() override {}
61 }; 64 };
62 65
63 // Allows the component updater to use non-encrypted communication with the 66 // Allows the component updater to use non-encrypted communication with the
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 return configurator_impl_.EnabledCupSigning(); 155 return configurator_impl_.EnabledCupSigning();
153 } 156 }
154 157
155 scoped_refptr<base::SequencedTaskRunner> 158 scoped_refptr<base::SequencedTaskRunner>
156 IOSConfigurator::GetSequencedTaskRunner() const { 159 IOSConfigurator::GetSequencedTaskRunner() const {
157 return base::CreateSequencedTaskRunnerWithTraits( 160 return base::CreateSequencedTaskRunnerWithTraits(
158 {base::MayBlock(), base::TaskPriority::BACKGROUND, 161 {base::MayBlock(), base::TaskPriority::BACKGROUND,
159 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}); 162 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN});
160 } 163 }
161 164
162 PrefService* IOSConfigurator::GetPrefService() const {
163 return GetApplicationContext()->GetLocalState();
164 }
165
166 bool IOSConfigurator::IsPerUserInstall() const { 165 bool IOSConfigurator::IsPerUserInstall() const {
167 return true; 166 return true;
168 } 167 }
169 168
169 std::unique_ptr<update_client::PersistedData> IOSConfigurator::CreateMetadata()
170 const {
171 return base::MakeUnique<update_client::PersistedData>(
172 GetApplicationContext()->GetLocalState());
173 }
174
170 } // namespace 175 } // namespace
171 176
172 scoped_refptr<update_client::Configurator> MakeIOSComponentUpdaterConfigurator( 177 scoped_refptr<update_client::Configurator> MakeIOSComponentUpdaterConfigurator(
173 const base::CommandLine* cmdline, 178 const base::CommandLine* cmdline,
174 net::URLRequestContextGetter* context_getter) { 179 net::URLRequestContextGetter* context_getter) {
175 return base::MakeRefCounted<IOSConfigurator>(cmdline, context_getter); 180 return base::MakeRefCounted<IOSConfigurator>(cmdline, context_getter);
176 } 181 }
177 182
178 } // namespace component_updater 183 } // namespace component_updater
OLDNEW
« no previous file with comments | « components/update_client/update_engine.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698