summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-02 04:53:31 +0000
committereroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-02 04:53:31 +0000
commitafd832cff8b5c78906b6208a3cd5d2305b17a54f (patch)
tree3e303eaa2421fcffd2fdd5c393cb280deac8bcbe
parentaa6a3108baff4294383b7e8e7aaca974d99d64a5 (diff)
downloadchromium_src-afd832cff8b5c78906b6208a3cd5d2305b17a54f.zip
chromium_src-afd832cff8b5c78906b6208a3cd5d2305b17a54f.tar.gz
chromium_src-afd832cff8b5c78906b6208a3cd5d2305b17a54f.tar.bz2
Make all of the methods of ResourceHandler pure virtual.
This forces implementations to consider each case, and avoids subtle bugs that can happen by using the default no-op implementation (like bug 36964). BUG=None TEST=None Review URL: http://codereview.chromium.org/661236 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40358 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/extensions/user_script_listener_unittest.cc16
-rw-r--r--chrome/browser/renderer_host/async_resource_handler.cc9
-rw-r--r--chrome/browser/renderer_host/async_resource_handler.h2
-rw-r--r--chrome/browser/renderer_host/buffered_resource_handler.cc6
-rw-r--r--chrome/browser/renderer_host/buffered_resource_handler.h1
-rw-r--r--chrome/browser/renderer_host/cross_site_resource_handler.cc16
-rw-r--r--chrome/browser/renderer_host/cross_site_resource_handler.h3
-rw-r--r--chrome/browser/renderer_host/download_resource_handler.cc15
-rw-r--r--chrome/browser/renderer_host/download_resource_handler.h6
-rw-r--r--chrome/browser/renderer_host/download_throttling_resource_handler.cc13
-rw-r--r--chrome/browser/renderer_host/download_throttling_resource_handler.h2
-rw-r--r--chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc11
-rw-r--r--chrome/browser/renderer_host/resource_handler.h12
-rw-r--r--chrome/browser/renderer_host/resource_queue_unittest.cc15
-rw-r--r--chrome/browser/renderer_host/save_file_resource_handler.cc15
-rw-r--r--chrome/browser/renderer_host/save_file_resource_handler.h7
-rw-r--r--chrome/browser/renderer_host/sync_resource_handler.cc15
-rw-r--r--chrome/browser/renderer_host/sync_resource_handler.h3
-rw-r--r--chrome/browser/renderer_host/x509_user_cert_resource_handler.cc15
-rw-r--r--chrome/browser/renderer_host/x509_user_cert_resource_handler.h7
20 files changed, 179 insertions, 10 deletions
diff --git a/chrome/browser/extensions/user_script_listener_unittest.cc b/chrome/browser/extensions/user_script_listener_unittest.cc
index 79abdcf..cd9048c 100644
--- a/chrome/browser/extensions/user_script_listener_unittest.cc
+++ b/chrome/browser/extensions/user_script_listener_unittest.cc
@@ -33,6 +33,12 @@ class DummyResourceHandler : public ResourceHandler {
DummyResourceHandler() {
}
+ virtual bool OnUploadProgress(int request_id, uint64 position, uint64 size) {
+ NOTREACHED();
+ return true;
+ }
+
+
virtual bool OnRequestRedirected(int request_id, const GURL& url,
ResourceResponse* response,
bool* defer) {
@@ -46,6 +52,13 @@ class DummyResourceHandler : public ResourceHandler {
return true;
}
+ virtual bool OnWillStart(int request_id,
+ const GURL& url,
+ bool* defer) {
+ NOTREACHED();
+ return true;
+ }
+
virtual bool OnWillRead(int request_id,
net::IOBuffer** buf,
int* buf_size,
@@ -66,6 +79,9 @@ class DummyResourceHandler : public ResourceHandler {
return true;
}
+ virtual void OnRequestClosed() {
+ }
+
private:
DISALLOW_COPY_AND_ASSIGN(DummyResourceHandler);
};
diff --git a/chrome/browser/renderer_host/async_resource_handler.cc b/chrome/browser/renderer_host/async_resource_handler.cc
index da1a74e..4cc35bb 100644
--- a/chrome/browser/renderer_host/async_resource_handler.cc
+++ b/chrome/browser/renderer_host/async_resource_handler.cc
@@ -128,6 +128,12 @@ bool AsyncResourceHandler::OnResponseStarted(int request_id,
return true;
}
+bool AsyncResourceHandler::OnWillStart(int request_id,
+ const GURL& url,
+ bool* defer) {
+ return true;
+}
+
bool AsyncResourceHandler::OnWillRead(int request_id, net::IOBuffer** buf,
int* buf_size, int min_size) {
DCHECK(min_size == -1);
@@ -213,6 +219,9 @@ bool AsyncResourceHandler::OnResponseCompleted(
return true;
}
+void AsyncResourceHandler::OnRequestClosed() {
+}
+
// static
void AsyncResourceHandler::GlobalCleanup() {
if (g_spare_read_buffer) {
diff --git a/chrome/browser/renderer_host/async_resource_handler.h b/chrome/browser/renderer_host/async_resource_handler.h
index 6fb2a8f..9f11c42 100644
--- a/chrome/browser/renderer_host/async_resource_handler.h
+++ b/chrome/browser/renderer_host/async_resource_handler.h
@@ -29,12 +29,14 @@ class AsyncResourceHandler : public ResourceHandler {
bool OnRequestRedirected(int request_id, const GURL& new_url,
ResourceResponse* response, bool* defer);
bool OnResponseStarted(int request_id, ResourceResponse* response);
+ bool OnWillStart(int request_id, const GURL& url, bool* defer);
bool OnWillRead(int request_id, net::IOBuffer** buf, int* buf_size,
int min_size);
bool OnReadCompleted(int request_id, int* bytes_read);
bool OnResponseCompleted(int request_id,
const URLRequestStatus& status,
const std::string& security_info);
+ void OnRequestClosed();
static void GlobalCleanup();
diff --git a/chrome/browser/renderer_host/buffered_resource_handler.cc b/chrome/browser/renderer_host/buffered_resource_handler.cc
index a7d36af..c330dcc 100644
--- a/chrome/browser/renderer_host/buffered_resource_handler.cc
+++ b/chrome/browser/renderer_host/buffered_resource_handler.cc
@@ -99,6 +99,12 @@ void BufferedResourceHandler::OnRequestClosed() {
real_handler_->OnRequestClosed();
}
+bool BufferedResourceHandler::OnWillStart(int request_id,
+ const GURL& url,
+ bool* defer) {
+ return real_handler_->OnWillStart(request_id, url, defer);
+}
+
// We'll let the original event handler provide a buffer, and reuse it for
// subsequent reads until we're done buffering.
bool BufferedResourceHandler::OnWillRead(int request_id, net::IOBuffer** buf,
diff --git a/chrome/browser/renderer_host/buffered_resource_handler.h b/chrome/browser/renderer_host/buffered_resource_handler.h
index 6bc34e1..fd9ca85 100644
--- a/chrome/browser/renderer_host/buffered_resource_handler.h
+++ b/chrome/browser/renderer_host/buffered_resource_handler.h
@@ -25,6 +25,7 @@ class BufferedResourceHandler : public ResourceHandler {
bool OnRequestRedirected(int request_id, const GURL& new_url,
ResourceResponse* response, bool* defer);
bool OnResponseStarted(int request_id, ResourceResponse* response);
+ bool OnWillStart(int request_id, const GURL& url, bool* defer);
bool OnWillRead(int request_id, net::IOBuffer** buf, int* buf_size,
int min_size);
bool OnReadCompleted(int request_id, int* bytes_read);
diff --git a/chrome/browser/renderer_host/cross_site_resource_handler.cc b/chrome/browser/renderer_host/cross_site_resource_handler.cc
index 876547e..8a3c3bd 100644
--- a/chrome/browser/renderer_host/cross_site_resource_handler.cc
+++ b/chrome/browser/renderer_host/cross_site_resource_handler.cc
@@ -32,6 +32,12 @@ CrossSiteResourceHandler::CrossSiteResourceHandler(
response_(NULL),
rdh_(resource_dispatcher_host) {}
+bool CrossSiteResourceHandler::OnUploadProgress(int request_id,
+ uint64 position,
+ uint64 size) {
+ return next_handler_->OnUploadProgress(request_id, position, size);
+}
+
bool CrossSiteResourceHandler::OnRequestRedirected(int request_id,
const GURL& new_url,
ResourceResponse* response,
@@ -74,6 +80,12 @@ bool CrossSiteResourceHandler::OnResponseStarted(int request_id,
return true;
}
+bool CrossSiteResourceHandler::OnWillStart(int request_id,
+ const GURL& url,
+ bool* defer) {
+ return next_handler_->OnWillStart(request_id, url, defer);
+}
+
bool CrossSiteResourceHandler::OnWillRead(int request_id, net::IOBuffer** buf,
int* buf_size, int min_size) {
bool rv = next_handler_->OnWillRead(request_id, buf, buf_size, min_size);
@@ -134,6 +146,10 @@ bool CrossSiteResourceHandler::OnResponseCompleted(
return false;
}
+void CrossSiteResourceHandler::OnRequestClosed() {
+ next_handler_->OnRequestClosed();
+}
+
// We can now send the response to the new renderer, which will cause
// TabContents to swap in the new renderer and destroy the old one.
void CrossSiteResourceHandler::ResumeResponse() {
diff --git a/chrome/browser/renderer_host/cross_site_resource_handler.h b/chrome/browser/renderer_host/cross_site_resource_handler.h
index ddb289f..1b7d4bc 100644
--- a/chrome/browser/renderer_host/cross_site_resource_handler.h
+++ b/chrome/browser/renderer_host/cross_site_resource_handler.h
@@ -24,16 +24,19 @@ class CrossSiteResourceHandler : public ResourceHandler {
ResourceDispatcherHost* resource_dispatcher_host);
// ResourceHandler implementation:
+ bool OnUploadProgress(int request_id, uint64 position, uint64 size);
bool OnRequestRedirected(int request_id, const GURL& new_url,
ResourceResponse* response, bool* defer);
bool OnResponseStarted(int request_id,
ResourceResponse* response);
+ bool OnWillStart(int request_id, const GURL& url, bool* defer);
bool OnWillRead(int request_id, net::IOBuffer** buf, int* buf_size,
int min_size);
bool OnReadCompleted(int request_id, int* bytes_read);
bool OnResponseCompleted(int request_id,
const URLRequestStatus& status,
const std::string& security_info);
+ void OnRequestClosed();
// We can now send the response to the new renderer, which will cause
// TabContents to swap in the new renderer and destroy the old one.
diff --git a/chrome/browser/renderer_host/download_resource_handler.cc b/chrome/browser/renderer_host/download_resource_handler.cc
index e0aa870..fd134e3 100644
--- a/chrome/browser/renderer_host/download_resource_handler.cc
+++ b/chrome/browser/renderer_host/download_resource_handler.cc
@@ -38,6 +38,12 @@ DownloadResourceHandler::DownloadResourceHandler(
is_paused_(false) {
}
+bool DownloadResourceHandler::OnUploadProgress(int request_id,
+ uint64 position,
+ uint64 size) {
+ return true;
+}
+
// Not needed, as this event handler ought to be the final resource.
bool DownloadResourceHandler::OnRequestRedirected(int request_id,
const GURL& url,
@@ -82,6 +88,12 @@ bool DownloadResourceHandler::OnResponseStarted(int request_id,
return true;
}
+bool DownloadResourceHandler::OnWillStart(int request_id,
+ const GURL& url,
+ bool* defer) {
+ return true;
+}
+
// Create a new buffer, which will be handed to the download thread for file
// writing and deletion.
bool DownloadResourceHandler::OnWillRead(int request_id, net::IOBuffer** buf,
@@ -143,6 +155,9 @@ bool DownloadResourceHandler::OnResponseCompleted(
return true;
}
+void DownloadResourceHandler::OnRequestClosed() {
+}
+
// If the content-length header is not present (or contains something other
// than numbers), the incoming content_length is -1 (unknown size).
// Set the content length to 0 to indicate unknown size to DownloadManager.
diff --git a/chrome/browser/renderer_host/download_resource_handler.h b/chrome/browser/renderer_host/download_resource_handler.h
index bb8d9cd..aefa4a2 100644
--- a/chrome/browser/renderer_host/download_resource_handler.h
+++ b/chrome/browser/renderer_host/download_resource_handler.h
@@ -31,6 +31,8 @@ class DownloadResourceHandler : public ResourceHandler {
bool save_as,
const DownloadSaveInfo& save_info);
+ bool OnUploadProgress(int request_id, uint64 position, uint64 size);
+
// Not needed, as this event handler ought to be the final resource.
bool OnRequestRedirected(int request_id, const GURL& url,
ResourceResponse* response, bool* defer);
@@ -38,6 +40,9 @@ class DownloadResourceHandler : public ResourceHandler {
// Send the download creation information to the download thread.
bool OnResponseStarted(int request_id, ResourceResponse* response);
+ // Pass-through implementation.
+ bool OnWillStart(int request_id, const GURL& url, bool* defer);
+
// Create a new buffer, which will be handed to the download thread for file
// writing and deletion.
bool OnWillRead(int request_id, net::IOBuffer** buf, int* buf_size,
@@ -48,6 +53,7 @@ class DownloadResourceHandler : public ResourceHandler {
bool OnResponseCompleted(int request_id,
const URLRequestStatus& status,
const std::string& security_info);
+ void OnRequestClosed();
// If the content-length header is not present (or contains something other
// than numbers), the incoming content_length is -1 (unknown size).
diff --git a/chrome/browser/renderer_host/download_throttling_resource_handler.cc b/chrome/browser/renderer_host/download_throttling_resource_handler.cc
index 4609a4c..bec3358 100644
--- a/chrome/browser/renderer_host/download_throttling_resource_handler.cc
+++ b/chrome/browser/renderer_host/download_throttling_resource_handler.cc
@@ -65,6 +65,14 @@ bool DownloadThrottlingResourceHandler::OnResponseStarted(
return true;
}
+bool DownloadThrottlingResourceHandler::OnWillStart(int request_id,
+ const GURL& url,
+ bool* defer) {
+ if (download_handler_.get())
+ return download_handler_->OnWillStart(request_id, url, defer);
+ return true;
+}
+
bool DownloadThrottlingResourceHandler::OnWillRead(int request_id,
net::IOBuffer** buf,
int* buf_size,
@@ -125,6 +133,11 @@ bool DownloadThrottlingResourceHandler::OnResponseCompleted(
return true;
}
+void DownloadThrottlingResourceHandler::OnRequestClosed() {
+ if (download_handler_.get())
+ download_handler_->OnRequestClosed();
+}
+
void DownloadThrottlingResourceHandler::CancelDownload() {
host_->CancelRequest(render_process_host_id_, request_id_, false);
}
diff --git a/chrome/browser/renderer_host/download_throttling_resource_handler.h b/chrome/browser/renderer_host/download_throttling_resource_handler.h
index 3b04bd8..5fd0be6 100644
--- a/chrome/browser/renderer_host/download_throttling_resource_handler.h
+++ b/chrome/browser/renderer_host/download_throttling_resource_handler.h
@@ -42,12 +42,14 @@ class DownloadThrottlingResourceHandler
virtual bool OnRequestRedirected(int request_id, const GURL& url,
ResourceResponse* response, bool* defer);
virtual bool OnResponseStarted(int request_id, ResourceResponse* response);
+ virtual bool OnWillStart(int request_id, const GURL& url, bool* defer);
virtual bool OnWillRead(int request_id, net::IOBuffer** buf, int* buf_size,
int min_size);
virtual bool OnReadCompleted(int request_id, int* bytes_read);
virtual bool OnResponseCompleted(int request_id,
const URLRequestStatus& status,
const std::string& security_info);
+ virtual void OnRequestClosed();
// DownloadRequestManager::Callback implementation:
virtual void CancelDownload();
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc b/chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc
index 51d346d..7694d331 100644
--- a/chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc
+++ b/chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc
@@ -893,6 +893,11 @@ class DummyResourceHandler : public ResourceHandler {
public:
DummyResourceHandler() {}
+ // Called as upload progress is made.
+ bool OnUploadProgress(int request_id, uint64 position, uint64 size) {
+ return true;
+ }
+
bool OnRequestRedirected(int request_id, const GURL& url,
ResourceResponse* response, bool* defer) {
return true;
@@ -902,6 +907,10 @@ class DummyResourceHandler : public ResourceHandler {
return true;
}
+ bool OnWillStart(int request_id, const GURL& url, bool* defer) {
+ return true;
+ }
+
bool OnWillRead(
int request_id, net::IOBuffer** buf, int* buf_size, int min_size) {
return true;
@@ -914,6 +923,8 @@ class DummyResourceHandler : public ResourceHandler {
return true;
}
+ void OnRequestClosed() {}
+
private:
DISALLOW_COPY_AND_ASSIGN(DummyResourceHandler);
};
diff --git a/chrome/browser/renderer_host/resource_handler.h b/chrome/browser/renderer_host/resource_handler.h
index 2d6d797..ed99eaa 100644
--- a/chrome/browser/renderer_host/resource_handler.h
+++ b/chrome/browser/renderer_host/resource_handler.h
@@ -34,9 +34,7 @@ class ResourceHandler
// Called as upload progress is made.
virtual bool OnUploadProgress(int request_id,
uint64 position,
- uint64 size) {
- return true;
- }
+ uint64 size) = 0;
// The request was redirected to a new URL. |*defer| has an initial value of
// false. Set |*defer| to true to defer the redirect. The redirect may be
@@ -55,11 +53,7 @@ class ResourceHandler
// request from starting by setting |*defer = true|. A deferred request will
// not have called URLRequest::Start(), and will not resume until someone
// calls ResourceDispatcherHost::StartDeferredRequest().
- virtual bool OnWillStart(int request_id, const GURL& url, bool* defer) {
- // TODO(eroman): This should be a pure virtual method (no default
- // implementation).
- return true;
- }
+ virtual bool OnWillStart(int request_id, const GURL& url, bool* defer) = 0;
// Data will be read for the response. Upon success, this method places the
// size and address of the buffer where the data is to be written in its
@@ -83,7 +77,7 @@ class ResourceHandler
// Signals that the request is closed (i.e. finished successfully, cancelled).
// This is a signal that the associated URLRequest isn't valid anymore.
- virtual void OnRequestClosed() { }
+ virtual void OnRequestClosed() = 0;
protected:
friend class ChromeThread;
diff --git a/chrome/browser/renderer_host/resource_queue_unittest.cc b/chrome/browser/renderer_host/resource_queue_unittest.cc
index 4cc202c..2a6891d 100644
--- a/chrome/browser/renderer_host/resource_queue_unittest.cc
+++ b/chrome/browser/renderer_host/resource_queue_unittest.cc
@@ -21,6 +21,11 @@ class DummyResourceHandler : public ResourceHandler {
DummyResourceHandler() {
}
+ bool OnUploadProgress(int request_id, uint64 position, uint64 size) {
+ NOTREACHED();
+ return true;
+ }
+
virtual bool OnRequestRedirected(int request_id, const GURL& url,
ResourceResponse* response,
bool* defer) {
@@ -34,6 +39,11 @@ class DummyResourceHandler : public ResourceHandler {
return true;
}
+ virtual bool OnWillStart(int request_id, const GURL& url, bool* defer) {
+ NOTREACHED();
+ return true;
+ }
+
virtual bool OnWillRead(int request_id,
net::IOBuffer** buf,
int* buf_size,
@@ -54,6 +64,9 @@ class DummyResourceHandler : public ResourceHandler {
return true;
}
+ virtual void OnRequestClosed() {
+ }
+
private:
DISALLOW_COPY_AND_ASSIGN(DummyResourceHandler);
};
@@ -101,7 +114,7 @@ class NeverDelayingDelegate : public ResourceQueueDelegate {
class AlwaysDelayingDelegate : public ResourceQueueDelegate {
public:
- AlwaysDelayingDelegate(ResourceQueue* resource_queue)
+ explicit AlwaysDelayingDelegate(ResourceQueue* resource_queue)
: resource_queue_(resource_queue) {
}
diff --git a/chrome/browser/renderer_host/save_file_resource_handler.cc b/chrome/browser/renderer_host/save_file_resource_handler.cc
index c6f8de2..fe8aaf9 100644
--- a/chrome/browser/renderer_host/save_file_resource_handler.cc
+++ b/chrome/browser/renderer_host/save_file_resource_handler.cc
@@ -24,6 +24,12 @@ SaveFileResourceHandler::SaveFileResourceHandler(int render_process_host_id,
save_manager_(manager) {
}
+bool SaveFileResourceHandler::OnUploadProgress(int request_id,
+ uint64 position,
+ uint64 size) {
+ return true;
+}
+
bool SaveFileResourceHandler::OnRequestRedirected(int request_id,
const GURL& url,
ResourceResponse* response,
@@ -54,6 +60,12 @@ bool SaveFileResourceHandler::OnResponseStarted(int request_id,
return true;
}
+bool SaveFileResourceHandler::OnWillStart(int request_id,
+ const GURL& url,
+ bool* defer) {
+ return true;
+}
+
bool SaveFileResourceHandler::OnWillRead(int request_id, net::IOBuffer** buf,
int* buf_size, int min_size) {
DCHECK(buf && buf_size);
@@ -98,6 +110,9 @@ bool SaveFileResourceHandler::OnResponseCompleted(
return true;
}
+void SaveFileResourceHandler::OnRequestClosed() {
+}
+
void SaveFileResourceHandler::set_content_length(
const std::string& content_length) {
content_length_ = StringToInt64(content_length);
diff --git a/chrome/browser/renderer_host/save_file_resource_handler.h b/chrome/browser/renderer_host/save_file_resource_handler.h
index 825ad91..436e4df 100644
--- a/chrome/browser/renderer_host/save_file_resource_handler.h
+++ b/chrome/browser/renderer_host/save_file_resource_handler.h
@@ -20,6 +20,8 @@ class SaveFileResourceHandler : public ResourceHandler {
const GURL& url,
SaveFileManager* manager);
+ bool OnUploadProgress(int request_id, uint64 position, uint64 size);
+
// Saves the redirected URL to final_url_, we need to use the original
// URL to match original request.
bool OnRequestRedirected(int request_id, const GURL& url,
@@ -28,6 +30,9 @@ class SaveFileResourceHandler : public ResourceHandler {
// Sends the download creation information to the download thread.
bool OnResponseStarted(int request_id, ResourceResponse* response);
+ // Pass-through implementation.
+ bool OnWillStart(int request_id, const GURL& url, bool* defer);
+
// Creates a new buffer, which will be handed to the download thread for file
// writing and deletion.
bool OnWillRead(int request_id, net::IOBuffer** buf, int* buf_size,
@@ -40,6 +45,8 @@ class SaveFileResourceHandler : public ResourceHandler {
const URLRequestStatus& status,
const std::string& security_info);
+ void OnRequestClosed();
+
// If the content-length header is not present (or contains something other
// than numbers), StringToInt64 returns 0, which indicates 'unknown size' and
// is handled correctly by the SaveManager.
diff --git a/chrome/browser/renderer_host/sync_resource_handler.cc b/chrome/browser/renderer_host/sync_resource_handler.cc
index dd279a0..11d776b 100644
--- a/chrome/browser/renderer_host/sync_resource_handler.cc
+++ b/chrome/browser/renderer_host/sync_resource_handler.cc
@@ -25,6 +25,12 @@ SyncResourceHandler::~SyncResourceHandler() {
receiver_->Send(result_message_);
}
+bool SyncResourceHandler::OnUploadProgress(int request_id,
+ uint64 position,
+ uint64 size) {
+ return true;
+}
+
bool SyncResourceHandler::OnRequestRedirected(int request_id,
const GURL& new_url,
ResourceResponse* response,
@@ -49,6 +55,12 @@ bool SyncResourceHandler::OnResponseStarted(int request_id,
return true;
}
+bool SyncResourceHandler::OnWillStart(int request_id,
+ const GURL& url,
+ bool* defer) {
+ return true;
+}
+
bool SyncResourceHandler::OnWillRead(int request_id, net::IOBuffer** buf,
int* buf_size, int min_size) {
DCHECK(min_size == -1);
@@ -77,3 +89,6 @@ bool SyncResourceHandler::OnResponseCompleted(
result_message_ = NULL;
return true;
}
+
+void SyncResourceHandler::OnRequestClosed() {
+}
diff --git a/chrome/browser/renderer_host/sync_resource_handler.h b/chrome/browser/renderer_host/sync_resource_handler.h
index d15fe0d..683dd3d 100644
--- a/chrome/browser/renderer_host/sync_resource_handler.h
+++ b/chrome/browser/renderer_host/sync_resource_handler.h
@@ -20,15 +20,18 @@ class SyncResourceHandler : public ResourceHandler {
const GURL& url,
IPC::Message* result_message);
+ bool OnUploadProgress(int request_id, uint64 position, uint64 size);
bool OnRequestRedirected(int request_id, const GURL& new_url,
ResourceResponse* response, bool* defer);
bool OnResponseStarted(int request_id, ResourceResponse* response);
+ bool OnWillStart(int request_id, const GURL& url, bool* defer);
bool OnWillRead(int request_id, net::IOBuffer** buf, int* buf_size,
int min_size);
bool OnReadCompleted(int request_id, int* bytes_read);
bool OnResponseCompleted(int request_id,
const URLRequestStatus& status,
const std::string& security_info);
+ void OnRequestClosed();
private:
enum { kReadBufSize = 3840 };
diff --git a/chrome/browser/renderer_host/x509_user_cert_resource_handler.cc b/chrome/browser/renderer_host/x509_user_cert_resource_handler.cc
index abf5541..0c200a9 100644
--- a/chrome/browser/renderer_host/x509_user_cert_resource_handler.cc
+++ b/chrome/browser/renderer_host/x509_user_cert_resource_handler.cc
@@ -28,6 +28,12 @@ X509UserCertResourceHandler::X509UserCertResourceHandler(
resource_buffer_(NULL) {
}
+bool X509UserCertResourceHandler::OnUploadProgress(int request_id,
+ uint64 position,
+ uint64 size) {
+ return true;
+}
+
bool X509UserCertResourceHandler::OnRequestRedirected(int request_id,
const GURL& url,
ResourceResponse* resp,
@@ -41,6 +47,12 @@ bool X509UserCertResourceHandler::OnResponseStarted(int request_id,
return (resp->response_head.mime_type == "application/x-x509-user-cert");
}
+bool X509UserCertResourceHandler::OnWillStart(int request_id,
+ const GURL& url,
+ bool* defer) {
+ return true;
+}
+
bool X509UserCertResourceHandler::OnWillRead(int request_id,
net::IOBuffer** buf,
int* buf_size,
@@ -87,6 +99,9 @@ bool X509UserCertResourceHandler::OnResponseCompleted(
return cert_db->AddUserCert(resource_buffer_->data(), content_length_);
}
+void X509UserCertResourceHandler::OnRequestClosed() {
+}
+
void X509UserCertResourceHandler::AssembleResource() {
size_t bytes_copied = 0;
resource_buffer_ = new net::IOBuffer(content_length_);
diff --git a/chrome/browser/renderer_host/x509_user_cert_resource_handler.h b/chrome/browser/renderer_host/x509_user_cert_resource_handler.h
index a7bf5cd..7f6189a 100644
--- a/chrome/browser/renderer_host/x509_user_cert_resource_handler.h
+++ b/chrome/browser/renderer_host/x509_user_cert_resource_handler.h
@@ -20,6 +20,8 @@ class X509UserCertResourceHandler : public ResourceHandler {
X509UserCertResourceHandler(ResourceDispatcherHost* host,
URLRequest* request);
+ bool OnUploadProgress(int request_id, uint64 position, uint64 size);
+
// Not needed, as this event handler ought to be the final resource.
bool OnRequestRedirected(int request_id, const GURL& url,
ResourceResponse* resp, bool* defer);
@@ -27,6 +29,9 @@ class X509UserCertResourceHandler : public ResourceHandler {
// Check if this indeed an X509 cert.
bool OnResponseStarted(int request_id, ResourceResponse* resp);
+ // Pass-through implementation.
+ bool OnWillStart(int request_id, const GURL& url, bool* defer);
+
// Create a new buffer to store received data.
bool OnWillRead(int request_id, net::IOBuffer** buf, int* buf_size,
int min_size);
@@ -39,6 +44,8 @@ class X509UserCertResourceHandler : public ResourceHandler {
const URLRequestStatus& urs,
const std::string& sec_info);
+ void OnRequestClosed();
+
private:
~X509UserCertResourceHandler() {}