OLD | NEW |
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 #ifndef CHROME_BROWSER_COMPONENT_UPDATER_URL_FETCHER_DOWNLOADER_H_ | 5 #ifndef CHROME_BROWSER_COMPONENT_UPDATER_URL_FETCHER_DOWNLOADER_H_ |
6 #define CHROME_BROWSER_COMPONENT_UPDATER_URL_FETCHER_DOWNLOADER_H_ | 6 #define CHROME_BROWSER_COMPONENT_UPDATER_URL_FETCHER_DOWNLOADER_H_ |
7 | 7 |
8 #include "chrome/browser/component_updater/crx_downloader.h" | 8 #include "chrome/browser/component_updater/crx_downloader.h" |
9 #include "net/url_request/url_fetcher_delegate.h" | 9 #include "net/url_request/url_fetcher_delegate.h" |
10 | 10 |
11 namespace net { | 11 namespace net { |
12 class URLFetcher; | 12 class URLFetcher; |
13 } | 13 } |
14 | 14 |
15 namespace component_updater { | 15 namespace component_updater { |
16 | 16 |
17 // Implements a CRX downloader in top of the URLFetcher. | 17 // Implements a CRX downloader in top of the URLFetcher. |
18 class UrlFetcherDownloader : public CrxDownloader, | 18 class UrlFetcherDownloader : public CrxDownloader, |
19 public net::URLFetcherDelegate { | 19 public net::URLFetcherDelegate { |
20 protected: | 20 protected: |
21 friend class CrxDownloader; | 21 friend class CrxDownloader; |
22 UrlFetcherDownloader(net::URLRequestContextGetter* context_getter, | 22 UrlFetcherDownloader(scoped_ptr<CrxDownloader> successor, |
23 scoped_refptr<base::SequencedTaskRunner> task_runner); | 23 net::URLRequestContextGetter* context_getter, |
| 24 scoped_refptr<base::SequencedTaskRunner> task_runner, |
| 25 const DownloadCallback& download_callback); |
24 virtual ~UrlFetcherDownloader(); | 26 virtual ~UrlFetcherDownloader(); |
25 | 27 |
26 private: | 28 private: |
27 // Overrides for CrxDownloader. | 29 // Overrides for CrxDownloader. |
28 virtual void DoStartDownload(const GURL& url) OVERRIDE; | 30 virtual void DoStartDownload(const GURL& url) OVERRIDE; |
29 | 31 |
30 // Overrides for URLFetcherDelegate. | 32 // Overrides for URLFetcherDelegate. |
31 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; | 33 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; |
32 | 34 |
33 scoped_ptr<net::URLFetcher> url_fetcher_; | 35 scoped_ptr<net::URLFetcher> url_fetcher_; |
34 net::URLRequestContextGetter* context_getter_; | 36 net::URLRequestContextGetter* context_getter_; |
35 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 37 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
36 | 38 |
37 DISALLOW_COPY_AND_ASSIGN(UrlFetcherDownloader); | 39 DISALLOW_COPY_AND_ASSIGN(UrlFetcherDownloader); |
38 }; | 40 }; |
39 | 41 |
40 } // namespace component_updater | 42 } // namespace component_updater |
41 | 43 |
42 #endif // CHROME_BROWSER_COMPONENT_UPDATER_URL_FETCHER_DOWNLOADER_H_ | 44 #endif // CHROME_BROWSER_COMPONENT_UPDATER_URL_FETCHER_DOWNLOADER_H_ |
43 | 45 |
OLD | NEW |