OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/component_updater/chrome_component_updater_configurator .h" | 5 #include "chrome/browser/component_updater/chrome_component_updater_configurator .h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/files/file_path.h" | |
11 #include "base/path_service.h" | |
10 #include "base/strings/sys_string_conversions.h" | 12 #include "base/strings/sys_string_conversions.h" |
11 #include "base/threading/sequenced_worker_pool.h" | 13 #include "base/threading/sequenced_worker_pool.h" |
12 #include "base/version.h" | 14 #include "base/version.h" |
13 #if defined(OS_WIN) | 15 #if defined(OS_WIN) |
14 #include "base/win/win_util.h" | 16 #include "base/win/win_util.h" |
15 #endif | 17 #endif |
16 #include "chrome/browser/component_updater/component_patcher_operation_out_of_pr ocess.h" | 18 #include "chrome/browser/component_updater/component_patcher_operation_out_of_pr ocess.h" |
17 #include "chrome/browser/google/google_brand.h" | 19 #include "chrome/browser/google/google_brand.h" |
18 #include "chrome/browser/update_client/chrome_update_query_params_delegate.h" | 20 #include "chrome/browser/update_client/chrome_update_query_params_delegate.h" |
19 #include "chrome/common/channel_info.h" | 21 #include "chrome/common/channel_info.h" |
22 #include "chrome/common/chrome_paths.h" | |
20 #if defined(OS_WIN) | 23 #if defined(OS_WIN) |
21 #include "chrome/installer/util/google_update_settings.h" | 24 #include "chrome/installer/util/google_update_settings.h" |
22 #endif | 25 #endif |
23 #include "components/component_updater/configurator_impl.h" | 26 #include "components/component_updater/configurator_impl.h" |
24 #include "content/public/browser/browser_thread.h" | 27 #include "content/public/browser/browser_thread.h" |
25 | 28 |
26 namespace component_updater { | 29 namespace component_updater { |
27 | 30 |
28 namespace { | 31 namespace { |
29 | 32 |
(...skipping 18 matching lines...) Expand all Loading... | |
48 std::string ExtraRequestParams() const override; | 51 std::string ExtraRequestParams() const override; |
49 std::string GetDownloadPreference() const override; | 52 std::string GetDownloadPreference() const override; |
50 net::URLRequestContextGetter* RequestContext() const override; | 53 net::URLRequestContextGetter* RequestContext() const override; |
51 scoped_refptr<update_client::OutOfProcessPatcher> CreateOutOfProcessPatcher() | 54 scoped_refptr<update_client::OutOfProcessPatcher> CreateOutOfProcessPatcher() |
52 const override; | 55 const override; |
53 bool DeltasEnabled() const override; | 56 bool DeltasEnabled() const override; |
54 bool UseBackgroundDownloader() const override; | 57 bool UseBackgroundDownloader() const override; |
55 bool UseCupSigning() const override; | 58 bool UseCupSigning() const override; |
56 scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner() | 59 scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner() |
57 const override; | 60 const override; |
61 base::FilePath GetMetadataPath() const override; | |
58 | 62 |
59 private: | 63 private: |
60 friend class base::RefCountedThreadSafe<ChromeConfigurator>; | 64 friend class base::RefCountedThreadSafe<ChromeConfigurator>; |
61 | 65 |
62 ConfiguratorImpl configurator_impl_; | 66 ConfiguratorImpl configurator_impl_; |
63 | 67 |
64 ~ChromeConfigurator() override {} | 68 ~ChromeConfigurator() override {} |
65 }; | 69 }; |
66 | 70 |
67 // Allows the component updater to use non-encrypted communication with the | 71 // Allows the component updater to use non-encrypted communication with the |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
165 // imposes certain requirements for the code using the task runner, such as | 169 // imposes certain requirements for the code using the task runner, such as |
166 // not accessing any global browser state while the code is running. | 170 // not accessing any global browser state while the code is running. |
167 scoped_refptr<base::SequencedTaskRunner> | 171 scoped_refptr<base::SequencedTaskRunner> |
168 ChromeConfigurator::GetSequencedTaskRunner() const { | 172 ChromeConfigurator::GetSequencedTaskRunner() const { |
169 return content::BrowserThread::GetBlockingPool() | 173 return content::BrowserThread::GetBlockingPool() |
170 ->GetSequencedTaskRunnerWithShutdownBehavior( | 174 ->GetSequencedTaskRunnerWithShutdownBehavior( |
171 base::SequencedWorkerPool::GetSequenceToken(), | 175 base::SequencedWorkerPool::GetSequenceToken(), |
172 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN); | 176 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN); |
173 } | 177 } |
174 | 178 |
179 base::FilePath ChromeConfigurator::GetMetadataPath() const { | |
180 base::FilePath result; | |
181 CHECK(PathService::Get(chrome::DIR_USER_DATA, &result)); | |
Sorin Jianu
2016/04/07 04:03:19
Do we need to CHECK? Can we be fault tolerant? I d
waffles
2016/04/07 17:04:43
Done. In practice it won't matter because several
| |
182 return result.AppendASCII("component_metadata.json"); | |
183 } | |
184 | |
175 } // namespace | 185 } // namespace |
176 | 186 |
177 scoped_refptr<update_client::Configurator> | 187 scoped_refptr<update_client::Configurator> |
178 MakeChromeComponentUpdaterConfigurator( | 188 MakeChromeComponentUpdaterConfigurator( |
179 const base::CommandLine* cmdline, | 189 const base::CommandLine* cmdline, |
180 net::URLRequestContextGetter* context_getter) { | 190 net::URLRequestContextGetter* context_getter) { |
181 return new ChromeConfigurator(cmdline, context_getter); | 191 return new ChromeConfigurator(cmdline, context_getter); |
182 } | 192 } |
183 | 193 |
184 } // namespace component_updater | 194 } // namespace component_updater |
OLD | NEW |