| OLD | NEW |
| 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 29 matching lines...) Expand all Loading... |
| 40 #include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h" | 40 #include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h" |
| 41 #include "chrome/browser/budget_service/budget_service_impl.h" | 41 #include "chrome/browser/budget_service/budget_service_impl.h" |
| 42 #include "chrome/browser/chrome_content_browser_client_parts.h" | 42 #include "chrome/browser/chrome_content_browser_client_parts.h" |
| 43 #include "chrome/browser/chrome_quota_permission_context.h" | 43 #include "chrome/browser/chrome_quota_permission_context.h" |
| 44 #include "chrome/browser/content_settings/cookie_settings_factory.h" | 44 #include "chrome/browser/content_settings/cookie_settings_factory.h" |
| 45 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 45 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 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/loader/delay_navigation_throttle.h" |
| 50 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" | 51 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" |
| 51 #include "chrome/browser/memory/chrome_memory_coordinator_delegate.h" | 52 #include "chrome/browser/memory/chrome_memory_coordinator_delegate.h" |
| 52 #include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h" | 53 #include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h" |
| 53 #include "chrome/browser/nacl_host/nacl_browser_delegate_impl.h" | 54 #include "chrome/browser/nacl_host/nacl_browser_delegate_impl.h" |
| 54 #include "chrome/browser/net_benchmarking.h" | 55 #include "chrome/browser/net_benchmarking.h" |
| 55 #include "chrome/browser/notifications/platform_notification_service_impl.h" | 56 #include "chrome/browser/notifications/platform_notification_service_impl.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" |
| (...skipping 3295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3355 rappor::SampleDomainAndRegistryFromGURL(g_browser_process->rappor_service(), | 3356 rappor::SampleDomainAndRegistryFromGURL(g_browser_process->rappor_service(), |
| 3356 metric, url); | 3357 metric, url); |
| 3357 } | 3358 } |
| 3358 } | 3359 } |
| 3359 | 3360 |
| 3360 std::vector<std::unique_ptr<content::NavigationThrottle>> | 3361 std::vector<std::unique_ptr<content::NavigationThrottle>> |
| 3361 ChromeContentBrowserClient::CreateThrottlesForNavigation( | 3362 ChromeContentBrowserClient::CreateThrottlesForNavigation( |
| 3362 content::NavigationHandle* handle) { | 3363 content::NavigationHandle* handle) { |
| 3363 std::vector<std::unique_ptr<content::NavigationThrottle>> throttles; | 3364 std::vector<std::unique_ptr<content::NavigationThrottle>> throttles; |
| 3364 | 3365 |
| 3366 // MetricsNavigationThrottle requires that it runs before NavigationThrottles |
| 3367 // that may delay or cancel navigations, so only NavigationThrottles that |
| 3368 // don't delay or cancel navigations (e.g. throttles that are only observing |
| 3369 // callbacks without affecting navigation behavior) should be added before |
| 3370 // MetricsNavigationThrottle. |
| 3371 if (handle->IsInMainFrame()) { |
| 3372 throttles.push_back( |
| 3373 page_load_metrics::MetricsNavigationThrottle::Create(handle)); |
| 3374 } |
| 3375 |
| 3365 #if BUILDFLAG(ENABLE_PLUGINS) | 3376 #if BUILDFLAG(ENABLE_PLUGINS) |
| 3366 std::unique_ptr<content::NavigationThrottle> flash_url_throttle = | 3377 std::unique_ptr<content::NavigationThrottle> flash_url_throttle = |
| 3367 FlashDownloadInterception::MaybeCreateThrottleFor(handle); | 3378 FlashDownloadInterception::MaybeCreateThrottleFor(handle); |
| 3368 if (flash_url_throttle) | 3379 if (flash_url_throttle) |
| 3369 throttles.push_back(std::move(flash_url_throttle)); | 3380 throttles.push_back(std::move(flash_url_throttle)); |
| 3370 #endif | 3381 #endif |
| 3371 | 3382 |
| 3372 if (handle->IsInMainFrame()) { | |
| 3373 throttles.push_back( | |
| 3374 page_load_metrics::MetricsNavigationThrottle::Create(handle)); | |
| 3375 } | |
| 3376 | |
| 3377 #if defined(OS_ANDROID) | 3383 #if defined(OS_ANDROID) |
| 3378 // TODO(davidben): This is insufficient to integrate with prerender properly. | 3384 // TODO(davidben): This is insufficient to integrate with prerender properly. |
| 3379 // https://crbug.com/370595 | 3385 // https://crbug.com/370595 |
| 3380 prerender::PrerenderContents* prerender_contents = | 3386 prerender::PrerenderContents* prerender_contents = |
| 3381 prerender::PrerenderContents::FromWebContents(handle->GetWebContents()); | 3387 prerender::PrerenderContents::FromWebContents(handle->GetWebContents()); |
| 3382 if (!prerender_contents && handle->IsInMainFrame()) { | 3388 if (!prerender_contents && handle->IsInMainFrame()) { |
| 3383 throttles.push_back( | 3389 throttles.push_back( |
| 3384 navigation_interception::InterceptNavigationDelegate::CreateThrottleFor( | 3390 navigation_interception::InterceptNavigationDelegate::CreateThrottleFor( |
| 3385 handle)); | 3391 handle)); |
| 3386 } | 3392 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3422 } | 3428 } |
| 3423 } | 3429 } |
| 3424 } | 3430 } |
| 3425 #endif | 3431 #endif |
| 3426 | 3432 |
| 3427 #if BUILDFLAG(ENABLE_EXTENSIONS) | 3433 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 3428 throttles.push_back( | 3434 throttles.push_back( |
| 3429 base::MakeUnique<extensions::ExtensionNavigationThrottle>(handle)); | 3435 base::MakeUnique<extensions::ExtensionNavigationThrottle>(handle)); |
| 3430 #endif | 3436 #endif |
| 3431 | 3437 |
| 3438 std::unique_ptr<content::NavigationThrottle> delay_navigation_throttle = |
| 3439 DelayNavigationThrottle::MaybeCreateThrottleFor(handle); |
| 3440 if (delay_navigation_throttle) |
| 3441 throttles.push_back(std::move(delay_navigation_throttle)); |
| 3442 |
| 3432 return throttles; | 3443 return throttles; |
| 3433 } | 3444 } |
| 3434 | 3445 |
| 3435 std::unique_ptr<content::NavigationUIData> | 3446 std::unique_ptr<content::NavigationUIData> |
| 3436 ChromeContentBrowserClient::GetNavigationUIData( | 3447 ChromeContentBrowserClient::GetNavigationUIData( |
| 3437 content::NavigationHandle* navigation_handle) { | 3448 content::NavigationHandle* navigation_handle) { |
| 3438 return base::MakeUnique<ChromeNavigationUIData>(navigation_handle); | 3449 return base::MakeUnique<ChromeNavigationUIData>(navigation_handle); |
| 3439 } | 3450 } |
| 3440 | 3451 |
| 3441 content::DevToolsManagerDelegate* | 3452 content::DevToolsManagerDelegate* |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3566 RedirectNonUINonIOBrowserThreadsToTaskScheduler() { | 3577 RedirectNonUINonIOBrowserThreadsToTaskScheduler() { |
| 3567 return variations::GetVariationParamValue( | 3578 return variations::GetVariationParamValue( |
| 3568 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true"; | 3579 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true"; |
| 3569 } | 3580 } |
| 3570 | 3581 |
| 3571 // static | 3582 // static |
| 3572 void ChromeContentBrowserClient::SetDefaultQuotaSettingsForTesting( | 3583 void ChromeContentBrowserClient::SetDefaultQuotaSettingsForTesting( |
| 3573 const storage::QuotaSettings* settings) { | 3584 const storage::QuotaSettings* settings) { |
| 3574 g_default_quota_settings = settings; | 3585 g_default_quota_settings = settings; |
| 3575 } | 3586 } |
| OLD | NEW |