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/browser_process.h" |
17 #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" |
18 #include "chrome/browser/google/google_brand.h" | 18 #include "chrome/browser/google/google_brand.h" |
19 #include "chrome/browser/update_client/chrome_update_query_params_delegate.h" | 19 #include "chrome/browser/update_client/chrome_update_query_params_delegate.h" |
20 #include "chrome/common/channel_info.h" | 20 #include "chrome/common/channel_info.h" |
21 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
22 #if defined(OS_WIN) | 22 #if defined(OS_WIN) |
23 #include "chrome/installer/util/google_update_settings.h" | 23 #include "chrome/installer/util/google_update_settings.h" |
24 #endif | 24 #endif |
25 #include "components/component_updater/configurator_impl.h" | 25 #include "components/component_updater/configurator_impl.h" |
26 #include "components/prefs/pref_registry_simple.h" | 26 #include "components/prefs/pref_registry_simple.h" |
27 #include "components/prefs/pref_service.h" | 27 #include "components/prefs/pref_service.h" |
| 28 #include "components/update_client/update_query_params.h" |
28 #include "content/public/browser/browser_thread.h" | 29 #include "content/public/browser/browser_thread.h" |
29 | 30 |
30 namespace component_updater { | 31 namespace component_updater { |
31 | 32 |
32 namespace { | 33 namespace { |
33 | 34 |
34 class ChromeConfigurator : public update_client::Configurator { | 35 class ChromeConfigurator : public update_client::Configurator { |
35 public: | 36 public: |
36 ChromeConfigurator(const base::CommandLine* cmdline, | 37 ChromeConfigurator(const base::CommandLine* cmdline, |
37 net::URLRequestContextGetter* url_request_getter, | 38 net::URLRequestContextGetter* url_request_getter, |
38 PrefService* pref_service); | 39 PrefService* pref_service); |
39 | 40 |
40 // update_client::Configurator overrides. | 41 // update_client::Configurator overrides. |
41 int InitialDelay() const override; | 42 int InitialDelay() const override; |
42 int NextCheckDelay() const override; | 43 int NextCheckDelay() const override; |
43 int StepDelay() const override; | 44 int StepDelay() const override; |
44 int OnDemandDelay() const override; | 45 int OnDemandDelay() const override; |
45 int UpdateDelay() const override; | 46 int UpdateDelay() const override; |
46 std::vector<GURL> UpdateUrl() const override; | 47 std::vector<GURL> UpdateUrl() const override; |
47 std::vector<GURL> PingUrl() const override; | 48 std::vector<GURL> PingUrl() const override; |
| 49 std::string GetProdId() const override; |
48 base::Version GetBrowserVersion() const override; | 50 base::Version GetBrowserVersion() const override; |
49 std::string GetChannel() const override; | 51 std::string GetChannel() const override; |
50 std::string GetBrand() const override; | 52 std::string GetBrand() const override; |
51 std::string GetLang() const override; | 53 std::string GetLang() const override; |
52 std::string GetOSLongName() const override; | 54 std::string GetOSLongName() const override; |
53 std::string ExtraRequestParams() const override; | 55 std::string ExtraRequestParams() const override; |
54 std::string GetDownloadPreference() const override; | 56 std::string GetDownloadPreference() const override; |
55 net::URLRequestContextGetter* RequestContext() const override; | 57 net::URLRequestContextGetter* RequestContext() const override; |
56 scoped_refptr<update_client::OutOfProcessPatcher> CreateOutOfProcessPatcher() | 58 scoped_refptr<update_client::OutOfProcessPatcher> CreateOutOfProcessPatcher() |
57 const override; | 59 const override; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 } | 107 } |
106 | 108 |
107 std::vector<GURL> ChromeConfigurator::UpdateUrl() const { | 109 std::vector<GURL> ChromeConfigurator::UpdateUrl() const { |
108 return configurator_impl_.UpdateUrl(); | 110 return configurator_impl_.UpdateUrl(); |
109 } | 111 } |
110 | 112 |
111 std::vector<GURL> ChromeConfigurator::PingUrl() const { | 113 std::vector<GURL> ChromeConfigurator::PingUrl() const { |
112 return configurator_impl_.PingUrl(); | 114 return configurator_impl_.PingUrl(); |
113 } | 115 } |
114 | 116 |
| 117 std::string ChromeConfigurator::GetProdId() const { |
| 118 return update_client::UpdateQueryParams::GetProdIdString( |
| 119 update_client::UpdateQueryParams::ProdId::CHROME); |
| 120 } |
| 121 |
115 base::Version ChromeConfigurator::GetBrowserVersion() const { | 122 base::Version ChromeConfigurator::GetBrowserVersion() const { |
116 return configurator_impl_.GetBrowserVersion(); | 123 return configurator_impl_.GetBrowserVersion(); |
117 } | 124 } |
118 | 125 |
119 std::string ChromeConfigurator::GetChannel() const { | 126 std::string ChromeConfigurator::GetChannel() const { |
120 return chrome::GetChannelString(); | 127 return chrome::GetChannelString(); |
121 } | 128 } |
122 | 129 |
123 std::string ChromeConfigurator::GetBrand() const { | 130 std::string ChromeConfigurator::GetBrand() const { |
124 std::string brand; | 131 std::string brand; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 210 |
204 scoped_refptr<update_client::Configurator> | 211 scoped_refptr<update_client::Configurator> |
205 MakeChromeComponentUpdaterConfigurator( | 212 MakeChromeComponentUpdaterConfigurator( |
206 const base::CommandLine* cmdline, | 213 const base::CommandLine* cmdline, |
207 net::URLRequestContextGetter* context_getter, | 214 net::URLRequestContextGetter* context_getter, |
208 PrefService* pref_service) { | 215 PrefService* pref_service) { |
209 return new ChromeConfigurator(cmdline, context_getter, pref_service); | 216 return new ChromeConfigurator(cmdline, context_getter, pref_service); |
210 } | 217 } |
211 | 218 |
212 } // namespace component_updater | 219 } // namespace component_updater |
OLD | NEW |