Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(700)

Side by Side Diff: chrome/renderer/chrome_content_renderer_client.cc

Issue 13375003: Fixing iframe jank in the local omnibox popup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adding unit tests. Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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 SetOriginForSuggestionRequest(url, top_url, new_url);
1011 if (search_box->GenerateDataURLForSuggestionRequest(url, new_url)) 1002 return true;
1012 return true;
1013 }
1014 } 1003 }
1015 1004
1016 return false; 1005 return false;
1017 } 1006 }
1018 1007
1019 bool ChromeContentRendererClient::ShouldPumpEventsDuringCookieMessage() { 1008 bool ChromeContentRendererClient::ShouldPumpEventsDuringCookieMessage() {
1020 // We no longer pump messages, even under Chrome Frame. We rely on cookie 1009 // 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 1010 // 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. 1011 // that would require us to pump messages. This fixes http://crbug.com/110090.
1023 return false; 1012 return false;
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1232 } 1221 }
1233 1222
1234 for (size_t i = 0; i < request_os_file_handle_allowed_hosts_.size(); ++i) { 1223 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])) 1224 if (MatchPattern(inner.host(), request_os_file_handle_allowed_hosts_[i]))
1236 return true; 1225 return true;
1237 } 1226 }
1238 1227
1239 return false; 1228 return false;
1240 } 1229 }
1241 1230
1231 void ChromeContentRendererClient::SetOriginForSuggestionRequest(
1232 const GURL& url,
1233 const GURL& top_url,
1234 GURL *new_url) const {
1235 // Note that this replaces any existing query string parameters, including
1236 // any existing &origin parameter.
1237 GURL::Replacements set_origin;
1238 std::string query_str = "origin=";
1239 query_str.append(top_url.GetOrigin().spec());
1240 // Origin should not include a trailing slash. That is part of the path.
1241 TrimString(query_str, "/", &query_str);
1242 set_origin.SetQueryStr(query_str);
1243 *new_url = url.ReplaceComponents(set_origin);
1244 }
1245
1242 } // namespace chrome 1246 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698