Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: chrome/browser/component_updater/component_updater_configurator.cc

Issue 385013002: Componentize component_updater: Replace content::BrowserThread usage with task runners (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove extraneous includes Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/component_updater_configurator.h" 5 #include "chrome/browser/component_updater/component_updater_configurator.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
14 #include "base/version.h" 14 #include "base/version.h"
15 #include "build/build_config.h" 15 #include "build/build_config.h"
16 #include "chrome/browser/omaha_query_params/chrome_omaha_query_params_delegate.h " 16 #include "chrome/browser/omaha_query_params/chrome_omaha_query_params_delegate.h "
17 #include "chrome/common/chrome_version_info.h" 17 #include "chrome/common/chrome_version_info.h"
18 #include "components/component_updater/component_updater_switches.h" 18 #include "components/component_updater/component_updater_switches.h"
19 #include "content/public/browser/browser_thread.h"
19 #include "net/url_request/url_request_context_getter.h" 20 #include "net/url_request/url_request_context_getter.h"
20 #include "url/gurl.h" 21 #include "url/gurl.h"
21 22
22 namespace component_updater { 23 namespace component_updater {
23 24
24 namespace { 25 namespace {
25 26
26 // Default time constants. 27 // Default time constants.
27 const int kDelayOneMinute = 60; 28 const int kDelayOneMinute = 60;
28 const int kDelayOneHour = kDelayOneMinute * 60; 29 const int kDelayOneHour = kDelayOneMinute * 60;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 virtual base::Version GetBrowserVersion() const OVERRIDE; 108 virtual base::Version GetBrowserVersion() const OVERRIDE;
108 virtual std::string GetChannel() const OVERRIDE; 109 virtual std::string GetChannel() const OVERRIDE;
109 virtual std::string GetLang() const OVERRIDE; 110 virtual std::string GetLang() const OVERRIDE;
110 virtual std::string GetOSLongName() const OVERRIDE; 111 virtual std::string GetOSLongName() const OVERRIDE;
111 virtual std::string ExtraRequestParams() const OVERRIDE; 112 virtual std::string ExtraRequestParams() const OVERRIDE;
112 virtual size_t UrlSizeLimit() const OVERRIDE; 113 virtual size_t UrlSizeLimit() const OVERRIDE;
113 virtual net::URLRequestContextGetter* RequestContext() const OVERRIDE; 114 virtual net::URLRequestContextGetter* RequestContext() const OVERRIDE;
114 virtual bool InProcess() const OVERRIDE; 115 virtual bool InProcess() const OVERRIDE;
115 virtual bool DeltasEnabled() const OVERRIDE; 116 virtual bool DeltasEnabled() const OVERRIDE;
116 virtual bool UseBackgroundDownloader() const OVERRIDE; 117 virtual bool UseBackgroundDownloader() const OVERRIDE;
118 virtual scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner()
119 const OVERRIDE;
120 virtual scoped_refptr<base::SingleThreadTaskRunner>
121 GetSingleThreadTaskRunner() const OVERRIDE;
117 122
118 private: 123 private:
119 net::URLRequestContextGetter* url_request_getter_; 124 net::URLRequestContextGetter* url_request_getter_;
120 std::string extra_info_; 125 std::string extra_info_;
121 std::string url_source_; 126 std::string url_source_;
122 bool fast_update_; 127 bool fast_update_;
123 bool pings_enabled_; 128 bool pings_enabled_;
124 bool deltas_enabled_; 129 bool deltas_enabled_;
125 bool background_downloads_enabled_; 130 bool background_downloads_enabled_;
126 }; 131 };
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 } 228 }
224 229
225 bool ChromeConfigurator::DeltasEnabled() const { 230 bool ChromeConfigurator::DeltasEnabled() const {
226 return deltas_enabled_; 231 return deltas_enabled_;
227 } 232 }
228 233
229 bool ChromeConfigurator::UseBackgroundDownloader() const { 234 bool ChromeConfigurator::UseBackgroundDownloader() const {
230 return background_downloads_enabled_; 235 return background_downloads_enabled_;
231 } 236 }
232 237
238 scoped_refptr<base::SequencedTaskRunner>
239 ChromeConfigurator::GetSequencedTaskRunner() const {
240 return content::BrowserThread::GetBlockingPool()
241 ->GetSequencedTaskRunnerWithShutdownBehavior(
242 content::BrowserThread::GetBlockingPool()->GetSequenceToken(),
243 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN);
244 }
245
246 scoped_refptr<base::SingleThreadTaskRunner>
247 ChromeConfigurator::GetSingleThreadTaskRunner() const {
248 return content::BrowserThread::GetMessageLoopProxyForThread(
249 content::BrowserThread::FILE);
250 }
251
233 Configurator* MakeChromeComponentUpdaterConfigurator( 252 Configurator* MakeChromeComponentUpdaterConfigurator(
234 const base::CommandLine* cmdline, 253 const base::CommandLine* cmdline,
235 net::URLRequestContextGetter* context_getter) { 254 net::URLRequestContextGetter* context_getter) {
236 return new ChromeConfigurator(cmdline, context_getter); 255 return new ChromeConfigurator(cmdline, context_getter);
237 } 256 }
238 257
239 } // namespace component_updater 258 } // namespace component_updater
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698