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 |
| 18 #include "chrome/browser/browser_process.h" |
16 #include "chrome/browser/component_updater/component_patcher_operation_out_of_pr
ocess.h" | 19 #include "chrome/browser/component_updater/component_patcher_operation_out_of_pr
ocess.h" |
17 #include "chrome/browser/google/google_brand.h" | 20 #include "chrome/browser/google/google_brand.h" |
18 #include "chrome/browser/update_client/chrome_update_query_params_delegate.h" | 21 #include "chrome/browser/update_client/chrome_update_query_params_delegate.h" |
19 #include "chrome/common/channel_info.h" | 22 #include "chrome/common/channel_info.h" |
| 23 #include "chrome/common/chrome_paths.h" |
20 #if defined(OS_WIN) | 24 #if defined(OS_WIN) |
21 #include "chrome/installer/util/google_update_settings.h" | 25 #include "chrome/installer/util/google_update_settings.h" |
22 #endif | 26 #endif |
23 #include "components/component_updater/configurator_impl.h" | 27 #include "components/component_updater/configurator_impl.h" |
| 28 #include "components/prefs/pref_service.h" |
24 #include "content/public/browser/browser_thread.h" | 29 #include "content/public/browser/browser_thread.h" |
25 | 30 |
26 namespace component_updater { | 31 namespace component_updater { |
27 | 32 |
28 namespace { | 33 namespace { |
29 | 34 |
30 class ChromeConfigurator : public update_client::Configurator { | 35 class ChromeConfigurator : public update_client::Configurator { |
31 public: | 36 public: |
32 ChromeConfigurator(const base::CommandLine* cmdline, | 37 ChromeConfigurator(const base::CommandLine* cmdline, |
33 net::URLRequestContextGetter* url_request_getter); | 38 net::URLRequestContextGetter* url_request_getter); |
(...skipping 14 matching lines...) Expand all Loading... |
48 std::string ExtraRequestParams() const override; | 53 std::string ExtraRequestParams() const override; |
49 std::string GetDownloadPreference() const override; | 54 std::string GetDownloadPreference() const override; |
50 net::URLRequestContextGetter* RequestContext() const override; | 55 net::URLRequestContextGetter* RequestContext() const override; |
51 scoped_refptr<update_client::OutOfProcessPatcher> CreateOutOfProcessPatcher() | 56 scoped_refptr<update_client::OutOfProcessPatcher> CreateOutOfProcessPatcher() |
52 const override; | 57 const override; |
53 bool DeltasEnabled() const override; | 58 bool DeltasEnabled() const override; |
54 bool UseBackgroundDownloader() const override; | 59 bool UseBackgroundDownloader() const override; |
55 bool UseCupSigning() const override; | 60 bool UseCupSigning() const override; |
56 scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner() | 61 scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner() |
57 const override; | 62 const override; |
| 63 PrefService* GetPrefService() const override; |
58 | 64 |
59 private: | 65 private: |
60 friend class base::RefCountedThreadSafe<ChromeConfigurator>; | 66 friend class base::RefCountedThreadSafe<ChromeConfigurator>; |
61 | 67 |
62 ConfiguratorImpl configurator_impl_; | 68 ConfiguratorImpl configurator_impl_; |
63 | 69 |
64 ~ChromeConfigurator() override {} | 70 ~ChromeConfigurator() override {} |
65 }; | 71 }; |
66 | 72 |
67 // Allows the component updater to use non-encrypted communication with the | 73 // 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 | 171 // imposes certain requirements for the code using the task runner, such as |
166 // not accessing any global browser state while the code is running. | 172 // not accessing any global browser state while the code is running. |
167 scoped_refptr<base::SequencedTaskRunner> | 173 scoped_refptr<base::SequencedTaskRunner> |
168 ChromeConfigurator::GetSequencedTaskRunner() const { | 174 ChromeConfigurator::GetSequencedTaskRunner() const { |
169 return content::BrowserThread::GetBlockingPool() | 175 return content::BrowserThread::GetBlockingPool() |
170 ->GetSequencedTaskRunnerWithShutdownBehavior( | 176 ->GetSequencedTaskRunnerWithShutdownBehavior( |
171 base::SequencedWorkerPool::GetSequenceToken(), | 177 base::SequencedWorkerPool::GetSequenceToken(), |
172 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN); | 178 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN); |
173 } | 179 } |
174 | 180 |
| 181 PrefService* ChromeConfigurator::GetPrefService() const { |
| 182 return g_browser_process->local_state(); |
| 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 |