diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-03 08:24:47 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-03 08:24:47 +0000 |
commit | ddf55bb8b0ced4209979730f71aa9643d5565304 (patch) | |
tree | d850f587aba1be19c3d9f698b2764ad8f2388ee7 /chrome/renderer/extensions | |
parent | 904cae4b8784cc1e9fec4b748f32dcb8e2e979cf (diff) | |
download | chromium_src-ddf55bb8b0ced4209979730f71aa9643d5565304.zip chromium_src-ddf55bb8b0ced4209979730f71aa9643d5565304.tar.gz chromium_src-ddf55bb8b0ced4209979730f71aa9643d5565304.tar.bz2 |
Extract Peer interface out of ResourceLoaderBridge.
This moves it into its own header file in
content/public/child/request_delegate_peer.h
As requested by John in -
https://codereview.chromium.org/186193005/diff/1/content/public/child/resource_loader_bridge.h#newcode133
BUG=265753,338338,237249
TEST=content_unittests, unit_tests
R=jam@chromium.org
TBR=darin
Review URL: https://codereview.chromium.org/218973002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@261323 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/extensions')
3 files changed, 27 insertions, 28 deletions
diff --git a/chrome/renderer/extensions/extension_localization_peer.cc b/chrome/renderer/extensions/extension_localization_peer.cc index 251bf80..84cb6a6 100644 --- a/chrome/renderer/extensions/extension_localization_peer.cc +++ b/chrome/renderer/extensions/extension_localization_peer.cc @@ -11,11 +11,12 @@ #include "extensions/common/constants.h" #include "extensions/common/extension_messages.h" #include "grit/generated_resources.h" +#include "ipc/ipc_sender.h" #include "net/base/net_errors.h" #include "net/http/http_response_headers.h" ExtensionLocalizationPeer::ExtensionLocalizationPeer( - webkit_glue::ResourceLoaderBridge::Peer* peer, + content::RequestPeer* peer, IPC::Sender* message_sender, const GURL& request_url) : original_peer_(peer), @@ -29,7 +30,7 @@ ExtensionLocalizationPeer::~ExtensionLocalizationPeer() { // static ExtensionLocalizationPeer* ExtensionLocalizationPeer::CreateExtensionLocalizationPeer( - webkit_glue::ResourceLoaderBridge::Peer* peer, + content::RequestPeer* peer, IPC::Sender* message_sender, const std::string& mime_type, const GURL& request_url) { diff --git a/chrome/renderer/extensions/extension_localization_peer.h b/chrome/renderer/extensions/extension_localization_peer.h index f4c71b6..43d4032 100644 --- a/chrome/renderer/extensions/extension_localization_peer.h +++ b/chrome/renderer/extensions/extension_localization_peer.h @@ -7,64 +7,63 @@ #include <string> -#include "ipc/ipc_sender.h" -#include "webkit/child/resource_loader_bridge.h" +#include "content/public/child/request_peer.h" #include "webkit/common/resource_response_info.h" +namespace IPC { +class Sender; +} + // The ExtensionLocalizationPeer is a proxy to a -// webkit_glue::ResourceLoaderBridge::Peer instance. It is used to pre-process +// content::RequestPeer instance. It is used to pre-process // CSS files requested by extensions to replace localization templates with the // appropriate localized strings. // // Call the factory method CreateExtensionLocalizationPeer() to obtain an // instance of ExtensionLocalizationPeer based on the original Peer. -class ExtensionLocalizationPeer - : public webkit_glue::ResourceLoaderBridge::Peer { +class ExtensionLocalizationPeer : public content::RequestPeer { public: virtual ~ExtensionLocalizationPeer(); static ExtensionLocalizationPeer* CreateExtensionLocalizationPeer( - webkit_glue::ResourceLoaderBridge::Peer* peer, + content::RequestPeer* peer, IPC::Sender* message_sender, const std::string& mime_type, const GURL& request_url); - // ResourceLoaderBridge::Peer methods. + // content::RequestPeer methods. virtual void OnUploadProgress(uint64 position, uint64 size) OVERRIDE; - virtual bool OnReceivedRedirect( - const GURL& new_url, - const webkit_glue::ResourceResponseInfo& info, - bool* has_new_first_party_for_cookies, - GURL* new_first_party_for_cookies) OVERRIDE; + virtual bool OnReceivedRedirect(const GURL& new_url, + const webkit_glue::ResourceResponseInfo& info, + bool* has_new_first_party_for_cookies, + GURL* new_first_party_for_cookies) OVERRIDE; virtual void OnReceivedResponse( const webkit_glue::ResourceResponseInfo& info) OVERRIDE; virtual void OnDownloadedData(int len, int encoded_data_length) OVERRIDE {} virtual void OnReceivedData(const char* data, int data_length, int encoded_data_length) OVERRIDE; - virtual void OnCompletedRequest( - int error_code, - bool was_ignored_by_handler, - bool stale_copy_in_cache, - const std::string& security_info, - const base::TimeTicks& completion_time, - int64 total_transfer_size) OVERRIDE; + virtual void OnCompletedRequest(int error_code, + bool was_ignored_by_handler, + bool stale_copy_in_cache, + const std::string& security_info, + const base::TimeTicks& completion_time, + int64 total_transfer_size) OVERRIDE; private: friend class ExtensionLocalizationPeerTest; // Use CreateExtensionLocalizationPeer to create an instance. - ExtensionLocalizationPeer( - webkit_glue::ResourceLoaderBridge::Peer* peer, - IPC::Sender* message_sender, - const GURL& request_url); + ExtensionLocalizationPeer(content::RequestPeer* peer, + IPC::Sender* message_sender, + const GURL& request_url); // Loads message catalogs, and replaces all __MSG_some_name__ templates within // loaded file. void ReplaceMessages(); // Original peer that handles the request once we are done processing data_. - webkit_glue::ResourceLoaderBridge::Peer* original_peer_; + content::RequestPeer* original_peer_; // We just pass though the response info. This holds the copy of the original. webkit_glue::ResourceResponseInfo response_info_; diff --git a/chrome/renderer/extensions/extension_localization_peer_unittest.cc b/chrome/renderer/extensions/extension_localization_peer_unittest.cc index 0eba97c..0ab36ba 100644 --- a/chrome/renderer/extensions/extension_localization_peer_unittest.cc +++ b/chrome/renderer/extensions/extension_localization_peer_unittest.cc @@ -50,8 +50,7 @@ class MockIpcMessageSender : public IPC::Sender { DISALLOW_COPY_AND_ASSIGN(MockIpcMessageSender); }; -class MockResourceLoaderBridgePeer - : public webkit_glue::ResourceLoaderBridge::Peer { +class MockResourceLoaderBridgePeer : public content::RequestPeer { public: MockResourceLoaderBridgePeer() {} virtual ~MockResourceLoaderBridgePeer() {} |