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/threading/sequenced_worker_pool.h" | 11 #include "base/threading/sequenced_worker_pool.h" |
11 #include "base/version.h" | 12 #include "base/version.h" |
| 13 #if defined(OS_WIN) |
| 14 #include "base/win/win_util.h" |
| 15 #endif |
12 #include "chrome/browser/component_updater/component_patcher_operation_out_of_pr
ocess.h" | 16 #include "chrome/browser/component_updater/component_patcher_operation_out_of_pr
ocess.h" |
13 #include "chrome/browser/update_client/chrome_update_query_params_delegate.h" | 17 #include "chrome/browser/update_client/chrome_update_query_params_delegate.h" |
14 #include "chrome/common/channel_info.h" | 18 #include "chrome/common/channel_info.h" |
| 19 #if defined(OS_WIN) |
| 20 #include "chrome/installer/util/google_update_settings.h" |
| 21 #endif |
15 #include "components/component_updater/configurator_impl.h" | 22 #include "components/component_updater/configurator_impl.h" |
16 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
17 | 24 |
18 namespace component_updater { | 25 namespace component_updater { |
19 | 26 |
20 namespace { | 27 namespace { |
21 | 28 |
22 class ChromeConfigurator : public update_client::Configurator { | 29 class ChromeConfigurator : public update_client::Configurator { |
23 public: | 30 public: |
24 ChromeConfigurator(const base::CommandLine* cmdline, | 31 ChromeConfigurator(const base::CommandLine* cmdline, |
25 net::URLRequestContextGetter* url_request_getter); | 32 net::URLRequestContextGetter* url_request_getter); |
26 | 33 |
27 // update_client::Configurator overrides. | 34 // update_client::Configurator overrides. |
28 int InitialDelay() const override; | 35 int InitialDelay() const override; |
29 int NextCheckDelay() const override; | 36 int NextCheckDelay() const override; |
30 int StepDelay() const override; | 37 int StepDelay() const override; |
31 int OnDemandDelay() const override; | 38 int OnDemandDelay() const override; |
32 int UpdateDelay() const override; | 39 int UpdateDelay() const override; |
33 std::vector<GURL> UpdateUrl() const override; | 40 std::vector<GURL> UpdateUrl() const override; |
34 std::vector<GURL> PingUrl() const override; | 41 std::vector<GURL> PingUrl() const override; |
35 base::Version GetBrowserVersion() const override; | 42 base::Version GetBrowserVersion() const override; |
36 std::string GetChannel() const override; | 43 std::string GetChannel() const override; |
37 std::string GetLang() const override; | 44 std::string GetLang() const override; |
38 std::string GetOSLongName() const override; | 45 std::string GetOSLongName() const override; |
39 std::string ExtraRequestParams() const override; | 46 std::string ExtraRequestParams() const override; |
| 47 std::string GetDownloadPreference() const override; |
40 net::URLRequestContextGetter* RequestContext() const override; | 48 net::URLRequestContextGetter* RequestContext() const override; |
41 scoped_refptr<update_client::OutOfProcessPatcher> CreateOutOfProcessPatcher() | 49 scoped_refptr<update_client::OutOfProcessPatcher> CreateOutOfProcessPatcher() |
42 const override; | 50 const override; |
43 bool DeltasEnabled() const override; | 51 bool DeltasEnabled() const override; |
44 bool UseBackgroundDownloader() const override; | 52 bool UseBackgroundDownloader() const override; |
45 scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner() | 53 scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner() |
46 const override; | 54 const override; |
47 | 55 |
48 private: | 56 private: |
49 friend class base::RefCountedThreadSafe<ChromeConfigurator>; | 57 friend class base::RefCountedThreadSafe<ChromeConfigurator>; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 } | 107 } |
100 | 108 |
101 std::string ChromeConfigurator::GetOSLongName() const { | 109 std::string ChromeConfigurator::GetOSLongName() const { |
102 return configurator_impl_.GetOSLongName(); | 110 return configurator_impl_.GetOSLongName(); |
103 } | 111 } |
104 | 112 |
105 std::string ChromeConfigurator::ExtraRequestParams() const { | 113 std::string ChromeConfigurator::ExtraRequestParams() const { |
106 return configurator_impl_.ExtraRequestParams(); | 114 return configurator_impl_.ExtraRequestParams(); |
107 } | 115 } |
108 | 116 |
| 117 std::string ChromeConfigurator::GetDownloadPreference() const { |
| 118 #if defined(OS_WIN) |
| 119 // This group policy is supported only on Windows and only for computers |
| 120 // which are joined to a Windows domain. |
| 121 return base::win::IsEnrolledToDomain() |
| 122 ? base::SysWideToUTF8( |
| 123 GoogleUpdateSettings::GetDownloadPreference()) |
| 124 : std::string(""); |
| 125 #else |
| 126 return std::string(""); |
| 127 #endif |
| 128 } |
| 129 |
109 net::URLRequestContextGetter* ChromeConfigurator::RequestContext() const { | 130 net::URLRequestContextGetter* ChromeConfigurator::RequestContext() const { |
110 return configurator_impl_.RequestContext(); | 131 return configurator_impl_.RequestContext(); |
111 } | 132 } |
112 | 133 |
113 scoped_refptr<update_client::OutOfProcessPatcher> | 134 scoped_refptr<update_client::OutOfProcessPatcher> |
114 ChromeConfigurator::CreateOutOfProcessPatcher() const { | 135 ChromeConfigurator::CreateOutOfProcessPatcher() const { |
115 return make_scoped_refptr(new ChromeOutOfProcessPatcher); | 136 return make_scoped_refptr(new ChromeOutOfProcessPatcher); |
116 } | 137 } |
117 | 138 |
118 bool ChromeConfigurator::DeltasEnabled() const { | 139 bool ChromeConfigurator::DeltasEnabled() const { |
(...skipping 19 matching lines...) Expand all Loading... |
138 } // namespace | 159 } // namespace |
139 | 160 |
140 scoped_refptr<update_client::Configurator> | 161 scoped_refptr<update_client::Configurator> |
141 MakeChromeComponentUpdaterConfigurator( | 162 MakeChromeComponentUpdaterConfigurator( |
142 const base::CommandLine* cmdline, | 163 const base::CommandLine* cmdline, |
143 net::URLRequestContextGetter* context_getter) { | 164 net::URLRequestContextGetter* context_getter) { |
144 return new ChromeConfigurator(cmdline, context_getter); | 165 return new ChromeConfigurator(cmdline, context_getter); |
145 } | 166 } |
146 | 167 |
147 } // namespace component_updater | 168 } // namespace component_updater |
OLD | NEW |