| 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 // Treat CDM invocations like JavaScript. | 216 // Treat CDM invocations like JavaScript. |
| 217 if (plugin.name == ASCIIToUTF16(kWidevineCdmPluginName)) { | 217 if (plugin.name == ASCIIToUTF16(kWidevineCdmPluginName)) { |
| 218 DCHECK(plugin.type == WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS); | 218 DCHECK(plugin.type == WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS); |
| 219 return true; | 219 return true; |
| 220 } | 220 } |
| 221 #endif // WIDEVINE_CDM_AVAILABLE | 221 #endif // WIDEVINE_CDM_AVAILABLE |
| 222 | 222 |
| 223 return false; | 223 return false; |
| 224 } | 224 } |
| 225 | 225 |
| 226 content::RenderView* GetRenderViewFromWebFrame(WebKit::WebFrame* webframe) { | |
| 227 if (!webframe) | |
| 228 return NULL; | |
| 229 WebKit::WebView* webview = webframe->view(); | |
| 230 if (!webview) | |
| 231 return NULL; | |
| 232 return content::RenderView::FromWebView(webview); | |
| 233 } | |
| 234 | |
| 235 } // namespace | 226 } // namespace |
| 236 | 227 |
| 237 namespace chrome { | 228 namespace chrome { |
| 238 | 229 |
| 239 ChromeContentRendererClient::ChromeContentRendererClient() { | 230 ChromeContentRendererClient::ChromeContentRendererClient() { |
| 240 g_current_client = this; | 231 g_current_client = this; |
| 241 } | 232 } |
| 242 | 233 |
| 243 ChromeContentRendererClient::~ChromeContentRendererClient() { | 234 ChromeContentRendererClient::~ChromeContentRendererClient() { |
| 244 g_current_client = NULL; | 235 g_current_client = NULL; |
| (...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1002 } | 993 } |
| 1003 | 994 |
| 1004 if (url.SchemeIs(chrome::kExtensionResourceScheme) && | 995 if (url.SchemeIs(chrome::kExtensionResourceScheme) && |
| 1005 !extensions::ResourceRequestPolicy::CanRequestExtensionResourceScheme( | 996 !extensions::ResourceRequestPolicy::CanRequestExtensionResourceScheme( |
| 1006 url, | 997 url, |
| 1007 frame)) { | 998 frame)) { |
| 1008 *new_url = GURL(chrome::kExtensionResourceInvalidRequestURL); | 999 *new_url = GURL(chrome::kExtensionResourceInvalidRequestURL); |
| 1009 return true; | 1000 return true; |
| 1010 } | 1001 } |
| 1011 | 1002 |
| 1012 const content::RenderView* render_view = GetRenderViewFromWebFrame(frame); | |
| 1013 if (SearchBox* search_box = SearchBox::Get(render_view)) { | |
| 1014 if (url.SchemeIs(chrome::kChromeSearchScheme) && | |
| 1015 url.host() == chrome::kChromeSearchSuggestionHost) { | |
| 1016 if (search_box->GenerateDataURLForSuggestionRequest(url, new_url)) | |
| 1017 return true; | |
| 1018 } | |
| 1019 } | |
| 1020 | |
| 1021 return false; | 1003 return false; |
| 1022 } | 1004 } |
| 1023 | 1005 |
| 1024 bool ChromeContentRendererClient::ShouldPumpEventsDuringCookieMessage() { | 1006 bool ChromeContentRendererClient::ShouldPumpEventsDuringCookieMessage() { |
| 1025 // We no longer pump messages, even under Chrome Frame. We rely on cookie | 1007 // We no longer pump messages, even under Chrome Frame. We rely on cookie |
| 1026 // read requests handled by CF not putting up UI or causing other actions | 1008 // read requests handled by CF not putting up UI or causing other actions |
| 1027 // that would require us to pump messages. This fixes http://crbug.com/110090. | 1009 // that would require us to pump messages. This fixes http://crbug.com/110090. |
| 1028 return false; | 1010 return false; |
| 1029 } | 1011 } |
| 1030 | 1012 |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1241 | 1223 |
| 1242 for (size_t i = 0; i < request_os_file_handle_allowed_hosts_.size(); ++i) { | 1224 for (size_t i = 0; i < request_os_file_handle_allowed_hosts_.size(); ++i) { |
| 1243 if (MatchPattern(inner.host(), request_os_file_handle_allowed_hosts_[i])) | 1225 if (MatchPattern(inner.host(), request_os_file_handle_allowed_hosts_[i])) |
| 1244 return true; | 1226 return true; |
| 1245 } | 1227 } |
| 1246 | 1228 |
| 1247 return false; | 1229 return false; |
| 1248 } | 1230 } |
| 1249 | 1231 |
| 1250 } // namespace chrome | 1232 } // namespace chrome |
| OLD | NEW |