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

Unified 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: Addressing comments. 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 side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/chrome_content_renderer_client.cc
diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc
index 25a30d7e643ff65bee8c3b9e7bc3a5a8a333d282..e085f3802621f3e5b5e2bb88c237434c621a7c73 100644
--- a/chrome/renderer/chrome_content_renderer_client.cc
+++ b/chrome/renderer/chrome_content_renderer_client.cc
@@ -223,15 +223,6 @@ bool ShouldUseJavaScriptSettingForPlugin(const WebPluginInfo& plugin) {
return false;
}
-content::RenderView* GetRenderViewFromWebFrame(WebKit::WebFrame* webframe) {
- if (!webframe)
- return NULL;
- WebKit::WebView* webview = webframe->view();
- if (!webview)
- return NULL;
- return content::RenderView::FromWebView(webview);
-}
-
} // namespace
namespace chrome {
@@ -1009,13 +1000,11 @@ bool ChromeContentRendererClient::WillSendRequest(
return true;
}
- const content::RenderView* render_view = GetRenderViewFromWebFrame(frame);
- if (SearchBox* search_box = SearchBox::Get(render_view)) {
- if (url.SchemeIs(chrome::kChromeSearchScheme) &&
- url.host() == chrome::kChromeSearchSuggestionHost) {
- if (search_box->GenerateDataURLForSuggestionRequest(url, new_url))
- return true;
- }
+ if (url.SchemeIs(chrome::kChromeSearchScheme) &&
+ url.host() == chrome::kChromeSearchSuggestionHost) {
+ GURL top_url(frame->top()->document().url());
+ *new_url = SetOriginForSuggestionRequest(url, top_url);
+ return true;
}
return false;
@@ -1247,4 +1236,18 @@ bool ChromeContentRendererClient::IsRequestOSFileHandleAllowedForURL(
return false;
}
+GURL ChromeContentRendererClient::SetOriginForSuggestionRequest(
+ const GURL& url,
+ const GURL& top_url) const {
+ // Note that this replaces any existing query string parameters, including
+ // any existing &origin parameter.
+ GURL::Replacements set_origin;
+ std::string query_str = "origin=";
+ query_str.append(top_url.GetOrigin().spec());
+ // Origin should not include a trailing slash. That is part of the path.
+ TrimString(query_str, "/", &query_str);
+ set_origin.SetQueryStr(query_str);
+ return url.ReplaceComponents(set_origin);
+}
+
} // namespace chrome

Powered by Google App Engine
This is Rietveld 408576698