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

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

Issue 250383008: Refactor the interface for the CrxDownloader to take a callback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/url_fetcher_downloader.h" 5 #include "chrome/browser/component_updater/url_fetcher_downloader.h"
6 6
7 #include "chrome/browser/component_updater/component_updater_utils.h" 7 #include "chrome/browser/component_updater/component_updater_utils.h"
8 #include "content/public/browser/browser_thread.h" 8 #include "content/public/browser/browser_thread.h"
9 #include "net/base/load_flags.h" 9 #include "net/base/load_flags.h"
10 #include "net/url_request/url_fetcher.h" 10 #include "net/url_request/url_fetcher.h"
11 #include "url/gurl.h" 11 #include "url/gurl.h"
12 12
13 using content::BrowserThread; 13 using content::BrowserThread;
14 14
15 namespace component_updater { 15 namespace component_updater {
16 16
17 UrlFetcherDownloader::UrlFetcherDownloader( 17 UrlFetcherDownloader::UrlFetcherDownloader(
18 scoped_ptr<CrxDownloader> successor, 18 scoped_ptr<CrxDownloader> successor,
19 net::URLRequestContextGetter* context_getter, 19 net::URLRequestContextGetter* context_getter,
20 scoped_refptr<base::SequencedTaskRunner> task_runner, 20 scoped_refptr<base::SequencedTaskRunner> task_runner)
21 const DownloadCallback& download_callback) 21 : CrxDownloader(successor.Pass()),
22 : CrxDownloader(successor.Pass(), download_callback),
23 context_getter_(context_getter), 22 context_getter_(context_getter),
24 task_runner_(task_runner), 23 task_runner_(task_runner),
25 downloaded_bytes_(-1), 24 downloaded_bytes_(-1),
26 total_bytes_(-1) { 25 total_bytes_(-1) {
27 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 26 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
28 } 27 }
29 28
30 UrlFetcherDownloader::~UrlFetcherDownloader() {} 29 UrlFetcherDownloader::~UrlFetcherDownloader() {}
31 30
32 void UrlFetcherDownloader::DoStartDownload(const GURL& url) { 31 void UrlFetcherDownloader::DoStartDownload(const GURL& url) {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 const net::URLFetcher* source, 85 const net::URLFetcher* source,
87 int64 current, 86 int64 current,
88 int64 total) { 87 int64 total) {
89 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 88 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
90 downloaded_bytes_ = current; 89 downloaded_bytes_ = current;
91 total_bytes_ = total; 90 total_bytes_ = total;
92 } 91 }
93 92
94 } // namespace component_updater 93 } // namespace component_updater
95 94
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698