| OLD | NEW |
| 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/threading/sequenced_worker_pool.h" | 11 #include "base/threading/sequenced_worker_pool.h" |
| 11 #include "base/version.h" | 12 #include "base/version.h" |
| 12 #include "components/component_updater/configurator_impl.h" | 13 #include "components/component_updater/configurator_impl.h" |
| 13 #include "components/update_client/out_of_process_patcher.h" | 14 #include "components/update_client/out_of_process_patcher.h" |
| 15 #include "components/update_client/persisted_data.h" |
| 14 #include "components/update_client/update_query_params.h" | 16 #include "components/update_client/update_query_params.h" |
| 15 #include "ios/chrome/browser/application_context.h" | 17 #include "ios/chrome/browser/application_context.h" |
| 16 #include "ios/chrome/browser/google/google_brand.h" | 18 #include "ios/chrome/browser/google/google_brand.h" |
| 17 #include "ios/chrome/common/channel_info.h" | 19 #include "ios/chrome/common/channel_info.h" |
| 18 #include "ios/web/public/web_thread.h" | 20 #include "ios/web/public/web_thread.h" |
| 19 | 21 |
| 20 namespace component_updater { | 22 namespace component_updater { |
| 21 | 23 |
| 22 namespace { | 24 namespace { |
| 23 | 25 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 45 scoped_refptr<update_client::OutOfProcessPatcher> CreateOutOfProcessPatcher() | 47 scoped_refptr<update_client::OutOfProcessPatcher> CreateOutOfProcessPatcher() |
| 46 const override; | 48 const override; |
| 47 bool EnabledDeltas() const override; | 49 bool EnabledDeltas() const override; |
| 48 bool EnabledComponentUpdates() const override; | 50 bool EnabledComponentUpdates() const override; |
| 49 bool EnabledBackgroundDownloader() const override; | 51 bool EnabledBackgroundDownloader() const override; |
| 50 bool EnabledCupSigning() const override; | 52 bool EnabledCupSigning() const override; |
| 51 scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner() | 53 scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner() |
| 52 const override; | 54 const override; |
| 53 PrefService* GetPrefService() const override; | 55 PrefService* GetPrefService() const override; |
| 54 bool IsPerUserInstall() const override; | 56 bool IsPerUserInstall() const override; |
| 57 std::unique_ptr<update_client::PersistedData> CreateMetadata() const override; |
| 55 | 58 |
| 56 private: | 59 private: |
| 57 friend class base::RefCountedThreadSafe<IOSConfigurator>; | 60 friend class base::RefCountedThreadSafe<IOSConfigurator>; |
| 58 | 61 |
| 59 ConfiguratorImpl configurator_impl_; | 62 ConfiguratorImpl configurator_impl_; |
| 60 | 63 |
| 61 ~IOSConfigurator() override {} | 64 ~IOSConfigurator() override {} |
| 62 }; | 65 }; |
| 63 | 66 |
| 64 // Allows the component updater to use non-encrypted communication with the | 67 // Allows the component updater to use non-encrypted communication with the |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 } | 165 } |
| 163 | 166 |
| 164 PrefService* IOSConfigurator::GetPrefService() const { | 167 PrefService* IOSConfigurator::GetPrefService() const { |
| 165 return GetApplicationContext()->GetLocalState(); | 168 return GetApplicationContext()->GetLocalState(); |
| 166 } | 169 } |
| 167 | 170 |
| 168 bool IOSConfigurator::IsPerUserInstall() const { | 171 bool IOSConfigurator::IsPerUserInstall() const { |
| 169 return true; | 172 return true; |
| 170 } | 173 } |
| 171 | 174 |
| 175 std::unique_ptr<update_client::PersistedData> IOSConfigurator::CreateMetadata() |
| 176 const { |
| 177 return base::MakeUnique<update_client::PersistedData>(GetPrefService()); |
| 178 } |
| 179 |
| 172 } // namespace | 180 } // namespace |
| 173 | 181 |
| 174 scoped_refptr<update_client::Configurator> MakeIOSComponentUpdaterConfigurator( | 182 scoped_refptr<update_client::Configurator> MakeIOSComponentUpdaterConfigurator( |
| 175 const base::CommandLine* cmdline, | 183 const base::CommandLine* cmdline, |
| 176 net::URLRequestContextGetter* context_getter) { | 184 net::URLRequestContextGetter* context_getter) { |
| 177 return base::MakeShared<IOSConfigurator>(cmdline, context_getter); | 185 return base::MakeShared<IOSConfigurator>(cmdline, context_getter); |
| 178 } | 186 } |
| 179 | 187 |
| 180 } // namespace component_updater | 188 } // namespace component_updater |
| OLD | NEW |