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

Unified 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: Cleaning up headers. Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/download/url_downloader.h
diff --git a/content/browser/download/url_downloader.h b/content/browser/download/url_downloader.h
new file mode 100644
index 0000000000000000000000000000000000000000..25fe0f2778ba42a22baecd98b951f959ba8bb77d
--- /dev/null
+++ b/content/browser/download/url_downloader.h
@@ -0,0 +1,60 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_DOWNLOAD_URL_DOWNLOADER_H_
+#define CONTENT_BROWSER_DOWNLOAD_URL_DOWNLOADER_H_
+
+#include "base/memory/linked_ptr.h"
+#include "base/memory/scoped_ptr.h"
+#include "content/browser/loader/resource_handler.h"
+#include "content/public/browser/download_save_info.h"
+#include "content/public/browser/download_url_parameters.h"
+#include "content/public/common/referrer.h"
+#include "net/url_request/url_request.h"
+
+namespace content {
+class DownloadManager;
+class ResourceContext;
+
+class UrlDownloader : public net::URLRequest::Delegate {
+ public:
+ UrlDownloader(scoped_ptr<net::URLRequest> request,
+ scoped_ptr<ResourceHandler> handler);
+ ~UrlDownloader() override;
+
+ static DownloadInterruptReason BeginDownload(
+ DownloadManager* download_manager,
+ scoped_ptr<net::URLRequest> request,
+ const Referrer& referrer,
+ bool is_content_initiated,
+ ResourceContext* context,
+ bool prefer_cache,
+ bool do_not_prompt_for_login,
+ scoped_ptr<DownloadSaveInfo> save_info,
+ uint32 download_id,
+ const DownloadUrlParameters::OnStartedCallback& started_callback);
+
+ void OnResponseStarted(net::URLRequest* request) override;
asanka 2015/11/20 19:57:46 Add a comment noting that this is the URLRequest::
svaldez 2015/11/23 15:18:57 Done.
+
+ void OnReadCompleted(net::URLRequest* request, int bytes_read) override;
asanka 2015/11/20 19:57:46 We should also deal with OnReceivedRedirect() and
svaldez 2015/11/23 15:18:57 Done.
+
+ void ResponseCompleted();
+ void StartReading(bool is_continuation);
+
+ void Start();
+
+ private:
+ scoped_ptr<net::URLRequest> request_;
+ scoped_ptr<ResourceHandler> handler_;
+
+ base::WeakPtrFactory<UrlDownloader> weak_ptr_factory_;
+};
+
+namespace {
+static std::vector<linked_ptr<content::UrlDownloader>> g_active_downloaders;
+}
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_DOWNLOAD_URL_DOWNLOADER_H_

Powered by Google App Engine
This is Rietveld 408576698