| 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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 // Treat CDM invocations like JavaScript. | 214 // Treat CDM invocations like JavaScript. |
| 215 if (plugin.name == ASCIIToUTF16(kWidevineCdmPluginName)) { | 215 if (plugin.name == ASCIIToUTF16(kWidevineCdmPluginName)) { |
| 216 DCHECK(plugin.type == WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS); | 216 DCHECK(plugin.type == WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS); |
| 217 return true; | 217 return true; |
| 218 } | 218 } |
| 219 #endif // WIDEVINE_CDM_AVAILABLE | 219 #endif // WIDEVINE_CDM_AVAILABLE |
| 220 | 220 |
| 221 return false; | 221 return false; |
| 222 } | 222 } |
| 223 | 223 |
| 224 content::RenderView* GetRenderViewFromWebFrame(WebKit::WebFrame* webframe) { | |
| 225 if (!webframe) | |
| 226 return NULL; | |
| 227 WebKit::WebView* webview = webframe->view(); | |
| 228 if (!webview) | |
| 229 return NULL; | |
| 230 return content::RenderView::FromWebView(webview); | |
| 231 } | |
| 232 | |
| 233 } // namespace | 224 } // namespace |
| 234 | 225 |
| 235 namespace chrome { | 226 namespace chrome { |
| 236 | 227 |
| 237 ChromeContentRendererClient::ChromeContentRendererClient() { | 228 ChromeContentRendererClient::ChromeContentRendererClient() { |
| 238 } | 229 } |
| 239 | 230 |
| 240 ChromeContentRendererClient::~ChromeContentRendererClient() { | 231 ChromeContentRendererClient::~ChromeContentRendererClient() { |
| 241 } | 232 } |
| 242 | 233 |
| (...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 997 } | 988 } |
| 998 | 989 |
| 999 if (url.SchemeIs(chrome::kExtensionResourceScheme) && | 990 if (url.SchemeIs(chrome::kExtensionResourceScheme) && |
| 1000 !extensions::ResourceRequestPolicy::CanRequestExtensionResourceScheme( | 991 !extensions::ResourceRequestPolicy::CanRequestExtensionResourceScheme( |
| 1001 url, | 992 url, |
| 1002 frame)) { | 993 frame)) { |
| 1003 *new_url = GURL(chrome::kExtensionResourceInvalidRequestURL); | 994 *new_url = GURL(chrome::kExtensionResourceInvalidRequestURL); |
| 1004 return true; | 995 return true; |
| 1005 } | 996 } |
| 1006 | 997 |
| 1007 const content::RenderView* render_view = GetRenderViewFromWebFrame(frame); | 998 if (url.SchemeIs(chrome::kChromeSearchScheme) && |
| 1008 if (SearchBox* search_box = SearchBox::Get(render_view)) { | 999 url.host() == chrome::kChromeSearchSuggestionHost) { |
| 1009 if (url.SchemeIs(chrome::kChromeSearchScheme) && | 1000 GURL top_url(frame->top()->document().url()); |
| 1010 url.host() == chrome::kChromeSearchSuggestionHost) { | 1001 // Note that this replaces any existing query string parameters, including |
| 1011 if (search_box->GenerateDataURLForSuggestionRequest(url, new_url)) | 1002 // any existing &origin parameter. |
| 1012 return true; | 1003 GURL::Replacements set_origin; |
| 1013 } | 1004 std::string query_str = "origin="; |
| 1005 query_str.append(top_url.GetOrigin().spec()); |
| 1006 // Origin should not include a trailing slash. That is part of the path. |
| 1007 TrimString(query_str, "/", &query_str); |
| 1008 set_origin.SetQueryStr(query_str); |
| 1009 *new_url = url.ReplaceComponents(set_origin); |
| 1010 return true; |
| 1014 } | 1011 } |
| 1015 | 1012 |
| 1016 return false; | 1013 return false; |
| 1017 } | 1014 } |
| 1018 | 1015 |
| 1019 bool ChromeContentRendererClient::ShouldPumpEventsDuringCookieMessage() { | 1016 bool ChromeContentRendererClient::ShouldPumpEventsDuringCookieMessage() { |
| 1020 // We no longer pump messages, even under Chrome Frame. We rely on cookie | 1017 // We no longer pump messages, even under Chrome Frame. We rely on cookie |
| 1021 // read requests handled by CF not putting up UI or causing other actions | 1018 // read requests handled by CF not putting up UI or causing other actions |
| 1022 // that would require us to pump messages. This fixes http://crbug.com/110090. | 1019 // that would require us to pump messages. This fixes http://crbug.com/110090. |
| 1023 return false; | 1020 return false; |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1233 | 1230 |
| 1234 for (size_t i = 0; i < request_os_file_handle_allowed_hosts_.size(); ++i) { | 1231 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])) | 1232 if (MatchPattern(inner.host(), request_os_file_handle_allowed_hosts_[i])) |
| 1236 return true; | 1233 return true; |
| 1237 } | 1234 } |
| 1238 | 1235 |
| 1239 return false; | 1236 return false; |
| 1240 } | 1237 } |
| 1241 | 1238 |
| 1242 } // namespace chrome | 1239 } // namespace chrome |
| OLD | NEW |