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

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 Mock for GetBrowserContext. 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/linked_ptr.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h"
11 #include "content/browser/loader/resource_handler.h"
12 #include "content/public/browser/download_save_info.h"
13 #include "content/public/browser/download_url_parameters.h"
14 #include "content/public/common/referrer.h"
15 #include "net/url_request/redirect_info.h"
16 #include "net/url_request/url_request.h"
17
18 namespace content {
19 class DownloadManagerImpl;
20 class ResourceContext;
21
22 class UrlDownloader : public net::URLRequest::Delegate {
23 public:
24 UrlDownloader(scoped_ptr<net::URLRequest> request,
25 scoped_ptr<ResourceHandler> handler);
26 ~UrlDownloader() override;
27
28 static DownloadInterruptReason BeginDownload(
29 base::WeakPtr<DownloadManagerImpl> download_manager,
30 scoped_ptr<net::URLRequest> request,
31 const Referrer& referrer,
32 bool is_content_initiated,
33 ResourceContext* context,
34 bool prefer_cache,
35 bool do_not_prompt_for_login,
36 scoped_ptr<DownloadSaveInfo> save_info,
37 uint32 download_id,
38 const DownloadUrlParameters::OnStartedCallback& started_callback);
39
40 // URLRequest::Delegate:
41 void OnReceivedRedirect(net::URLRequest* request,
42 const net::RedirectInfo& redirect_info,
43 bool* defer_redirect) override;
44 void OnResponseStarted(net::URLRequest* request) override;
45 void OnReadCompleted(net::URLRequest* request, int bytes_read) override;
46
47 void ResponseCompleted();
48 void StartReading(bool is_continuation);
49
50 void Start();
51
52 private:
53 scoped_ptr<net::URLRequest> request_;
54 scoped_ptr<ResourceHandler> handler_;
55
56 base::WeakPtrFactory<UrlDownloader> weak_ptr_factory_;
57 };
58
59 namespace {
60 static std::vector<linked_ptr<content::UrlDownloader>> g_active_downloaders;
61 }
62
63 } // namespace content
64
65 #endif // CONTENT_BROWSER_DOWNLOAD_URL_DOWNLOADER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698