| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/renderer/chrome_content_renderer_client.h" | 5 #include "chrome/renderer/chrome_content_renderer_client.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/debug/crash_logging.h" | 8 #include "base/debug/crash_logging.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1122 if (search_box && url.SchemeIs(chrome::kChromeSearchScheme)) { | 1122 if (search_box && url.SchemeIs(chrome::kChromeSearchScheme)) { |
| 1123 if (url.host() == chrome::kChromeUIThumbnailHost) | 1123 if (url.host() == chrome::kChromeUIThumbnailHost) |
| 1124 return search_box->GenerateThumbnailURLFromTransientURL(url, new_url); | 1124 return search_box->GenerateThumbnailURLFromTransientURL(url, new_url); |
| 1125 else if (url.host() == chrome::kChromeUIFaviconHost) | 1125 else if (url.host() == chrome::kChromeUIFaviconHost) |
| 1126 return search_box->GenerateFaviconURLFromTransientURL(url, new_url); | 1126 return search_box->GenerateFaviconURLFromTransientURL(url, new_url); |
| 1127 } | 1127 } |
| 1128 | 1128 |
| 1129 return false; | 1129 return false; |
| 1130 } | 1130 } |
| 1131 | 1131 |
| 1132 bool ChromeContentRendererClient::ShouldPumpEventsDuringCookieMessage() { | |
| 1133 // We no longer pump messages, even under Chrome Frame. We rely on cookie | |
| 1134 // read requests handled by CF not putting up UI or causing other actions | |
| 1135 // that would require us to pump messages. This fixes http://crbug.com/110090. | |
| 1136 return false; | |
| 1137 } | |
| 1138 | |
| 1139 void ChromeContentRendererClient::DidCreateScriptContext( | 1132 void ChromeContentRendererClient::DidCreateScriptContext( |
| 1140 WebFrame* frame, v8::Handle<v8::Context> context, int extension_group, | 1133 WebFrame* frame, v8::Handle<v8::Context> context, int extension_group, |
| 1141 int world_id) { | 1134 int world_id) { |
| 1142 extension_dispatcher_->DidCreateScriptContext( | 1135 extension_dispatcher_->DidCreateScriptContext( |
| 1143 frame, context, extension_group, world_id); | 1136 frame, context, extension_group, world_id); |
| 1144 } | 1137 } |
| 1145 | 1138 |
| 1146 void ChromeContentRendererClient::WillReleaseScriptContext( | 1139 void ChromeContentRendererClient::WillReleaseScriptContext( |
| 1147 WebFrame* frame, v8::Handle<v8::Context> context, int world_id) { | 1140 WebFrame* frame, v8::Handle<v8::Context> context, int world_id) { |
| 1148 extension_dispatcher_->WillReleaseScriptContext(frame, context, world_id); | 1141 extension_dispatcher_->WillReleaseScriptContext(frame, context, world_id); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1165 bool ChromeContentRendererClient::ShouldOverridePageVisibilityState( | 1158 bool ChromeContentRendererClient::ShouldOverridePageVisibilityState( |
| 1166 const content::RenderFrame* render_frame, | 1159 const content::RenderFrame* render_frame, |
| 1167 blink::WebPageVisibilityState* override_state) { | 1160 blink::WebPageVisibilityState* override_state) { |
| 1168 if (!prerender::PrerenderHelper::IsPrerendering(render_frame)) | 1161 if (!prerender::PrerenderHelper::IsPrerendering(render_frame)) |
| 1169 return false; | 1162 return false; |
| 1170 | 1163 |
| 1171 *override_state = blink::WebPageVisibilityStatePrerender; | 1164 *override_state = blink::WebPageVisibilityStatePrerender; |
| 1172 return true; | 1165 return true; |
| 1173 } | 1166 } |
| 1174 | 1167 |
| 1175 bool ChromeContentRendererClient::HandleGetCookieRequest( | |
| 1176 content::RenderView* sender, | |
| 1177 const GURL& url, | |
| 1178 const GURL& first_party_for_cookies, | |
| 1179 std::string* cookies) { | |
| 1180 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kChromeFrame)) { | |
| 1181 IPC::SyncMessage* msg = new ChromeViewHostMsg_GetCookies( | |
| 1182 MSG_ROUTING_NONE, url, first_party_for_cookies, cookies); | |
| 1183 sender->Send(msg); | |
| 1184 return true; | |
| 1185 } | |
| 1186 return false; | |
| 1187 } | |
| 1188 | |
| 1189 bool ChromeContentRendererClient::HandleSetCookieRequest( | |
| 1190 content::RenderView* sender, | |
| 1191 const GURL& url, | |
| 1192 const GURL& first_party_for_cookies, | |
| 1193 const std::string& value) { | |
| 1194 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kChromeFrame)) { | |
| 1195 sender->Send(new ChromeViewHostMsg_SetCookie( | |
| 1196 MSG_ROUTING_NONE, url, first_party_for_cookies, value)); | |
| 1197 return true; | |
| 1198 } | |
| 1199 return false; | |
| 1200 } | |
| 1201 | |
| 1202 void ChromeContentRendererClient::SetExtensionDispatcher( | 1168 void ChromeContentRendererClient::SetExtensionDispatcher( |
| 1203 extensions::Dispatcher* extension_dispatcher) { | 1169 extensions::Dispatcher* extension_dispatcher) { |
| 1204 extension_dispatcher_.reset(extension_dispatcher); | 1170 extension_dispatcher_.reset(extension_dispatcher); |
| 1205 permissions_policy_delegate_.reset( | 1171 permissions_policy_delegate_.reset( |
| 1206 new extensions::RendererPermissionsPolicyDelegate( | 1172 new extensions::RendererPermissionsPolicyDelegate( |
| 1207 extension_dispatcher_.get())); | 1173 extension_dispatcher_.get())); |
| 1208 } | 1174 } |
| 1209 | 1175 |
| 1210 bool ChromeContentRendererClient::CrossesExtensionExtents( | 1176 bool ChromeContentRendererClient::CrossesExtensionExtents( |
| 1211 WebFrame* frame, | 1177 WebFrame* frame, |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1387 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 1353 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 1388 return !command_line->HasSwitch(switches::kExtensionProcess); | 1354 return !command_line->HasSwitch(switches::kExtensionProcess); |
| 1389 } | 1355 } |
| 1390 | 1356 |
| 1391 blink::WebWorkerPermissionClientProxy* | 1357 blink::WebWorkerPermissionClientProxy* |
| 1392 ChromeContentRendererClient::CreateWorkerPermissionClientProxy( | 1358 ChromeContentRendererClient::CreateWorkerPermissionClientProxy( |
| 1393 content::RenderView* render_view, | 1359 content::RenderView* render_view, |
| 1394 blink::WebFrame* frame) { | 1360 blink::WebFrame* frame) { |
| 1395 return new WorkerPermissionClientProxy(render_view, frame); | 1361 return new WorkerPermissionClientProxy(render_view, frame); |
| 1396 } | 1362 } |
| OLD | NEW |