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

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: Addressing cc 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 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 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/metrics/histogram.h" 12 #include "base/metrics/histogram.h"
13 #include "base/path_service.h" 13 #include "base/path_service.h"
14 #include "base/string_util.h"
14 #include "base/strings/string_tokenizer.h" 15 #include "base/strings/string_tokenizer.h"
15 #include "base/utf_string_conversions.h" 16 #include "base/utf_string_conversions.h"
16 #include "base/values.h" 17 #include "base/values.h"
17 #include "chrome/common/child_process_logging.h" 18 #include "chrome/common/child_process_logging.h"
18 #include "chrome/common/chrome_content_client.h" 19 #include "chrome/common/chrome_content_client.h"
19 #include "chrome/common/chrome_paths.h" 20 #include "chrome/common/chrome_paths.h"
20 #include "chrome/common/chrome_switches.h" 21 #include "chrome/common/chrome_switches.h"
21 #include "chrome/common/content_settings_pattern.h" 22 #include "chrome/common/content_settings_pattern.h"
22 #include "chrome/common/extensions/api/extension_action/page_action_handler.h" 23 #include "chrome/common/extensions/api/extension_action/page_action_handler.h"
23 #include "chrome/common/extensions/background_info.h" 24 #include "chrome/common/extensions/background_info.h"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 // Treat CDM invocations like JavaScript. 212 // Treat CDM invocations like JavaScript.
212 if (plugin.name == ASCIIToUTF16(kWidevineCdmPluginName)) { 213 if (plugin.name == ASCIIToUTF16(kWidevineCdmPluginName)) {
213 DCHECK(plugin.type == WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS); 214 DCHECK(plugin.type == WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS);
214 return true; 215 return true;
215 } 216 }
216 #endif // WIDEVINE_CDM_AVAILABLE 217 #endif // WIDEVINE_CDM_AVAILABLE
217 218
218 return false; 219 return false;
219 } 220 }
220 221
221 content::RenderView* GetRenderViewFromWebFrame(WebKit::WebFrame* webframe) {
222 if (!webframe)
223 return NULL;
224 WebKit::WebView* webview = webframe->view();
225 if (!webview)
226 return NULL;
227 return content::RenderView::FromWebView(webview);
228 }
229
230 } // namespace 222 } // namespace
231 223
232 namespace chrome { 224 namespace chrome {
233 225
234 ChromeContentRendererClient::ChromeContentRendererClient() { 226 ChromeContentRendererClient::ChromeContentRendererClient() {
235 } 227 }
236 228
237 ChromeContentRendererClient::~ChromeContentRendererClient() { 229 ChromeContentRendererClient::~ChromeContentRendererClient() {
238 } 230 }
239 231
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
991 } 983 }
992 984
993 if (url.SchemeIs(chrome::kExtensionResourceScheme) && 985 if (url.SchemeIs(chrome::kExtensionResourceScheme) &&
994 !extensions::ResourceRequestPolicy::CanRequestExtensionResourceScheme( 986 !extensions::ResourceRequestPolicy::CanRequestExtensionResourceScheme(
995 url, 987 url,
996 frame)) { 988 frame)) {
997 *new_url = GURL(chrome::kExtensionResourceInvalidRequestURL); 989 *new_url = GURL(chrome::kExtensionResourceInvalidRequestURL);
998 return true; 990 return true;
999 } 991 }
1000 992
1001 const content::RenderView* render_view = GetRenderViewFromWebFrame(frame); 993 if (url.SchemeIs(chrome::kChromeSearchScheme) &&
1002 if (SearchBox* search_box = SearchBox::Get(render_view)) { 994 url.host() == chrome::kChromeSearchSuggestionHost) {
1003 if (url.SchemeIs(chrome::kChromeSearchScheme) && 995 GURL top_url(frame->top()->document().url());
1004 url.host() == chrome::kChromeSearchSuggestionHost) { 996 // Note that this replaces any existing parameters, including any existing
palmer 2013/04/05 01:30:32 "...any existing URL query string parameters..." (
Jered 2013/04/05 15:30:23 Done.
1005 if (search_box->GenerateDataURLForSuggestionRequest(url, new_url)) 997 // &origin parameter.
1006 return true; 998 GURL::Replacements set_origin;
1007 } 999 std::string query_str = "origin=";
1000 query_str.append(top_url.GetOrigin().spec());
1001 // Origin should not include a trailing slash. That is part of the path.
1002 TrimString(query_str, "/", &query_str);
1003 set_origin.SetQueryStr(query_str);
1004 *new_url = url.ReplaceComponents(set_origin);
1005 return true;
1008 } 1006 }
1009 1007
1010 return false; 1008 return false;
1011 } 1009 }
1012 1010
1013 bool ChromeContentRendererClient::ShouldPumpEventsDuringCookieMessage() { 1011 bool ChromeContentRendererClient::ShouldPumpEventsDuringCookieMessage() {
1014 // We no longer pump messages, even under Chrome Frame. We rely on cookie 1012 // We no longer pump messages, even under Chrome Frame. We rely on cookie
1015 // read requests handled by CF not putting up UI or causing other actions 1013 // read requests handled by CF not putting up UI or causing other actions
1016 // that would require us to pump messages. This fixes http://crbug.com/110090. 1014 // that would require us to pump messages. This fixes http://crbug.com/110090.
1017 return false; 1015 return false;
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
1225 return true; 1223 return true;
1226 } 1224 }
1227 1225
1228 if (request_os_file_handle_allowed_hosts_.count(inner.host())) 1226 if (request_os_file_handle_allowed_hosts_.count(inner.host()))
1229 return true; 1227 return true;
1230 1228
1231 return false; 1229 return false;
1232 } 1230 }
1233 1231
1234 } // namespace chrome 1232 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698