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

Side by Side Diff: content/browser/download/url_downloader.h

Issue 1418663010: Adding WebContent-free Download (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing nits. Created 5 years 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
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_DOWNLOAD_URL_DOWNLOADER_H_
6 #define CONTENT_BROWSER_DOWNLOAD_URL_DOWNLOADER_H_
7
8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/weak_ptr.h"
10 #include "content/browser/download/download_request_core.h"
11 #include "content/public/browser/download_save_info.h"
12 #include "content/public/browser/download_url_parameters.h"
13 #include "content/public/common/referrer.h"
14 #include "net/url_request/redirect_info.h"
15 #include "net/url_request/url_request.h"
16
17 namespace content {
18 class DownloadManagerImpl;
19 class DownloadRequestCore;
20
21 class UrlDownloader : public net::URLRequest::Delegate {
22 public:
23 UrlDownloader(scoped_ptr<net::URLRequest> request,
24 scoped_ptr<DownloadRequestCore> handler,
25 base::WeakPtr<DownloadManagerImpl> manager);
26 ~UrlDownloader() override;
27
28 static scoped_ptr<UrlDownloader> BeginDownload(
29 base::WeakPtr<DownloadManagerImpl> download_manager,
30 scoped_ptr<net::URLRequest> request,
31 const Referrer& referrer,
32 bool is_content_initiated,
33 bool prefer_cache,
34 bool do_not_prompt_for_login,
35 scoped_ptr<DownloadSaveInfo> save_info,
36 uint32 download_id,
37 const DownloadUrlParameters::OnStartedCallback& started_callback);
38
39 // URLRequest::Delegate:
40 void OnReceivedRedirect(net::URLRequest* request,
41 const net::RedirectInfo& redirect_info,
42 bool* defer_redirect) override;
43 void OnResponseStarted(net::URLRequest* request) override;
44 void OnReadCompleted(net::URLRequest* request, int bytes_read) override;
45
46 void StartReading(bool is_continuation);
47 void ResponseCompleted();
48
49 void Start();
50 void ResumeReading();
51
52 private:
53 scoped_ptr<net::URLRequest> request_;
54 scoped_ptr<DownloadRequestCore> handler_;
55 base::WeakPtr<DownloadManagerImpl> manager_;
56
57 base::WeakPtrFactory<UrlDownloader> weak_ptr_factory_;
58 };
59
60 } // namespace content
61
62 #endif // CONTENT_BROWSER_DOWNLOAD_URL_DOWNLOADER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698