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

Side by Side Diff: chrome/browser/chrome_content_browser_client.cc

Issue 2763613002: Add DelayNavigationThrottle (Closed)
Patch Set: add dchecks Created 3 years, 9 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
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/browser/chrome_content_browser_client.h" 5 #include "chrome/browser/chrome_content_browser_client.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 46 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
47 #include "chrome/browser/defaults.h" 47 #include "chrome/browser/defaults.h"
48 #include "chrome/browser/download/download_prefs.h" 48 #include "chrome/browser/download/download_prefs.h"
49 #include "chrome/browser/font_family_cache.h" 49 #include "chrome/browser/font_family_cache.h"
50 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" 50 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h"
51 #include "chrome/browser/memory/chrome_memory_coordinator_delegate.h" 51 #include "chrome/browser/memory/chrome_memory_coordinator_delegate.h"
52 #include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h" 52 #include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h"
53 #include "chrome/browser/nacl_host/nacl_browser_delegate_impl.h" 53 #include "chrome/browser/nacl_host/nacl_browser_delegate_impl.h"
54 #include "chrome/browser/net_benchmarking.h" 54 #include "chrome/browser/net_benchmarking.h"
55 #include "chrome/browser/notifications/platform_notification_service_impl.h" 55 #include "chrome/browser/notifications/platform_notification_service_impl.h"
56 #include "chrome/browser/page_load_metrics/experiments/delay_navigation_throttle .h"
56 #include "chrome/browser/page_load_metrics/metrics_navigation_throttle.h" 57 #include "chrome/browser/page_load_metrics/metrics_navigation_throttle.h"
57 #include "chrome/browser/password_manager/chrome_password_manager_client.h" 58 #include "chrome/browser/password_manager/chrome_password_manager_client.h"
58 #include "chrome/browser/permissions/permission_context_base.h" 59 #include "chrome/browser/permissions/permission_context_base.h"
59 #include "chrome/browser/platform_util.h" 60 #include "chrome/browser/platform_util.h"
60 #include "chrome/browser/prefs/preferences_connection_manager.h" 61 #include "chrome/browser/prefs/preferences_connection_manager.h"
61 #include "chrome/browser/prerender/prerender_final_status.h" 62 #include "chrome/browser/prerender/prerender_final_status.h"
62 #include "chrome/browser/prerender/prerender_manager.h" 63 #include "chrome/browser/prerender/prerender_manager.h"
63 #include "chrome/browser/prerender/prerender_manager_factory.h" 64 #include "chrome/browser/prerender/prerender_manager_factory.h"
64 #include "chrome/browser/prerender/prerender_message_filter.h" 65 #include "chrome/browser/prerender/prerender_message_filter.h"
65 #include "chrome/browser/printing/printing_message_filter.h" 66 #include "chrome/browser/printing/printing_message_filter.h"
(...skipping 3286 matching lines...) Expand 10 before | Expand all | Expand 10 after
3352 rappor::SampleDomainAndRegistryFromGURL(g_browser_process->rappor_service(), 3353 rappor::SampleDomainAndRegistryFromGURL(g_browser_process->rappor_service(),
3353 metric, url); 3354 metric, url);
3354 } 3355 }
3355 } 3356 }
3356 3357
3357 std::vector<std::unique_ptr<content::NavigationThrottle>> 3358 std::vector<std::unique_ptr<content::NavigationThrottle>>
3358 ChromeContentBrowserClient::CreateThrottlesForNavigation( 3359 ChromeContentBrowserClient::CreateThrottlesForNavigation(
3359 content::NavigationHandle* handle) { 3360 content::NavigationHandle* handle) {
3360 std::vector<std::unique_ptr<content::NavigationThrottle>> throttles; 3361 std::vector<std::unique_ptr<content::NavigationThrottle>> throttles;
3361 3362
3363 // MetricsNavigationThrottle requires that it runs before NavigationThrottles
3364 // that may delay or cancel navigations, so only NavigationThrottles that
3365 // don't delay or cancel navigations (e.g. throttles that are only observing
3366 // callbacks without affecting navigation behavior) should be added before
3367 // MetricsNavigationThrottle.
3368 if (handle->IsInMainFrame()) {
3369 throttles.push_back(
3370 page_load_metrics::MetricsNavigationThrottle::Create(handle));
3371 }
3372
3362 #if BUILDFLAG(ENABLE_PLUGINS) 3373 #if BUILDFLAG(ENABLE_PLUGINS)
3363 std::unique_ptr<content::NavigationThrottle> flash_url_throttle = 3374 std::unique_ptr<content::NavigationThrottle> flash_url_throttle =
3364 FlashDownloadInterception::MaybeCreateThrottleFor(handle); 3375 FlashDownloadInterception::MaybeCreateThrottleFor(handle);
3365 if (flash_url_throttle) 3376 if (flash_url_throttle)
3366 throttles.push_back(std::move(flash_url_throttle)); 3377 throttles.push_back(std::move(flash_url_throttle));
3367 #endif 3378 #endif
3368 3379
3369 if (handle->IsInMainFrame()) {
3370 throttles.push_back(
3371 page_load_metrics::MetricsNavigationThrottle::Create(handle));
3372 }
3373
3374 #if defined(OS_ANDROID) 3380 #if defined(OS_ANDROID)
3375 // TODO(davidben): This is insufficient to integrate with prerender properly. 3381 // TODO(davidben): This is insufficient to integrate with prerender properly.
3376 // https://crbug.com/370595 3382 // https://crbug.com/370595
3377 prerender::PrerenderContents* prerender_contents = 3383 prerender::PrerenderContents* prerender_contents =
3378 prerender::PrerenderContents::FromWebContents(handle->GetWebContents()); 3384 prerender::PrerenderContents::FromWebContents(handle->GetWebContents());
3379 if (!prerender_contents && handle->IsInMainFrame()) { 3385 if (!prerender_contents && handle->IsInMainFrame()) {
3380 throttles.push_back( 3386 throttles.push_back(
3381 navigation_interception::InterceptNavigationDelegate::CreateThrottleFor( 3387 navigation_interception::InterceptNavigationDelegate::CreateThrottleFor(
3382 handle)); 3388 handle));
3383 } 3389 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
3419 } 3425 }
3420 } 3426 }
3421 } 3427 }
3422 #endif 3428 #endif
3423 3429
3424 #if BUILDFLAG(ENABLE_EXTENSIONS) 3430 #if BUILDFLAG(ENABLE_EXTENSIONS)
3425 throttles.push_back( 3431 throttles.push_back(
3426 base::MakeUnique<extensions::ExtensionNavigationThrottle>(handle)); 3432 base::MakeUnique<extensions::ExtensionNavigationThrottle>(handle));
3427 #endif 3433 #endif
3428 3434
3435 std::unique_ptr<content::NavigationThrottle> delay_navigation_throttle =
3436 DelayNavigationThrottle::MaybeCreateThrottleFor(handle);
3437 if (delay_navigation_throttle)
3438 throttles.push_back(std::move(delay_navigation_throttle));
3439
3429 return throttles; 3440 return throttles;
3430 } 3441 }
3431 3442
3432 std::unique_ptr<content::NavigationUIData> 3443 std::unique_ptr<content::NavigationUIData>
3433 ChromeContentBrowserClient::GetNavigationUIData( 3444 ChromeContentBrowserClient::GetNavigationUIData(
3434 content::NavigationHandle* navigation_handle) { 3445 content::NavigationHandle* navigation_handle) {
3435 return base::MakeUnique<ChromeNavigationUIData>(navigation_handle); 3446 return base::MakeUnique<ChromeNavigationUIData>(navigation_handle);
3436 } 3447 }
3437 3448
3438 content::DevToolsManagerDelegate* 3449 content::DevToolsManagerDelegate*
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
3563 RedirectNonUINonIOBrowserThreadsToTaskScheduler() { 3574 RedirectNonUINonIOBrowserThreadsToTaskScheduler() {
3564 return variations::GetVariationParamValue( 3575 return variations::GetVariationParamValue(
3565 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true"; 3576 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true";
3566 } 3577 }
3567 3578
3568 // static 3579 // static
3569 void ChromeContentBrowserClient::SetDefaultQuotaSettingsForTesting( 3580 void ChromeContentBrowserClient::SetDefaultQuotaSettingsForTesting(
3570 const storage::QuotaSettings* settings) { 3581 const storage::QuotaSettings* settings) {
3571 g_default_quota_settings = settings; 3582 g_default_quota_settings = settings;
3572 } 3583 }
OLDNEW
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | chrome/browser/page_load_metrics/experiments/delay_navigation_throttle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698