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