diff options
author | cira@chromium.org <cira@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-11 00:20:09 +0000 |
---|---|---|
committer | cira@chromium.org <cira@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-11 00:20:09 +0000 |
commit | 1e07f78cf624f3ab8f14a21d80c8999595da21ea (patch) | |
tree | 41002a66bbe994cf56155696d309fbbc159c2d02 /chrome/common/resource_dispatcher.cc | |
parent | 9393b71775c7ea64004df0461d0564361bddd553 (diff) | |
download | chromium_src-1e07f78cf624f3ab8f14a21d80c8999595da21ea.zip chromium_src-1e07f78cf624f3ab8f14a21d80c8999595da21ea.tar.gz chromium_src-1e07f78cf624f3ab8f14a21d80c8999595da21ea.tar.bz2 |
Replace __MSG_some_name__ template within extension css files with localized messages.
We avoid replacing messages within html and js extension files for security reasons. Also, developers can already localize messages in html/js using chrome.i18n.getMessage calls.
TEST=Localize extension, try body{direction: __MSG_@@bidi_reversed_dir__;} in popup.css, while using non-rtl locale. Text should be alligned to the right (as if we were using rtl locale).
BUG=26144
Review URL: http://codereview.chromium.org/570007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38717 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/resource_dispatcher.cc')
-rw-r--r-- | chrome/common/resource_dispatcher.cc | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/chrome/common/resource_dispatcher.cc b/chrome/common/resource_dispatcher.cc index 8eb74a5..7cbb2a8 100644 --- a/chrome/common/resource_dispatcher.cc +++ b/chrome/common/resource_dispatcher.cc @@ -12,6 +12,7 @@ #include "base/message_loop.h" #include "base/shared_memory.h" #include "base/string_util.h" +#include "chrome/common/extensions/extension_message_filter_peer.h" #include "chrome/common/render_messages.h" #include "chrome/common/security_filter_peer.h" #include "net/base/net_errors.h" @@ -179,7 +180,8 @@ bool IPCResourceLoaderBridge::Start(Peer* peer) { peer_ = peer; // generate the request ID, and append it to the message - request_id_ = dispatcher_->AddPendingRequest(peer_, request_.resource_type); + request_id_ = dispatcher_->AddPendingRequest( + peer_, request_.resource_type, request_.url); return dispatcher_->message_sender()->Send( new ViewHostMsg_RequestResource(routing_id_, request_id_, request_)); @@ -330,18 +332,28 @@ void ResourceDispatcher::OnReceivedResponse( PendingRequestInfo& request_info = it->second; request_info.filter_policy = response_head.filter_policy; webkit_glue::ResourceLoaderBridge::Peer* peer = request_info.peer; - if (request_info.filter_policy != FilterPolicy::DONT_FILTER) { + webkit_glue::ResourceLoaderBridge::Peer* new_peer = NULL; + if (request_info.filter_policy == FilterPolicy::FILTER_EXTENSION_MESSAGES) { + new_peer = ExtensionMessageFilterPeer::CreateExtensionMessageFilterPeer( + peer, + message_sender(), + response_head.mime_type, + request_info.filter_policy, + request_info.url); + } else if (request_info.filter_policy != FilterPolicy::DONT_FILTER) { // TODO(jcampan): really pass the loader bridge. - webkit_glue::ResourceLoaderBridge::Peer* new_peer = - SecurityFilterPeer::CreateSecurityFilterPeer( - NULL, peer, - request_info.resource_type, response_head.mime_type, - request_info.filter_policy, - net::ERR_INSECURE_RESPONSE); - if (new_peer) { - request_info.peer = new_peer; - peer = new_peer; - } + new_peer = SecurityFilterPeer::CreateSecurityFilterPeer( + NULL, + peer, + request_info.resource_type, + response_head.mime_type, + request_info.filter_policy, + net::ERR_INSECURE_RESPONSE); + } + + if (new_peer) { + request_info.peer = new_peer; + peer = new_peer; } RESOURCE_LOG("Dispatching response for " << @@ -452,10 +464,12 @@ void ResourceDispatcher::OnRequestComplete(int request_id, int ResourceDispatcher::AddPendingRequest( webkit_glue::ResourceLoaderBridge::Peer* callback, - ResourceType::Type resource_type) { + ResourceType::Type resource_type, + const GURL& request_url) { // Compute a unique request_id for this renderer process. int id = MakeRequestID(); - pending_requests_[id] = PendingRequestInfo(callback, resource_type); + pending_requests_[id] = + PendingRequestInfo(callback, resource_type, request_url); return id; } |