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

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

Issue 23455047: InstantExtended: Send search URLs to renderers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Small test Created 7 years, 3 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 "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/debug/crash_logging.h" 8 #include "base/debug/crash_logging.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 #include "chrome/renderer/playback_extension.h" 52 #include "chrome/renderer/playback_extension.h"
53 #include "chrome/renderer/plugins/plugin_placeholder.h" 53 #include "chrome/renderer/plugins/plugin_placeholder.h"
54 #include "chrome/renderer/plugins/plugin_uma.h" 54 #include "chrome/renderer/plugins/plugin_uma.h"
55 #include "chrome/renderer/prerender/prerender_dispatcher.h" 55 #include "chrome/renderer/prerender/prerender_dispatcher.h"
56 #include "chrome/renderer/prerender/prerender_helper.h" 56 #include "chrome/renderer/prerender/prerender_helper.h"
57 #include "chrome/renderer/prerender/prerender_media_load_deferrer.h" 57 #include "chrome/renderer/prerender/prerender_media_load_deferrer.h"
58 #include "chrome/renderer/prerender/prerenderer_client.h" 58 #include "chrome/renderer/prerender/prerenderer_client.h"
59 #include "chrome/renderer/printing/print_web_view_helper.h" 59 #include "chrome/renderer/printing/print_web_view_helper.h"
60 #include "chrome/renderer/safe_browsing/malware_dom_details.h" 60 #include "chrome/renderer/safe_browsing/malware_dom_details.h"
61 #include "chrome/renderer/safe_browsing/phishing_classifier_delegate.h" 61 #include "chrome/renderer/safe_browsing/phishing_classifier_delegate.h"
62 #include "chrome/renderer/searchbox/search_bouncer.h"
62 #include "chrome/renderer/searchbox/searchbox.h" 63 #include "chrome/renderer/searchbox/searchbox.h"
63 #include "chrome/renderer/searchbox/searchbox_extension.h" 64 #include "chrome/renderer/searchbox/searchbox_extension.h"
64 #include "chrome/renderer/tts_dispatcher.h" 65 #include "chrome/renderer/tts_dispatcher.h"
65 #include "chrome/renderer/validation_message_agent.h" 66 #include "chrome/renderer/validation_message_agent.h"
66 #include "components/autofill/content/renderer/autofill_agent.h" 67 #include "components/autofill/content/renderer/autofill_agent.h"
67 #include "components/autofill/content/renderer/password_autofill_agent.h" 68 #include "components/autofill/content/renderer/password_autofill_agent.h"
68 #include "components/autofill/content/renderer/password_generation_manager.h" 69 #include "components/autofill/content/renderer/password_generation_manager.h"
69 #include "components/visitedlink/renderer/visitedlink_slave.h" 70 #include "components/visitedlink/renderer/visitedlink_slave.h"
70 #include "content/public/common/content_constants.h" 71 #include "content/public/common/content_constants.h"
71 #include "content/public/renderer/render_thread.h" 72 #include "content/public/renderer/render_thread.h"
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 #endif 244 #endif
244 visited_link_slave_.reset(new visitedlink::VisitedLinkSlave()); 245 visited_link_slave_.reset(new visitedlink::VisitedLinkSlave());
245 #if defined(FULL_SAFE_BROWSING) 246 #if defined(FULL_SAFE_BROWSING)
246 phishing_classifier_.reset(safe_browsing::PhishingClassifierFilter::Create()); 247 phishing_classifier_.reset(safe_browsing::PhishingClassifierFilter::Create());
247 #endif 248 #endif
248 prerender_dispatcher_.reset(new prerender::PrerenderDispatcher()); 249 prerender_dispatcher_.reset(new prerender::PrerenderDispatcher());
249 #if defined(ENABLE_WEBRTC) 250 #if defined(ENABLE_WEBRTC)
250 webrtc_logging_message_filter_ = new WebRtcLoggingMessageFilter( 251 webrtc_logging_message_filter_ = new WebRtcLoggingMessageFilter(
251 content::RenderThread::Get()->GetIOMessageLoopProxy()); 252 content::RenderThread::Get()->GetIOMessageLoopProxy());
252 #endif 253 #endif
254 search_bouncer_.reset(new SearchBouncer());
253 255
254 RenderThread* thread = RenderThread::Get(); 256 RenderThread* thread = RenderThread::Get();
255 257
256 thread->AddObserver(chrome_observer_.get()); 258 thread->AddObserver(chrome_observer_.get());
257 thread->AddObserver(extension_dispatcher_.get()); 259 thread->AddObserver(extension_dispatcher_.get());
258 #if defined(FULL_SAFE_BROWSING) 260 #if defined(FULL_SAFE_BROWSING)
259 thread->AddObserver(phishing_classifier_.get()); 261 thread->AddObserver(phishing_classifier_.get());
260 #endif 262 #endif
261 #if defined(ENABLE_SPELLCHECK) 263 #if defined(ENABLE_SPELLCHECK)
262 thread->AddObserver(spellcheck_.get()); 264 thread->AddObserver(spellcheck_.get());
263 #endif 265 #endif
264 thread->AddObserver(visited_link_slave_.get()); 266 thread->AddObserver(visited_link_slave_.get());
265 thread->AddObserver(prerender_dispatcher_.get()); 267 thread->AddObserver(prerender_dispatcher_.get());
268 thread->AddObserver(search_bouncer_.get());
266 269
267 #if defined(ENABLE_WEBRTC) 270 #if defined(ENABLE_WEBRTC)
268 thread->AddFilter(webrtc_logging_message_filter_.get()); 271 thread->AddFilter(webrtc_logging_message_filter_.get());
269 #endif 272 #endif
270 273
271 thread->RegisterExtension(extensions_v8::ExternalExtension::Get()); 274 thread->RegisterExtension(extensions_v8::ExternalExtension::Get());
272 thread->RegisterExtension(extensions_v8::LoadTimesExtension::Get()); 275 thread->RegisterExtension(extensions_v8::LoadTimesExtension::Get());
273 276
274 CommandLine* command_line = CommandLine::ForCurrentProcess(); 277 CommandLine* command_line = CommandLine::ForCurrentProcess();
275 if (command_line->HasSwitch(switches::kEnableBenchmarking)) 278 if (command_line->HasSwitch(switches::kEnableBenchmarking))
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 // Use an internal error page, if we have one for the status code. 852 // Use an internal error page, if we have one for the status code.
850 if (!LocalizedError::HasStrings(LocalizedError::kHttpErrorDomain, 853 if (!LocalizedError::HasStrings(LocalizedError::kHttpErrorDomain,
851 http_status_code)) { 854 http_status_code)) {
852 return false; 855 return false;
853 } 856 }
854 857
855 *error_domain = LocalizedError::kHttpErrorDomain; 858 *error_domain = LocalizedError::kHttpErrorDomain;
856 return true; 859 return true;
857 } 860 }
858 861
862 bool ChromeContentRendererClient::ShouldSuppressErrorPage(const GURL& url) {
863 // Do not flash an error page if the Instant new tab page fails to load.
864 return search_bouncer_.get() && search_bouncer_->IsNewTabPage(url);
865 }
866
859 void ChromeContentRendererClient::GetNavigationErrorStrings( 867 void ChromeContentRendererClient::GetNavigationErrorStrings(
860 WebKit::WebFrame* frame, 868 WebKit::WebFrame* frame,
861 const WebKit::WebURLRequest& failed_request, 869 const WebKit::WebURLRequest& failed_request,
862 const WebKit::WebURLError& error, 870 const WebKit::WebURLError& error,
863 std::string* error_html, 871 std::string* error_html,
864 string16* error_description) { 872 string16* error_description) {
865 const GURL failed_url = error.unreachableURL; 873 const GURL failed_url = error.unreachableURL;
866 const Extension* extension = NULL; 874 const Extension* extension = NULL;
867 875
868 if (failed_url.is_valid() && 876 if (failed_url.is_valid() &&
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 bool ChromeContentRendererClient::ShouldFork(WebFrame* frame, 937 bool ChromeContentRendererClient::ShouldFork(WebFrame* frame,
930 const GURL& url, 938 const GURL& url,
931 const std::string& http_method, 939 const std::string& http_method,
932 bool is_initial_navigation, 940 bool is_initial_navigation,
933 bool is_server_redirect, 941 bool is_server_redirect,
934 bool* send_referrer) { 942 bool* send_referrer) {
935 DCHECK(!frame->parent()); 943 DCHECK(!frame->parent());
936 944
937 // If this is the Instant process, fork all navigations originating from the 945 // If this is the Instant process, fork all navigations originating from the
938 // renderer. The destination page will then be bucketed back to this Instant 946 // renderer. The destination page will then be bucketed back to this Instant
939 // process if it is an Instant url, or to another process if not. 947 // process if it is an Instant url, or to another process if not. Conversely,
940 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kInstantProcess)) 948 // fork if this is a non-Instant process navigating to an Instant url, so that
949 // such navigations can also be bucketed into an Instant renderer.
950 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kInstantProcess) ||
951 (search_bouncer_.get() && search_bouncer_->ShouldFork(url))) {
941 return true; 952 return true;
953 }
942 954
943 // For now, we skip the rest for POST submissions. This is because 955 // For now, we skip the rest for POST submissions. This is because
944 // http://crbug.com/101395 is more likely to cause compatibility issues 956 // http://crbug.com/101395 is more likely to cause compatibility issues
945 // with hosted apps and extensions than WebUI pages. We will remove this 957 // with hosted apps and extensions than WebUI pages. We will remove this
946 // check when cross-process POST submissions are supported. 958 // check when cross-process POST submissions are supported.
947 if (http_method != "GET") 959 if (http_method != "GET")
948 return false; 960 return false;
949 961
950 // If this is the Signin process, fork all navigations originating from the 962 // If this is the Signin process, fork all navigations originating from the
951 // renderer. The destination page will then be bucketed back to this Signin 963 // renderer. The destination page will then be bucketed back to this Signin
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
1316 // SiteIsolationPolicy is off by default. We would like to activate cross-site 1328 // SiteIsolationPolicy is off by default. We would like to activate cross-site
1317 // document blocking (for UMA data collection) for normal renderer processes 1329 // document blocking (for UMA data collection) for normal renderer processes
1318 // running a normal web page from the Internet. We only turn on 1330 // running a normal web page from the Internet. We only turn on
1319 // SiteIsolationPolicy for a renderer process that does not have the extension 1331 // SiteIsolationPolicy for a renderer process that does not have the extension
1320 // flag on. 1332 // flag on.
1321 CommandLine* command_line = CommandLine::ForCurrentProcess(); 1333 CommandLine* command_line = CommandLine::ForCurrentProcess();
1322 return !command_line->HasSwitch(switches::kExtensionProcess); 1334 return !command_line->HasSwitch(switches::kExtensionProcess);
1323 } 1335 }
1324 1336
1325 } // namespace chrome 1337 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698