diff options
author | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-07 00:19:38 +0000 |
---|---|---|
committer | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-07 00:19:38 +0000 |
commit | 88e7d5688f95703ac9a6ddac4752098c407223e5 (patch) | |
tree | 9e10232d9348bf1e3c2f739cacfb06669dfdef64 /chrome/common | |
parent | a5ded246b87ab09ebcf770ffc5c157fb4efaddac (diff) | |
download | chromium_src-88e7d5688f95703ac9a6ddac4752098c407223e5.zip chromium_src-88e7d5688f95703ac9a6ddac4752098c407223e5.tar.gz chromium_src-88e7d5688f95703ac9a6ddac4752098c407223e5.tar.bz2 |
This CL adds a way to specify the security info when canceling a URLRequest.
This allows to tag a request on the renderer side with its security info. It is useful for the "frame info" dialog.
When showing that dialog for blocked frames, the security info can be retrieved and users can see the cert details for the blocked frame.
TEST=Open a page containing a frame served over bad HTTPS. The frame is blocked (replaced with a warning message). Right-click, select "Frame info". The dialog should have a "show cert" button which when pressed should show the frame's bad cert.
BUG=2853
Review URL: http://codereview.chromium.org/7276
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11179 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r-- | chrome/common/render_messages_internal.h | 5 | ||||
-rw-r--r-- | chrome/common/resource_dispatcher.cc | 5 | ||||
-rw-r--r-- | chrome/common/resource_dispatcher.h | 4 | ||||
-rw-r--r-- | chrome/common/resource_dispatcher_unittest.cc | 3 | ||||
-rw-r--r-- | chrome/common/security_filter_peer.cc | 16 | ||||
-rw-r--r-- | chrome/common/security_filter_peer.h | 9 |
6 files changed, 27 insertions, 15 deletions
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h index d8418e8..e0fd20c 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -193,9 +193,10 @@ IPC_BEGIN_MESSAGES(View) int /* data_len */) // Sent when the request has been completed. - IPC_MESSAGE_ROUTED2(ViewMsg_Resource_RequestComplete, + IPC_MESSAGE_ROUTED3(ViewMsg_Resource_RequestComplete, int /* request_id */, - URLRequestStatus /* status */) + URLRequestStatus /* status */, + std::string /* security info */) // Request for the renderer to evaluate an xpath to a frame and execute a // javascript: url in that frame's context. The message is completely diff --git a/chrome/common/resource_dispatcher.cc b/chrome/common/resource_dispatcher.cc index e9db613..76942ec 100644 --- a/chrome/common/resource_dispatcher.cc +++ b/chrome/common/resource_dispatcher.cc @@ -382,7 +382,8 @@ void ResourceDispatcher::OnReceivedRedirect(int request_id, } void ResourceDispatcher::OnRequestComplete(int request_id, - const URLRequestStatus& status) { + const URLRequestStatus& status, + const std::string& security_info) { PendingRequestList::iterator it = pending_requests_.find(request_id); if (it == pending_requests_.end()) { // this might happen for kill()ed requests on the webkit end, so perhaps @@ -414,7 +415,7 @@ void ResourceDispatcher::OnRequestComplete(int request_id, // The request ID will be removed from our pending list in the destructor. // Normally, dispatching this message causes the reference-counted request to // die immediately. - peer->OnCompletedRequest(status); + peer->OnCompletedRequest(status, security_info); webkit_glue::NotifyCacheStats(); } diff --git a/chrome/common/resource_dispatcher.h b/chrome/common/resource_dispatcher.h index a6b73d5..b4e7fb1 100644 --- a/chrome/common/resource_dispatcher.h +++ b/chrome/common/resource_dispatcher.h @@ -108,7 +108,9 @@ class ResourceDispatcher : public base::RefCounted<ResourceDispatcher> { void OnReceivedRedirect(int request_id, const GURL& new_url); void OnReceivedData(int request_id, base::SharedMemoryHandle data, int data_len); - void OnRequestComplete(int request_id, const URLRequestStatus& status); + void OnRequestComplete(int request_id, + const URLRequestStatus& status, + const std::string& security_info); // Dispatch the message to one of the message response handlers. void DispatchMessage(const IPC::Message& message); diff --git a/chrome/common/resource_dispatcher_unittest.cc b/chrome/common/resource_dispatcher_unittest.cc index 43628b8..e4c8792 100644 --- a/chrome/common/resource_dispatcher_unittest.cc +++ b/chrome/common/resource_dispatcher_unittest.cc @@ -44,7 +44,8 @@ class TestRequestCallback : public ResourceLoaderBridge::Peer { data_.append(data, len); } - virtual void OnCompletedRequest(const URLRequestStatus& status) { + virtual void OnCompletedRequest(const URLRequestStatus& status, + const std::string& security_info) { EXPECT_FALSE(complete_); complete_ = true; } diff --git a/chrome/common/security_filter_peer.cc b/chrome/common/security_filter_peer.cc index aef72ebb..30d6d1e 100644 --- a/chrome/common/security_filter_peer.cc +++ b/chrome/common/security_filter_peer.cc @@ -114,7 +114,8 @@ void SecurityFilterPeer::OnReceivedData(const char* data, int len) { NOTREACHED(); } -void SecurityFilterPeer::OnCompletedRequest(const URLRequestStatus& status) { +void SecurityFilterPeer::OnCompletedRequest(const URLRequestStatus& status, + const std::string& security_info) { NOTREACHED(); } @@ -175,7 +176,8 @@ void BufferedPeer::OnReceivedData(const char* data, int len) { data_.append(data, len); } -void BufferedPeer::OnCompletedRequest(const URLRequestStatus& status) { +void BufferedPeer::OnCompletedRequest(const URLRequestStatus& status, + const std::string& security_info) { // Make sure we delete ourselves at the end of this call. scoped_ptr<BufferedPeer> this_deleter(this); @@ -184,7 +186,7 @@ void BufferedPeer::OnCompletedRequest(const URLRequestStatus& status) { // Pretend we failed to load the resource. original_peer_->OnReceivedResponse(response_info_, true); URLRequestStatus status(URLRequestStatus::CANCELED, 0); - original_peer_->OnCompletedRequest(status); + original_peer_->OnCompletedRequest(status, security_info); return; } @@ -192,7 +194,7 @@ void BufferedPeer::OnCompletedRequest(const URLRequestStatus& status) { if (!data_.empty()) original_peer_->OnReceivedData(data_.data(), static_cast<int>(data_.size())); - original_peer_->OnCompletedRequest(status); + original_peer_->OnCompletedRequest(status, security_info); } //////////////////////////////////////////////////////////////////////////////// @@ -221,15 +223,17 @@ void ReplaceContentPeer::OnReceivedData(const char* data, int len) { // Ignore this, we'll serve some alternate content in OnCompletedRequest. } -void ReplaceContentPeer::OnCompletedRequest(const URLRequestStatus& status) { +void ReplaceContentPeer::OnCompletedRequest(const URLRequestStatus& status, + const std::string& security_info) { webkit_glue::ResourceLoaderBridge::ResponseInfo info; ProcessResponseInfo(info, &info, mime_type_); + info.security_info = security_info; info.content_length = static_cast<int>(data_.size()); original_peer_->OnReceivedResponse(info, true); if (!data_.empty()) original_peer_->OnReceivedData(data_.data(), static_cast<int>(data_.size())); - original_peer_->OnCompletedRequest(URLRequestStatus()); + original_peer_->OnCompletedRequest(URLRequestStatus(), security_info); // The request processing is complete, we must delete ourselves. delete this; diff --git a/chrome/common/security_filter_peer.h b/chrome/common/security_filter_peer.h index ef08426..816f9da 100644 --- a/chrome/common/security_filter_peer.h +++ b/chrome/common/security_filter_peer.h @@ -43,7 +43,8 @@ class SecurityFilterPeer : public webkit_glue::ResourceLoaderBridge::Peer { const webkit_glue::ResourceLoaderBridge::ResponseInfo& info, bool content_filtered); virtual void OnReceivedData(const char* data, int len); - virtual void OnCompletedRequest(const URLRequestStatus& status); + virtual void OnCompletedRequest(const URLRequestStatus& status, + const std::string& security_info); virtual std::string GetURLForDebugging(); protected: @@ -71,7 +72,8 @@ class BufferedPeer : public SecurityFilterPeer { const webkit_glue::ResourceLoaderBridge::ResponseInfo& info, bool content_filtered); virtual void OnReceivedData(const char* data, int len); - virtual void OnCompletedRequest(const URLRequestStatus& status); + virtual void OnCompletedRequest(const URLRequestStatus& status, + const std::string& security_info); protected: // Invoked when the entire request has been processed before the data is sent @@ -109,7 +111,8 @@ class ReplaceContentPeer : public SecurityFilterPeer { const webkit_glue::ResourceLoaderBridge::ResponseInfo& info, bool content_filtered); void OnReceivedData(const char* data, int len); - void OnCompletedRequest(const URLRequestStatus& status); + void OnCompletedRequest(const URLRequestStatus& status, + const std::string& security_info); private: webkit_glue::ResourceLoaderBridge::ResponseInfo response_info_; std::string mime_type_; |