Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: chrome/browser/renderer_host/async_resource_handler.cc

Issue 1744003: Send content settings based on the URL to the renderer instead of just the host. (Closed)
Patch Set: nits Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/renderer_host/async_resource_handler.h" 5 #include "chrome/browser/renderer_host/async_resource_handler.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/process.h" 8 #include "base/process.h"
9 #include "base/shared_memory.h" 9 #include "base/shared_memory.h"
10 #include "chrome/browser/net/chrome_url_request_context.h" 10 #include "chrome/browser/net/chrome_url_request_context.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 // For changes to the main frame, inform the renderer of the new URL's 103 // For changes to the main frame, inform the renderer of the new URL's
104 // per-host settings before the request actually commits. This way the 104 // per-host settings before the request actually commits. This way the
105 // renderer will be able to set these precisely at the time the 105 // renderer will be able to set these precisely at the time the
106 // request commits, avoiding the possibility of e.g. zooming the old content 106 // request commits, avoiding the possibility of e.g. zooming the old content
107 // or of having to layout the new content twice. 107 // or of having to layout the new content twice.
108 URLRequest* request = rdh_->GetURLRequest( 108 URLRequest* request = rdh_->GetURLRequest(
109 GlobalRequestID(process_id_, request_id)); 109 GlobalRequestID(process_id_, request_id));
110 ResourceDispatcherHostRequestInfo* info = rdh_->InfoForRequest(request); 110 ResourceDispatcherHostRequestInfo* info = rdh_->InfoForRequest(request);
111 if (info->resource_type() == ResourceType::MAIN_FRAME) { 111 if (info->resource_type() == ResourceType::MAIN_FRAME) {
112 GURL request_url(request->url()); 112 GURL request_url(request->url());
113 std::string host(request_url.host());
114 ChromeURLRequestContext* context = 113 ChromeURLRequestContext* context =
115 static_cast<ChromeURLRequestContext*>(request->context()); 114 static_cast<ChromeURLRequestContext*>(request->context());
116 if (!host.empty() && context) { 115 if (context) {
117 receiver_->Send(new ViewMsg_SetContentSettingsForLoadingHost( 116 receiver_->Send(new ViewMsg_SetContentSettingsForLoadingURL(
118 info->route_id(), host, 117 info->route_id(), request_url,
119 context->host_content_settings_map()->GetContentSettings( 118 context->host_content_settings_map()->GetContentSettings(
120 request_url))); 119 request_url)));
121 receiver_->Send(new ViewMsg_SetZoomLevelForLoadingHost(info->route_id(), 120 receiver_->Send(new ViewMsg_SetZoomLevelForLoadingURL(info->route_id(),
122 host, context->host_zoom_map()->GetZoomLevel(host))); 121 request_url, context->host_zoom_map()->GetZoomLevel(request_url)));
123 } 122 }
124 } 123 }
125 124
126 receiver_->Send(new ViewMsg_Resource_ReceivedResponse( 125 receiver_->Send(new ViewMsg_Resource_ReceivedResponse(
127 routing_id_, request_id, response->response_head)); 126 routing_id_, request_id, response->response_head));
128 return true; 127 return true;
129 } 128 }
130 129
131 bool AsyncResourceHandler::OnWillStart(int request_id, 130 bool AsyncResourceHandler::OnWillStart(int request_id,
132 const GURL& url, 131 const GURL& url,
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 223
225 // static 224 // static
226 void AsyncResourceHandler::GlobalCleanup() { 225 void AsyncResourceHandler::GlobalCleanup() {
227 if (g_spare_read_buffer) { 226 if (g_spare_read_buffer) {
228 // Avoid the CHECK in SharedIOBuffer::~SharedIOBuffer(). 227 // Avoid the CHECK in SharedIOBuffer::~SharedIOBuffer().
229 SharedIOBuffer* tmp = g_spare_read_buffer; 228 SharedIOBuffer* tmp = g_spare_read_buffer;
230 g_spare_read_buffer = NULL; 229 g_spare_read_buffer = NULL;
231 tmp->Release(); 230 tmp->Release();
232 } 231 }
233 } 232 }
OLDNEW
« no previous file with comments | « chrome/browser/host_zoom_map_unittest.cc ('k') | chrome/browser/renderer_host/resource_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698