| 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/threading/sequenced_worker_pool.h" | 10 #include "base/threading/sequenced_worker_pool.h" |
| 11 #include "base/version.h" | 11 #include "base/version.h" |
| 12 #include "components/component_updater/configurator_impl.h" | 12 #include "components/component_updater/configurator_impl.h" |
| 13 #include "components/update_client/component_patcher_operation.h" | 13 #include "components/update_client/component_patcher_operation.h" |
| 14 #include "ios/chrome/browser/application_context.h" | 14 #include "ios/chrome/browser/application_context.h" |
| 15 #include "ios/chrome/browser/google/google_brand.h" |
| 15 #include "ios/chrome/common/channel_info.h" | 16 #include "ios/chrome/common/channel_info.h" |
| 16 #include "ios/web/public/web_thread.h" | 17 #include "ios/web/public/web_thread.h" |
| 17 | 18 |
| 18 namespace component_updater { | 19 namespace component_updater { |
| 19 | 20 |
| 20 namespace { | 21 namespace { |
| 21 | 22 |
| 22 class IOSConfigurator : public update_client::Configurator { | 23 class IOSConfigurator : public update_client::Configurator { |
| 23 public: | 24 public: |
| 24 IOSConfigurator(const base::CommandLine* cmdline, | 25 IOSConfigurator(const base::CommandLine* cmdline, |
| 25 net::URLRequestContextGetter* url_request_getter); | 26 net::URLRequestContextGetter* url_request_getter); |
| 26 | 27 |
| 27 // update_client::Configurator overrides. | 28 // update_client::Configurator overrides. |
| 28 int InitialDelay() const override; | 29 int InitialDelay() const override; |
| 29 int NextCheckDelay() const override; | 30 int NextCheckDelay() const override; |
| 30 int StepDelay() const override; | 31 int StepDelay() const override; |
| 31 int OnDemandDelay() const override; | 32 int OnDemandDelay() const override; |
| 32 int UpdateDelay() const override; | 33 int UpdateDelay() const override; |
| 33 std::vector<GURL> UpdateUrl() const override; | 34 std::vector<GURL> UpdateUrl() const override; |
| 34 std::vector<GURL> PingUrl() const override; | 35 std::vector<GURL> PingUrl() const override; |
| 35 base::Version GetBrowserVersion() const override; | 36 base::Version GetBrowserVersion() const override; |
| 36 std::string GetChannel() const override; | 37 std::string GetChannel() const override; |
| 38 std::string GetBrand() const override; |
| 37 std::string GetLang() const override; | 39 std::string GetLang() const override; |
| 38 std::string GetOSLongName() const override; | 40 std::string GetOSLongName() const override; |
| 39 std::string ExtraRequestParams() const override; | 41 std::string ExtraRequestParams() const override; |
| 40 std::string GetDownloadPreference() const override; | 42 std::string GetDownloadPreference() const override; |
| 41 net::URLRequestContextGetter* RequestContext() const override; | 43 net::URLRequestContextGetter* RequestContext() const override; |
| 42 scoped_refptr<update_client::OutOfProcessPatcher> CreateOutOfProcessPatcher() | 44 scoped_refptr<update_client::OutOfProcessPatcher> CreateOutOfProcessPatcher() |
| 43 const override; | 45 const override; |
| 44 bool DeltasEnabled() const override; | 46 bool DeltasEnabled() const override; |
| 45 bool UseBackgroundDownloader() const override; | 47 bool UseBackgroundDownloader() const override; |
| 46 bool UseCupSigning() const override; | 48 bool UseCupSigning() const override; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 } | 91 } |
| 90 | 92 |
| 91 base::Version IOSConfigurator::GetBrowserVersion() const { | 93 base::Version IOSConfigurator::GetBrowserVersion() const { |
| 92 return configurator_impl_.GetBrowserVersion(); | 94 return configurator_impl_.GetBrowserVersion(); |
| 93 } | 95 } |
| 94 | 96 |
| 95 std::string IOSConfigurator::GetChannel() const { | 97 std::string IOSConfigurator::GetChannel() const { |
| 96 return GetChannelString(); | 98 return GetChannelString(); |
| 97 } | 99 } |
| 98 | 100 |
| 101 std::string IOSConfigurator::GetBrand() const { |
| 102 std::string brand; |
| 103 ios::google_brand::GetBrand(&brand); |
| 104 return brand; |
| 105 } |
| 106 |
| 99 std::string IOSConfigurator::GetLang() const { | 107 std::string IOSConfigurator::GetLang() const { |
| 100 return GetApplicationContext()->GetApplicationLocale(); | 108 return GetApplicationContext()->GetApplicationLocale(); |
| 101 } | 109 } |
| 102 | 110 |
| 103 std::string IOSConfigurator::GetOSLongName() const { | 111 std::string IOSConfigurator::GetOSLongName() const { |
| 104 return configurator_impl_.GetOSLongName(); | 112 return configurator_impl_.GetOSLongName(); |
| 105 } | 113 } |
| 106 | 114 |
| 107 std::string IOSConfigurator::ExtraRequestParams() const { | 115 std::string IOSConfigurator::ExtraRequestParams() const { |
| 108 return configurator_impl_.ExtraRequestParams(); | 116 return configurator_impl_.ExtraRequestParams(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 | 151 |
| 144 } // namespace | 152 } // namespace |
| 145 | 153 |
| 146 scoped_refptr<update_client::Configurator> MakeIOSComponentUpdaterConfigurator( | 154 scoped_refptr<update_client::Configurator> MakeIOSComponentUpdaterConfigurator( |
| 147 const base::CommandLine* cmdline, | 155 const base::CommandLine* cmdline, |
| 148 net::URLRequestContextGetter* context_getter) { | 156 net::URLRequestContextGetter* context_getter) { |
| 149 return new IOSConfigurator(cmdline, context_getter); | 157 return new IOSConfigurator(cmdline, context_getter); |
| 150 } | 158 } |
| 151 | 159 |
| 152 } // namespace component_updater | 160 } // namespace component_updater |
| OLD | NEW |