summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-04 20:17:39 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-04 20:17:39 +0000
commitcbe89c9bfb51c1bf577584d32df5d8b7a3c83159 (patch)
tree354e107d246dab86da1aca3f79ef11a9b318ea9e /content
parent59c4dd56e427e29eb26e81512c3066fe3f8b13b8 (diff)
downloadchromium_src-cbe89c9bfb51c1bf577584d32df5d8b7a3c83159.zip
chromium_src-cbe89c9bfb51c1bf577584d32df5d8b7a3c83159.tar.gz
chromium_src-cbe89c9bfb51c1bf577584d32df5d8b7a3c83159.tar.bz2
Get rid of the extension dependency in ResourceDispatcher by calling out to a webkit_glue function that can update the peer. No point sending the boolean flag from the browser since the same check is done in the renderer.
Review URL: http://codereview.chromium.org/6628006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76957 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/renderer_host/render_message_filter.cc14
-rw-r--r--content/browser/renderer_host/resource_dispatcher_host.cc22
-rw-r--r--content/browser/renderer_host/resource_dispatcher_host.h7
-rw-r--r--content/browser/renderer_host/resource_dispatcher_host_request_info.cc1
-rw-r--r--content/browser/renderer_host/resource_dispatcher_host_request_info.h11
-rw-r--r--content/browser/renderer_host/resource_dispatcher_host_unittest.cc23
6 files changed, 5 insertions, 73 deletions
diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc
index e7262bb..dcda00c 100644
--- a/content/browser/renderer_host/render_message_filter.cc
+++ b/content/browser/renderer_host/render_message_filter.cc
@@ -693,9 +693,7 @@ void RenderMessageFilter::OnGetPluginsOnFileThread(
std::vector<webkit::npapi::WebPluginInfo> plugins;
webkit::npapi::PluginList::Singleton()->GetEnabledPlugins(refresh, &plugins);
ViewHostMsg_GetPlugins::WriteReplyParams(reply_msg, plugins);
- BrowserThread::PostTask(
- BrowserThread::IO, FROM_HERE,
- NewRunnableMethod(this, &RenderMessageFilter::Send, reply_msg));
+ Send(reply_msg);
}
void RenderMessageFilter::OnGetPluginInfo(int routing_id,
@@ -1335,10 +1333,7 @@ void RenderMessageFilter::OnKeygenOnWorkerThread(
ViewHostMsg_Keygen::WriteReplyParams(
reply_msg,
keygen_handler.GenKeyAndSignChallenge());
-
- BrowserThread::PostTask(
- BrowserThread::IO, FROM_HERE,
- NewRunnableMethod(this, &RenderMessageFilter::Send, reply_msg));
+ Send(reply_msg);
}
#if defined(USE_TCMALLOC)
@@ -1393,10 +1388,7 @@ void RenderMessageFilter::OnGetExtensionMessageBundleOnFileThread(
ViewHostMsg_GetExtensionMessageBundle::WriteReplyParams(
reply_msg, dictionary_map);
-
- BrowserThread::PostTask(
- BrowserThread::IO, FROM_HERE,
- NewRunnableMethod(this, &RenderMessageFilter::Send, reply_msg));
+ Send(reply_msg);
}
void RenderMessageFilter::OnAsyncOpenFile(const IPC::Message& msg,
diff --git a/content/browser/renderer_host/resource_dispatcher_host.cc b/content/browser/renderer_host/resource_dispatcher_host.cc
index d3ad489..869c92d 100644
--- a/content/browser/renderer_host/resource_dispatcher_host.cc
+++ b/content/browser/renderer_host/resource_dispatcher_host.cc
@@ -165,15 +165,12 @@ bool ShouldServiceRequest(ChildProcessInfo::ProcessType process_type,
}
void PopulateResourceResponse(net::URLRequest* request,
- bool replace_extension_localization_templates,
ResourceResponse* response) {
response->response_head.status = request->status();
response->response_head.request_time = request->request_time();
response->response_head.response_time = request->response_time();
response->response_head.headers = request->response_headers();
request->GetCharset(&response->response_head.charset);
- response->response_head.replace_extension_localization_templates =
- replace_extension_localization_templates;
response->response_head.content_length = request->GetExpectedContentSize();
request->GetMimeType(&response->response_head.mime_type);
response->response_head.was_fetched_via_spdy =
@@ -521,8 +518,6 @@ void ResourceDispatcherHost::BeginRequest(
request_data.has_user_gesture,
request_data.host_renderer_id,
request_data.host_render_view_id);
- ApplyExtensionLocalizationFilter(request_data.url, request_data.resource_type,
- extra_info);
SetRequestInfo(request, extra_info); // Request takes ownership.
chrome_browser_net::SetOriginPIDForRequest(
request_data.origin_pid, request);
@@ -1026,8 +1021,7 @@ void ResourceDispatcherHost::OnReceivedRedirect(net::URLRequest* request,
}
scoped_refptr<ResourceResponse> response(new ResourceResponse);
- PopulateResourceResponse(request,
- info->replace_extension_localization_templates(), response);
+ PopulateResourceResponse(request, response);
if (!info->resource_handler()->OnRequestRedirected(info->request_id(),
new_url,
response, defer_redirect))
@@ -1152,8 +1146,7 @@ bool ResourceDispatcherHost::CompleteResponseStarted(net::URLRequest* request) {
ResourceDispatcherHostRequestInfo* info = InfoForRequest(request);
scoped_refptr<ResourceResponse> response(new ResourceResponse);
- PopulateResourceResponse(request,
- info->replace_extension_localization_templates(), response);
+ PopulateResourceResponse(request, response);
if (request->ssl_info().cert) {
int cert_id =
@@ -1875,17 +1868,6 @@ bool ResourceDispatcherHost::IsValidRequest(net::URLRequest* request) {
}
// static
-void ResourceDispatcherHost::ApplyExtensionLocalizationFilter(
- const GURL& url,
- const ResourceType::Type& resource_type,
- ResourceDispatcherHostRequestInfo* request_info) {
- // Apply filter to chrome extension CSS files.
- if (url.SchemeIs(chrome::kExtensionScheme) &&
- resource_type == ResourceType::STYLESHEET)
- request_info->set_replace_extension_localization_templates();
-}
-
-// static
net::RequestPriority ResourceDispatcherHost::DetermineRequestPriority(
ResourceType::Type type) {
// Determine request priority based on how critical this resource typically
diff --git a/content/browser/renderer_host/resource_dispatcher_host.h b/content/browser/renderer_host/resource_dispatcher_host.h
index fb78dcc..47dcb22 100644
--- a/content/browser/renderer_host/resource_dispatcher_host.h
+++ b/content/browser/renderer_host/resource_dispatcher_host.h
@@ -414,13 +414,6 @@ class ResourceDispatcherHost : public net::URLRequest::Delegate {
// Returns true if |request| is in |pending_requests_|.
bool IsValidRequest(net::URLRequest* request);
- // Sets replace_extension_localization_templates on all text/css requests that
- // have "chrome-extension://" scheme.
- static void ApplyExtensionLocalizationFilter(
- const GURL& url,
- const ResourceType::Type& resource_type,
- ResourceDispatcherHostRequestInfo* request_info);
-
// Determine request priority based on how critical this resource typically
// is to user-perceived page load performance.
static net::RequestPriority DetermineRequestPriority(ResourceType::Type type);
diff --git a/content/browser/renderer_host/resource_dispatcher_host_request_info.cc b/content/browser/renderer_host/resource_dispatcher_host_request_info.cc
index 695889e..14ff524 100644
--- a/content/browser/renderer_host/resource_dispatcher_host_request_info.cc
+++ b/content/browser/renderer_host/resource_dispatcher_host_request_info.cc
@@ -34,7 +34,6 @@ ResourceDispatcherHostRequestInfo::ResourceDispatcherHostRequestInfo(
has_user_gesture_(has_user_gesture),
pause_count_(0),
resource_type_(resource_type),
- replace_extension_localization_templates_(false),
last_load_state_(net::LOAD_STATE_IDLE),
upload_size_(upload_size),
last_upload_position_(0),
diff --git a/content/browser/renderer_host/resource_dispatcher_host_request_info.h b/content/browser/renderer_host/resource_dispatcher_host_request_info.h
index c05c4f9..2322c43 100644
--- a/content/browser/renderer_host/resource_dispatcher_host_request_info.h
+++ b/content/browser/renderer_host/resource_dispatcher_host_request_info.h
@@ -107,16 +107,6 @@ class ResourceDispatcherHostRequestInfo : public net::URLRequest::UserData {
// Identifies the type of resource, such as subframe, media, etc.
ResourceType::Type resource_type() const { return resource_type_; }
- // Whether we should apply a filter to this resource that replaces
- // localization templates with the appropriate localized strings. This is set
- // for CSS resources used by extensions.
- bool replace_extension_localization_templates() const {
- return replace_extension_localization_templates_;
- }
- void set_replace_extension_localization_templates() {
- replace_extension_localization_templates_ = true;
- }
-
// Returns the last updated state of the load. This is updated periodically
// by the ResourceDispatcherHost and tracked here so we don't send out
// unnecessary state change notifications.
@@ -211,7 +201,6 @@ class ResourceDispatcherHostRequestInfo : public net::URLRequest::UserData {
bool has_user_gesture_;
int pause_count_;
ResourceType::Type resource_type_;
- bool replace_extension_localization_templates_;
net::LoadState last_load_state_;
uint64 upload_size_;
uint64 last_upload_position_;
diff --git a/content/browser/renderer_host/resource_dispatcher_host_unittest.cc b/content/browser/renderer_host/resource_dispatcher_host_unittest.cc
index 0199b11..6c3813e 100644
--- a/content/browser/renderer_host/resource_dispatcher_host_unittest.cc
+++ b/content/browser/renderer_host/resource_dispatcher_host_unittest.cc
@@ -1001,26 +1001,3 @@ class ApplyExtensionLocalizationFilterTest : public testing::Test {
scoped_ptr<DummyResourceHandler> resource_handler_;
scoped_ptr<ResourceDispatcherHostRequestInfo> request_info_;
};
-
-TEST_F(ApplyExtensionLocalizationFilterTest, WrongScheme) {
- url_.reset(new GURL("html://behllobkkfkfnphdnhnkndlbkcpglgmj/popup.html"));
- ResourceDispatcherHost::ApplyExtensionLocalizationFilter(*url_,
- resource_type_, request_info_.get());
-
- EXPECT_FALSE(request_info_->replace_extension_localization_templates());
-}
-
-TEST_F(ApplyExtensionLocalizationFilterTest, GoodScheme) {
- ResourceDispatcherHost::ApplyExtensionLocalizationFilter(*url_,
- resource_type_, request_info_.get());
-
- EXPECT_TRUE(request_info_->replace_extension_localization_templates());
-}
-
-TEST_F(ApplyExtensionLocalizationFilterTest, GoodSchemeWrongResourceType) {
- resource_type_ = ResourceType::MAIN_FRAME;
- ResourceDispatcherHost::ApplyExtensionLocalizationFilter(*url_,
- resource_type_, request_info_.get());
-
- EXPECT_FALSE(request_info_->replace_extension_localization_templates());
-}