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

Unified Diff: chrome/browser/download/download_throttling_resource_handler.h

Issue 7660007: Factor out dependncy on download throttling from core download code. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/download/download_throttling_resource_handler.h
===================================================================
--- chrome/browser/download/download_throttling_resource_handler.h (revision 96872)
+++ chrome/browser/download/download_throttling_resource_handler.h (working copy)
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_RENDERER_HOST_DOWNLOAD_THROTTLING_RESOURCE_HANDLER_H_
-#define CHROME_BROWSER_RENDERER_HOST_DOWNLOAD_THROTTLING_RESOURCE_HANDLER_H_
+#ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_THROTTLING_RESOURCE_HANDLER_H_
+#define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_THROTTLING_RESOURCE_HANDLER_H_
#pragma once
#include <string>
@@ -24,14 +24,16 @@
// download and asks the DownloadRequestLimiter if the download should be
// allowed. The DownloadRequestLimiter notifies us asynchronously as to whether
// the download is allowed or not. If the download is allowed the request is
-// resumed, a DownloadResourceHandler is created and all EventHandler methods
-// are delegated to it. If the download is not allowed the request is canceled.
+// resumed, all EventHandler methods are delegated to it to the original
+// handler. If the download is not allowed the request is canceled.
class DownloadThrottlingResourceHandler
: public ResourceHandler,
public DownloadRequestLimiter::Callback {
public:
- DownloadThrottlingResourceHandler(ResourceDispatcherHost* host,
+ DownloadThrottlingResourceHandler(ResourceHandler* next_handler,
+ ResourceDispatcherHost* host,
+ DownloadRequestLimiter* limiter,
net::URLRequest* request,
const GURL& url,
int render_process_host_id,
@@ -71,10 +73,12 @@
int render_view_id_;
int request_id_;
- // Handles the actual download. This is only created if the download is
- // allowed to continue.
- scoped_refptr<DownloadResourceHandler> download_handler_;
+ // The original handler.
+ scoped_refptr<ResourceHandler> next_handler_;
+ // Set to true when we know that the request is allowed to start.
+ bool request_allowed_;
+
// Response supplied to OnResponseStarted. Only non-null if OnResponseStarted
// is invoked.
scoped_refptr<ResourceResponse> response_;
@@ -97,4 +101,4 @@
DISALLOW_COPY_AND_ASSIGN(DownloadThrottlingResourceHandler);
};
-#endif // CHROME_BROWSER_RENDERER_HOST_DOWNLOAD_THROTTLING_RESOURCE_HANDLER_H_
+#endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_THROTTLING_RESOURCE_HANDLER_H_

Powered by Google App Engine
This is Rietveld 408576698