Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "ios/chrome/browser/component_updater/component_updater_configurator.h" | |
| 6 | |
| 7 #include <string> | |
| 8 | |
| 9 #include "base/threading/sequenced_worker_pool.h" | |
| 10 #include "components/component_updater/configurator_impl.h" | |
| 11 #include "components/update_client/component_patcher_operation.h" | |
| 12 #include "components/update_client/update_query_params_delegate.h" | |
| 13 #include "ios/chrome/browser/application_context.h" | |
| 14 #include "ios/chrome/common/channel_info.h" | |
| 15 #include "ios/web/public/web_thread.h" | |
| 16 | |
| 17 namespace component_updater { | |
| 18 | |
| 19 namespace { | |
| 20 | |
| 21 class ChromeConfigurator : public update_client::Configurator { | |
| 22 public: | |
| 23 ChromeConfigurator(const base::CommandLine* cmdline, | |
| 24 net::URLRequestContextGetter* url_request_getter); | |
| 25 | |
| 26 // update_client::Configurator: | |
|
Sorin Jianu
2015/08/12 02:27:51
update_client::Configurator overrides.
droger
2015/08/12 08:43:41
Done.
| |
| 27 int InitialDelay() const override; | |
| 28 int NextCheckDelay() const override; | |
| 29 int StepDelay() const override; | |
| 30 int OnDemandDelay() const override; | |
| 31 int UpdateDelay() const override; | |
| 32 std::vector<GURL> UpdateUrl() const override; | |
| 33 std::vector<GURL> PingUrl() const override; | |
| 34 base::Version GetBrowserVersion() const override; | |
| 35 std::string GetChannel() const override; | |
| 36 std::string GetLang() const override; | |
| 37 std::string GetOSLongName() const override; | |
| 38 std::string ExtraRequestParams() const override; | |
| 39 net::URLRequestContextGetter* RequestContext() const override; | |
| 40 scoped_refptr<update_client::OutOfProcessPatcher> CreateOutOfProcessPatcher() | |
| 41 const override; | |
| 42 bool DeltasEnabled() const override; | |
| 43 bool UseBackgroundDownloader() const override; | |
| 44 scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner() | |
| 45 const override; | |
| 46 scoped_refptr<base::SingleThreadTaskRunner> GetSingleThreadTaskRunner() | |
| 47 const override; | |
| 48 | |
| 49 private: | |
| 50 friend class base::RefCountedThreadSafe<ChromeConfigurator>; | |
| 51 | |
| 52 ConfiguratorImpl configurator_impl_; | |
| 53 | |
| 54 ~ChromeConfigurator() override {} | |
| 55 }; | |
| 56 | |
| 57 ChromeConfigurator::ChromeConfigurator( | |
| 58 const base::CommandLine* cmdline, | |
| 59 net::URLRequestContextGetter* url_request_getter) | |
| 60 : configurator_impl_(cmdline, url_request_getter) {} | |
| 61 | |
| 62 int ChromeConfigurator::InitialDelay() const { | |
| 63 return configurator_impl_.InitialDelay(); | |
| 64 } | |
| 65 | |
| 66 int ChromeConfigurator::NextCheckDelay() const { | |
| 67 return configurator_impl_.NextCheckDelay(); | |
| 68 } | |
| 69 | |
| 70 int ChromeConfigurator::StepDelay() const { | |
| 71 return configurator_impl_.StepDelay(); | |
| 72 } | |
| 73 | |
| 74 int ChromeConfigurator::OnDemandDelay() const { | |
| 75 return configurator_impl_.OnDemandDelay(); | |
| 76 } | |
| 77 | |
| 78 int ChromeConfigurator::UpdateDelay() const { | |
| 79 return configurator_impl_.UpdateDelay(); | |
| 80 } | |
| 81 | |
| 82 std::vector<GURL> ChromeConfigurator::UpdateUrl() const { | |
| 83 return configurator_impl_.UpdateUrl(); | |
| 84 } | |
| 85 | |
| 86 std::vector<GURL> ChromeConfigurator::PingUrl() const { | |
| 87 return configurator_impl_.PingUrl(); | |
| 88 } | |
| 89 | |
| 90 base::Version ChromeConfigurator::GetBrowserVersion() const { | |
| 91 return configurator_impl_.GetBrowserVersion(); | |
| 92 } | |
| 93 | |
| 94 std::string ChromeConfigurator::GetChannel() const { | |
| 95 return update_client::UpdateQueryParamsDelegate::GetChannelStringHelper( | |
| 96 ::GetChannel()); | |
| 97 } | |
| 98 | |
| 99 std::string ChromeConfigurator::GetLang() const { | |
| 100 return GetApplicationContext()->GetApplicationLocale(); | |
|
Sorin Jianu
2015/08/12 02:27:51
In the future, would it be possible to get a compo
droger
2015/08/12 08:43:41
You are right.
It would be possible to componentiz
| |
| 101 } | |
| 102 | |
| 103 std::string ChromeConfigurator::GetOSLongName() const { | |
| 104 return configurator_impl_.GetOSLongName(); | |
| 105 } | |
| 106 | |
| 107 std::string ChromeConfigurator::ExtraRequestParams() const { | |
| 108 return configurator_impl_.ExtraRequestParams(); | |
| 109 } | |
| 110 | |
| 111 net::URLRequestContextGetter* ChromeConfigurator::RequestContext() const { | |
| 112 return configurator_impl_.RequestContext(); | |
| 113 } | |
| 114 | |
| 115 scoped_refptr<update_client::OutOfProcessPatcher> | |
| 116 ChromeConfigurator::CreateOutOfProcessPatcher() const { | |
| 117 return nullptr; | |
| 118 } | |
| 119 | |
| 120 bool ChromeConfigurator::DeltasEnabled() const { | |
| 121 return configurator_impl_.DeltasEnabled(); | |
| 122 } | |
| 123 | |
| 124 bool ChromeConfigurator::UseBackgroundDownloader() const { | |
| 125 return configurator_impl_.UseBackgroundDownloader(); | |
| 126 } | |
| 127 | |
| 128 scoped_refptr<base::SequencedTaskRunner> | |
| 129 ChromeConfigurator::GetSequencedTaskRunner() const { | |
| 130 return web::WebThread::GetBlockingPool() | |
| 131 ->GetSequencedTaskRunnerWithShutdownBehavior( | |
| 132 web::WebThread::GetBlockingPool()->GetSequenceToken(), | |
| 133 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); | |
| 134 } | |
| 135 | |
| 136 scoped_refptr<base::SingleThreadTaskRunner> | |
| 137 ChromeConfigurator::GetSingleThreadTaskRunner() const { | |
| 138 return web::WebThread::GetTaskRunnerForThread(web::WebThread::FILE); | |
| 139 } | |
| 140 | |
| 141 } // namespace | |
| 142 | |
| 143 scoped_refptr<update_client::Configurator> MakeComponentUpdaterConfigurator( | |
| 144 const base::CommandLine* cmdline, | |
| 145 net::URLRequestContextGetter* context_getter) { | |
| 146 return new ChromeConfigurator(cmdline, context_getter); | |
| 147 } | |
| 148 | |
| 149 } // namespace component_updater | |
| OLD | NEW |