Chromium Code Reviews| 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/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "base/strings/string_number_conversions.h" | |
| 12 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 13 #include "base/values.h" | 14 #include "base/values.h" |
| 14 #include "chrome/common/child_process_logging.h" | 15 #include "chrome/common/child_process_logging.h" |
| 15 #include "chrome/common/chrome_content_client.h" | 16 #include "chrome/common/chrome_content_client.h" |
| 16 #include "chrome/common/chrome_paths.h" | 17 #include "chrome/common/chrome_paths.h" |
| 17 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
| 18 #include "chrome/common/content_settings_pattern.h" | 19 #include "chrome/common/content_settings_pattern.h" |
| 19 #include "chrome/common/extensions/chrome_manifest_handlers.h" | 20 #include "chrome/common/extensions/chrome_manifest_handlers.h" |
| 20 #include "chrome/common/extensions/extension.h" | 21 #include "chrome/common/extensions/extension.h" |
| 21 #include "chrome/common/extensions/extension_constants.h" | 22 #include "chrome/common/extensions/extension_constants.h" |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 194 // Treat CDM invocations like JavaScript. | 195 // Treat CDM invocations like JavaScript. |
| 195 if (plugin.name == ASCIIToUTF16(kWidevineCdmDisplayName)) { | 196 if (plugin.name == ASCIIToUTF16(kWidevineCdmDisplayName)) { |
| 196 DCHECK(plugin.type == WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS); | 197 DCHECK(plugin.type == WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS); |
| 197 return true; | 198 return true; |
| 198 } | 199 } |
| 199 #endif // WIDEVINE_CDM_AVAILABLE | 200 #endif // WIDEVINE_CDM_AVAILABLE |
| 200 | 201 |
| 201 return false; | 202 return false; |
| 202 } | 203 } |
| 203 | 204 |
| 205 content::RenderView* GetRenderViewFromWebFrame(WebKit::WebFrame* frame) { | |
|
jam
2013/06/05 16:36:01
nit: no need for this method. we know that frame i
kmadhusu
2013/06/05 18:40:39
Done.
| |
| 206 if (!frame) | |
| 207 return NULL; | |
| 208 | |
| 209 WebKit::WebView* view = frame->view(); | |
| 210 if (!view) | |
| 211 return NULL; | |
| 212 return content::RenderView::FromWebView(view); | |
| 213 } | |
| 214 | |
| 204 } // namespace | 215 } // namespace |
| 205 | 216 |
| 206 namespace chrome { | 217 namespace chrome { |
| 207 | 218 |
| 208 ChromeContentRendererClient::ChromeContentRendererClient() { | 219 ChromeContentRendererClient::ChromeContentRendererClient() { |
| 209 g_current_client = this; | 220 g_current_client = this; |
| 210 } | 221 } |
| 211 | 222 |
| 212 ChromeContentRendererClient::~ChromeContentRendererClient() { | 223 ChromeContentRendererClient::~ChromeContentRendererClient() { |
| 213 g_current_client = NULL; | 224 g_current_client = NULL; |
| (...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 985 } | 996 } |
| 986 | 997 |
| 987 if (url.SchemeIs(chrome::kExtensionResourceScheme) && | 998 if (url.SchemeIs(chrome::kExtensionResourceScheme) && |
| 988 !extensions::ResourceRequestPolicy::CanRequestExtensionResourceScheme( | 999 !extensions::ResourceRequestPolicy::CanRequestExtensionResourceScheme( |
| 989 url, | 1000 url, |
| 990 frame)) { | 1001 frame)) { |
| 991 *new_url = GURL(chrome::kExtensionResourceInvalidRequestURL); | 1002 *new_url = GURL(chrome::kExtensionResourceInvalidRequestURL); |
| 992 return true; | 1003 return true; |
| 993 } | 1004 } |
| 994 | 1005 |
| 1006 const content::RenderView* render_view = GetRenderViewFromWebFrame(frame); | |
| 1007 if (SearchBox* search_box = SearchBox::Get(render_view)) { | |
| 1008 if (url.SchemeIs(chrome::kChromeSearchScheme)) { | |
| 1009 if (url.host() == chrome::kChromeUIThumbnailHost) | |
| 1010 return search_box->GenerateThumbnailURLFromTransientURL(url, new_url); | |
| 1011 else if (url.host() == chrome::kChromeUIFaviconHost) | |
| 1012 return search_box->GenerateFaviconURLFromTransientURL(url, new_url); | |
| 1013 } | |
| 1014 } | |
| 1015 | |
| 995 return false; | 1016 return false; |
| 996 } | 1017 } |
| 997 | 1018 |
| 998 bool ChromeContentRendererClient::ShouldPumpEventsDuringCookieMessage() { | 1019 bool ChromeContentRendererClient::ShouldPumpEventsDuringCookieMessage() { |
| 999 // We no longer pump messages, even under Chrome Frame. We rely on cookie | 1020 // We no longer pump messages, even under Chrome Frame. We rely on cookie |
| 1000 // read requests handled by CF not putting up UI or causing other actions | 1021 // read requests handled by CF not putting up UI or causing other actions |
| 1001 // that would require us to pump messages. This fixes http://crbug.com/110090. | 1022 // that would require us to pump messages. This fixes http://crbug.com/110090. |
| 1002 return false; | 1023 return false; |
| 1003 } | 1024 } |
| 1004 | 1025 |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1194 | 1215 |
| 1195 if (container->element().shadowHost().isNull()) | 1216 if (container->element().shadowHost().isNull()) |
| 1196 return false; | 1217 return false; |
| 1197 | 1218 |
| 1198 WebString tag_name = container->element().shadowHost().tagName(); | 1219 WebString tag_name = container->element().shadowHost().tagName(); |
| 1199 return tag_name.equals(WebString::fromUTF8(kWebViewTagName)) || | 1220 return tag_name.equals(WebString::fromUTF8(kWebViewTagName)) || |
| 1200 tag_name.equals(WebString::fromUTF8(kAdViewTagName)); | 1221 tag_name.equals(WebString::fromUTF8(kAdViewTagName)); |
| 1201 } | 1222 } |
| 1202 | 1223 |
| 1203 } // namespace chrome | 1224 } // namespace chrome |
| OLD | NEW |