cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / ios / chrome / browser / component_updater / ios_component_updater_configurator.cc
blobd3070c536a51fc9d0a76d477f77bc5523b5538c9
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.
5 #include "ios/chrome/browser/component_updater/ios_component_updater_configurator.h"
7 #include <string>
9 #include "base/threading/sequenced_worker_pool.h"
10 #include "base/version.h"
11 #include "components/component_updater/configurator_impl.h"
12 #include "components/update_client/component_patcher_operation.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"
17 namespace component_updater {
19 namespace {
21 class IOSConfigurator : public update_client::Configurator {
22 public:
23 IOSConfigurator(const base::CommandLine* cmdline,
24 net::URLRequestContextGetter* url_request_getter);
26 // update_client::Configurator overrides.
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;
49 private:
50 friend class base::RefCountedThreadSafe<IOSConfigurator>;
52 ConfiguratorImpl configurator_impl_;
54 ~IOSConfigurator() override {}
57 IOSConfigurator::IOSConfigurator(
58 const base::CommandLine* cmdline,
59 net::URLRequestContextGetter* url_request_getter)
60 : configurator_impl_(cmdline, url_request_getter) {}
62 int IOSConfigurator::InitialDelay() const {
63 return configurator_impl_.InitialDelay();
66 int IOSConfigurator::NextCheckDelay() const {
67 return configurator_impl_.NextCheckDelay();
70 int IOSConfigurator::StepDelay() const {
71 return configurator_impl_.StepDelay();
74 int IOSConfigurator::OnDemandDelay() const {
75 return configurator_impl_.OnDemandDelay();
78 int IOSConfigurator::UpdateDelay() const {
79 return configurator_impl_.UpdateDelay();
82 std::vector<GURL> IOSConfigurator::UpdateUrl() const {
83 return configurator_impl_.UpdateUrl();
86 std::vector<GURL> IOSConfigurator::PingUrl() const {
87 return configurator_impl_.PingUrl();
90 base::Version IOSConfigurator::GetBrowserVersion() const {
91 return configurator_impl_.GetBrowserVersion();
94 std::string IOSConfigurator::GetChannel() const {
95 return GetChannelString();
98 std::string IOSConfigurator::GetLang() const {
99 return GetApplicationContext()->GetApplicationLocale();
102 std::string IOSConfigurator::GetOSLongName() const {
103 return configurator_impl_.GetOSLongName();
106 std::string IOSConfigurator::ExtraRequestParams() const {
107 return configurator_impl_.ExtraRequestParams();
110 net::URLRequestContextGetter* IOSConfigurator::RequestContext() const {
111 return configurator_impl_.RequestContext();
114 scoped_refptr<update_client::OutOfProcessPatcher>
115 IOSConfigurator::CreateOutOfProcessPatcher() const {
116 return nullptr;
119 bool IOSConfigurator::DeltasEnabled() const {
120 return configurator_impl_.DeltasEnabled();
123 bool IOSConfigurator::UseBackgroundDownloader() const {
124 return configurator_impl_.UseBackgroundDownloader();
127 scoped_refptr<base::SequencedTaskRunner>
128 IOSConfigurator::GetSequencedTaskRunner() const {
129 return web::WebThread::GetBlockingPool()
130 ->GetSequencedTaskRunnerWithShutdownBehavior(
131 web::WebThread::GetBlockingPool()->GetSequenceToken(),
132 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN);
135 scoped_refptr<base::SingleThreadTaskRunner>
136 IOSConfigurator::GetSingleThreadTaskRunner() const {
137 return web::WebThread::GetTaskRunnerForThread(web::WebThread::FILE);
140 } // namespace
142 scoped_refptr<update_client::Configurator> MakeIOSComponentUpdaterConfigurator(
143 const base::CommandLine* cmdline,
144 net::URLRequestContextGetter* context_getter) {
145 return new IOSConfigurator(cmdline, context_getter);
148 } // namespace component_updater