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/path_service.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/component_patcher_operation.h" | 14 #include "components/update_client/component_patcher_operation.h" |
14 #include "ios/chrome/browser/application_context.h" | 15 #include "ios/chrome/browser/application_context.h" |
| 16 #include "ios/chrome/browser/chrome_paths.h" |
15 #include "ios/chrome/browser/google/google_brand.h" | 17 #include "ios/chrome/browser/google/google_brand.h" |
16 #include "ios/chrome/common/channel_info.h" | 18 #include "ios/chrome/common/channel_info.h" |
17 #include "ios/web/public/web_thread.h" | 19 #include "ios/web/public/web_thread.h" |
18 | 20 |
19 namespace component_updater { | 21 namespace component_updater { |
20 | 22 |
21 namespace { | 23 namespace { |
22 | 24 |
23 class IOSConfigurator : public update_client::Configurator { | 25 class IOSConfigurator : public update_client::Configurator { |
24 public: | 26 public: |
(...skipping 16 matching lines...) Expand all Loading... |
41 std::string ExtraRequestParams() const override; | 43 std::string ExtraRequestParams() const override; |
42 std::string GetDownloadPreference() const override; | 44 std::string GetDownloadPreference() const override; |
43 net::URLRequestContextGetter* RequestContext() const override; | 45 net::URLRequestContextGetter* RequestContext() const override; |
44 scoped_refptr<update_client::OutOfProcessPatcher> CreateOutOfProcessPatcher() | 46 scoped_refptr<update_client::OutOfProcessPatcher> CreateOutOfProcessPatcher() |
45 const override; | 47 const override; |
46 bool DeltasEnabled() const override; | 48 bool DeltasEnabled() const override; |
47 bool UseBackgroundDownloader() const override; | 49 bool UseBackgroundDownloader() const override; |
48 bool UseCupSigning() const override; | 50 bool UseCupSigning() const override; |
49 scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner() | 51 scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner() |
50 const override; | 52 const override; |
| 53 base::FilePath GetMetadataPath() const override; |
51 | 54 |
52 private: | 55 private: |
53 friend class base::RefCountedThreadSafe<IOSConfigurator>; | 56 friend class base::RefCountedThreadSafe<IOSConfigurator>; |
54 | 57 |
55 ConfiguratorImpl configurator_impl_; | 58 ConfiguratorImpl configurator_impl_; |
56 | 59 |
57 ~IOSConfigurator() override {} | 60 ~IOSConfigurator() override {} |
58 }; | 61 }; |
59 | 62 |
60 // Allows the component updater to use non-encrypted communication with the | 63 // Allows the component updater to use non-encrypted communication with the |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 } | 148 } |
146 | 149 |
147 scoped_refptr<base::SequencedTaskRunner> | 150 scoped_refptr<base::SequencedTaskRunner> |
148 IOSConfigurator::GetSequencedTaskRunner() const { | 151 IOSConfigurator::GetSequencedTaskRunner() const { |
149 return web::WebThread::GetBlockingPool() | 152 return web::WebThread::GetBlockingPool() |
150 ->GetSequencedTaskRunnerWithShutdownBehavior( | 153 ->GetSequencedTaskRunnerWithShutdownBehavior( |
151 web::WebThread::GetBlockingPool()->GetSequenceToken(), | 154 web::WebThread::GetBlockingPool()->GetSequenceToken(), |
152 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); | 155 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); |
153 } | 156 } |
154 | 157 |
| 158 base::FilePath IOSConfigurator::GetMetadataPath() const { |
| 159 base::FilePath result; |
| 160 if (PathService::Get(ios::DIR_USER_DATA, &result)) |
| 161 return result.AppendASCII("component_metadata.json"); |
| 162 return base::FilePath(); |
| 163 } |
| 164 |
155 } // namespace | 165 } // namespace |
156 | 166 |
157 scoped_refptr<update_client::Configurator> MakeIOSComponentUpdaterConfigurator( | 167 scoped_refptr<update_client::Configurator> MakeIOSComponentUpdaterConfigurator( |
158 const base::CommandLine* cmdline, | 168 const base::CommandLine* cmdline, |
159 net::URLRequestContextGetter* context_getter) { | 169 net::URLRequestContextGetter* context_getter) { |
160 return new IOSConfigurator(cmdline, context_getter); | 170 return new IOSConfigurator(cmdline, context_getter); |
161 } | 171 } |
162 | 172 |
163 } // namespace component_updater | 173 } // namespace component_updater |
OLD | NEW |