| 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 <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 // Treat CDM invocations like JavaScript. | 215 // Treat CDM invocations like JavaScript. |
| 216 if (plugin.name == ASCIIToUTF16(kWidevineCdmPluginName)) { | 216 if (plugin.name == ASCIIToUTF16(kWidevineCdmPluginName)) { |
| 217 DCHECK(plugin.type == WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS); | 217 DCHECK(plugin.type == WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS); |
| 218 return true; | 218 return true; |
| 219 } | 219 } |
| 220 #endif // WIDEVINE_CDM_AVAILABLE | 220 #endif // WIDEVINE_CDM_AVAILABLE |
| 221 | 221 |
| 222 return false; | 222 return false; |
| 223 } | 223 } |
| 224 | 224 |
| 225 content::RenderView* GetRenderViewFromWebFrame(WebKit::WebFrame* webframe) { | |
| 226 if (!webframe) | |
| 227 return NULL; | |
| 228 WebKit::WebView* webview = webframe->view(); | |
| 229 if (!webview) | |
| 230 return NULL; | |
| 231 return content::RenderView::FromWebView(webview); | |
| 232 } | |
| 233 | |
| 234 } // namespace | 225 } // namespace |
| 235 | 226 |
| 236 namespace chrome { | 227 namespace chrome { |
| 237 | 228 |
| 238 ChromeContentRendererClient::ChromeContentRendererClient() { | 229 ChromeContentRendererClient::ChromeContentRendererClient() { |
| 239 g_current_client = this; | 230 g_current_client = this; |
| 240 } | 231 } |
| 241 | 232 |
| 242 ChromeContentRendererClient::~ChromeContentRendererClient() { | 233 ChromeContentRendererClient::~ChromeContentRendererClient() { |
| 243 g_current_client = NULL; | 234 g_current_client = NULL; |
| (...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 994 } | 985 } |
| 995 | 986 |
| 996 if (url.SchemeIs(chrome::kExtensionResourceScheme) && | 987 if (url.SchemeIs(chrome::kExtensionResourceScheme) && |
| 997 !extensions::ResourceRequestPolicy::CanRequestExtensionResourceScheme( | 988 !extensions::ResourceRequestPolicy::CanRequestExtensionResourceScheme( |
| 998 url, | 989 url, |
| 999 frame)) { | 990 frame)) { |
| 1000 *new_url = GURL(chrome::kExtensionResourceInvalidRequestURL); | 991 *new_url = GURL(chrome::kExtensionResourceInvalidRequestURL); |
| 1001 return true; | 992 return true; |
| 1002 } | 993 } |
| 1003 | 994 |
| 1004 const content::RenderView* render_view = GetRenderViewFromWebFrame(frame); | |
| 1005 if (SearchBox* search_box = SearchBox::Get(render_view)) { | |
| 1006 if (url.SchemeIs(chrome::kChromeSearchScheme) && | |
| 1007 url.host() == chrome::kChromeSearchSuggestionHost) { | |
| 1008 if (search_box->GenerateDataURLForSuggestionRequest(url, new_url)) | |
| 1009 return true; | |
| 1010 } | |
| 1011 } | |
| 1012 | |
| 1013 return false; | 995 return false; |
| 1014 } | 996 } |
| 1015 | 997 |
| 1016 bool ChromeContentRendererClient::ShouldPumpEventsDuringCookieMessage() { | 998 bool ChromeContentRendererClient::ShouldPumpEventsDuringCookieMessage() { |
| 1017 // We no longer pump messages, even under Chrome Frame. We rely on cookie | 999 // We no longer pump messages, even under Chrome Frame. We rely on cookie |
| 1018 // read requests handled by CF not putting up UI or causing other actions | 1000 // read requests handled by CF not putting up UI or causing other actions |
| 1019 // that would require us to pump messages. This fixes http://crbug.com/110090. | 1001 // that would require us to pump messages. This fixes http://crbug.com/110090. |
| 1020 return false; | 1002 return false; |
| 1021 } | 1003 } |
| 1022 | 1004 |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1233 | 1215 |
| 1234 for (size_t i = 0; i < request_os_file_handle_allowed_hosts_.size(); ++i) { | 1216 for (size_t i = 0; i < request_os_file_handle_allowed_hosts_.size(); ++i) { |
| 1235 if (MatchPattern(inner.host(), request_os_file_handle_allowed_hosts_[i])) | 1217 if (MatchPattern(inner.host(), request_os_file_handle_allowed_hosts_[i])) |
| 1236 return true; | 1218 return true; |
| 1237 } | 1219 } |
| 1238 | 1220 |
| 1239 return false; | 1221 return false; |
| 1240 } | 1222 } |
| 1241 | 1223 |
| 1242 } // namespace chrome | 1224 } // namespace chrome |
| OLD | NEW |