Chromium Code Reviews| 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> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/files/scoped_file.h" | 15 #include "base/files/scoped_file.h" |
| 16 #include "base/lazy_instance.h" | 16 #include "base/lazy_instance.h" |
| 17 #include "base/path_service.h" | 17 #include "base/path_service.h" |
| 18 #include "base/prefs/pref_service.h" | 18 #include "base/prefs/pref_service.h" |
| 19 #include "base/prefs/scoped_user_pref_update.h" | 19 #include "base/prefs/scoped_user_pref_update.h" |
| 20 #include "base/strings/string_number_conversions.h" | 20 #include "base/strings/string_number_conversions.h" |
| 21 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
| 22 #include "base/strings/stringprintf.h" | 22 #include "base/strings/stringprintf.h" |
| 23 #include "base/strings/utf_string_conversions.h" | 23 #include "base/strings/utf_string_conversions.h" |
| 24 #include "base/thread_task_runner_handle.h" | 24 #include "base/thread_task_runner_handle.h" |
| 25 #include "base/threading/sequenced_worker_pool.h" | 25 #include "base/threading/sequenced_worker_pool.h" |
| 26 #include "chrome/browser/after_startup_task_utils.h" | 26 #include "chrome/browser/after_startup_task_utils.h" |
| 27 #include "chrome/browser/apps/app_url_redirector.h" | |
| 27 #include "chrome/browser/browser_about_handler.h" | 28 #include "chrome/browser/browser_about_handler.h" |
| 28 #include "chrome/browser/browser_process.h" | 29 #include "chrome/browser/browser_process.h" |
| 29 #include "chrome/browser/browser_shutdown.h" | 30 #include "chrome/browser/browser_shutdown.h" |
| 30 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 31 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
| 31 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 32 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
| 32 #include "chrome/browser/character_encoding.h" | 33 #include "chrome/browser/character_encoding.h" |
| 33 #include "chrome/browser/chrome_content_browser_client_parts.h" | 34 #include "chrome/browser/chrome_content_browser_client_parts.h" |
| 34 #include "chrome/browser/chrome_net_benchmarking_message_filter.h" | 35 #include "chrome/browser/chrome_net_benchmarking_message_filter.h" |
| 35 #include "chrome/browser/chrome_quota_permission_context.h" | 36 #include "chrome/browser/chrome_quota_permission_context.h" |
| 36 #include "chrome/browser/content_settings/cookie_settings_factory.h" | 37 #include "chrome/browser/content_settings/cookie_settings_factory.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 112 #include "components/variations/variations_associated_data.h" | 113 #include "components/variations/variations_associated_data.h" |
| 113 #include "components/version_info/version_info.h" | 114 #include "components/version_info/version_info.h" |
| 114 #include "content/public/browser/browser_child_process_host.h" | 115 #include "content/public/browser/browser_child_process_host.h" |
| 115 #include "content/public/browser/browser_main_parts.h" | 116 #include "content/public/browser/browser_main_parts.h" |
| 116 #include "content/public/browser/browser_ppapi_host.h" | 117 #include "content/public/browser/browser_ppapi_host.h" |
| 117 #include "content/public/browser/browser_thread.h" | 118 #include "content/public/browser/browser_thread.h" |
| 118 #include "content/public/browser/browser_url_handler.h" | 119 #include "content/public/browser/browser_url_handler.h" |
| 119 #include "content/public/browser/child_process_data.h" | 120 #include "content/public/browser/child_process_data.h" |
| 120 #include "content/public/browser/child_process_security_policy.h" | 121 #include "content/public/browser/child_process_security_policy.h" |
| 121 #include "content/public/browser/client_certificate_delegate.h" | 122 #include "content/public/browser/client_certificate_delegate.h" |
| 123 #include "content/public/browser/navigation_handle.h" | |
| 124 #include "content/public/browser/navigation_throttle.h" | |
| 122 #include "content/public/browser/render_frame_host.h" | 125 #include "content/public/browser/render_frame_host.h" |
| 123 #include "content/public/browser/render_process_host.h" | 126 #include "content/public/browser/render_process_host.h" |
| 124 #include "content/public/browser/render_view_host.h" | 127 #include "content/public/browser/render_view_host.h" |
| 125 #include "content/public/browser/resource_context.h" | 128 #include "content/public/browser/resource_context.h" |
| 126 #include "content/public/browser/site_instance.h" | 129 #include "content/public/browser/site_instance.h" |
| 127 #include "content/public/browser/web_contents.h" | 130 #include "content/public/browser/web_contents.h" |
| 128 #include "content/public/common/child_process_host.h" | 131 #include "content/public/common/child_process_host.h" |
| 129 #include "content/public/common/content_descriptors.h" | 132 #include "content/public/common/content_descriptors.h" |
| 130 #include "content/public/common/sandbox_type.h" | 133 #include "content/public/common/sandbox_type.h" |
| 131 #include "content/public/common/service_registry.h" | 134 #include "content/public/common/service_registry.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 165 #include "chromeos/chromeos_switches.h" | 168 #include "chromeos/chromeos_switches.h" |
| 166 #include "components/user_manager/user_manager.h" | 169 #include "components/user_manager/user_manager.h" |
| 167 #elif defined(OS_LINUX) | 170 #elif defined(OS_LINUX) |
| 168 #include "chrome/browser/chrome_browser_main_linux.h" | 171 #include "chrome/browser/chrome_browser_main_linux.h" |
| 169 #elif defined(OS_ANDROID) | 172 #elif defined(OS_ANDROID) |
| 170 #include "chrome/browser/android/new_tab_page_url_handler.h" | 173 #include "chrome/browser/android/new_tab_page_url_handler.h" |
| 171 #include "chrome/browser/android/webapps/single_tab_mode_tab_helper.h" | 174 #include "chrome/browser/android/webapps/single_tab_mode_tab_helper.h" |
| 172 #include "chrome/browser/chrome_browser_main_android.h" | 175 #include "chrome/browser/chrome_browser_main_android.h" |
| 173 #include "chrome/common/descriptors_android.h" | 176 #include "chrome/common/descriptors_android.h" |
| 174 #include "components/crash/browser/crash_dump_manager_android.h" | 177 #include "components/crash/browser/crash_dump_manager_android.h" |
| 178 #include "components/navigation_interception/intercept_navigation_delegate.h" | |
| 175 #include "components/service_tab_launcher/browser/android/service_tab_launcher.h " | 179 #include "components/service_tab_launcher/browser/android/service_tab_launcher.h " |
| 176 #include "ui/base/resource/resource_bundle_android.h" | 180 #include "ui/base/resource/resource_bundle_android.h" |
| 177 #elif defined(OS_POSIX) | 181 #elif defined(OS_POSIX) |
| 178 #include "chrome/browser/chrome_browser_main_posix.h" | 182 #include "chrome/browser/chrome_browser_main_posix.h" |
| 179 #endif | 183 #endif |
| 180 | 184 |
| 181 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 185 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 182 #include "base/debug/leak_annotations.h" | 186 #include "base/debug/leak_annotations.h" |
| 183 #include "components/crash/app/breakpad_linux.h" | 187 #include "components/crash/app/breakpad_linux.h" |
| 184 #include "components/crash/browser/crash_handler_host_linux.h" | 188 #include "components/crash/browser/crash_handler_host_linux.h" |
| (...skipping 2354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2539 } | 2543 } |
| 2540 | 2544 |
| 2541 void ChromeContentBrowserClient::RecordURLMetric(const std::string& metric, | 2545 void ChromeContentBrowserClient::RecordURLMetric(const std::string& metric, |
| 2542 const GURL& url) { | 2546 const GURL& url) { |
| 2543 if (url.is_valid()) { | 2547 if (url.is_valid()) { |
| 2544 rappor::SampleDomainAndRegistryFromGURL(g_browser_process->rappor_service(), | 2548 rappor::SampleDomainAndRegistryFromGURL(g_browser_process->rappor_service(), |
| 2545 metric, url); | 2549 metric, url); |
| 2546 } | 2550 } |
| 2547 } | 2551 } |
| 2548 | 2552 |
| 2553 std::vector<content::NavigationThrottle*> | |
| 2554 ChromeContentBrowserClient::AddNavigationThrottles( | |
|
nasko
2015/09/04 23:36:49
This method doesn't really add anything, maybe Get
clamy
2015/09/08 16:27:18
Done.
| |
| 2555 content::NavigationHandle* handle, | |
| 2556 WebContents* web_contents) { | |
| 2557 std::vector<content::NavigationThrottle*> throttles; | |
| 2558 #if defined(OS_ANDROID) | |
| 2559 // TODO(davidben): This is insufficient to integrate with prerender properly. | |
| 2560 // https://crbug.com/370595 | |
| 2561 prerender::PrerenderContents* prerender_contents = | |
| 2562 prerender::PrerenderContents::FromWebContents(web_contents); | |
| 2563 if (!prerender_contents && handle->IsInMainFrame()) { | |
| 2564 throttles.push_back( | |
| 2565 navigation_interception::InterceptNavigationDelegate::CreateThrottleFor( | |
| 2566 handle, web_contents)); | |
| 2567 } | |
| 2568 #else | |
| 2569 if (handle->IsInMainFrame()) { | |
| 2570 // Redirect some navigations to apps that have registered matching URL | |
| 2571 // handlers ('url_handlers' in the manifest). | |
| 2572 content::NavigationThrottle* url_to_app_throttle = | |
| 2573 AppUrlRedirector::MaybeCreateThrottleFor(handle, web_contents); | |
| 2574 if (url_to_app_throttle) | |
| 2575 throttles.push_back(url_to_app_throttle); | |
| 2576 } | |
| 2577 #endif | |
| 2578 return throttles; | |
| 2579 } | |
| 2580 | |
| 2549 content::DevToolsManagerDelegate* | 2581 content::DevToolsManagerDelegate* |
| 2550 ChromeContentBrowserClient::GetDevToolsManagerDelegate() { | 2582 ChromeContentBrowserClient::GetDevToolsManagerDelegate() { |
| 2551 return new ChromeDevToolsManagerDelegate(); | 2583 return new ChromeDevToolsManagerDelegate(); |
| 2552 } | 2584 } |
| 2553 | 2585 |
| 2554 content::TracingDelegate* ChromeContentBrowserClient::GetTracingDelegate() { | 2586 content::TracingDelegate* ChromeContentBrowserClient::GetTracingDelegate() { |
| 2555 #if !defined(OS_ANDROID) | 2587 #if !defined(OS_ANDROID) |
| 2556 return new ChromeTracingDelegate(); | 2588 return new ChromeTracingDelegate(); |
| 2557 #else | 2589 #else |
| 2558 return nullptr; | 2590 return nullptr; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2619 switches::kDisableWebRtcEncryption, | 2651 switches::kDisableWebRtcEncryption, |
| 2620 }; | 2652 }; |
| 2621 to_command_line->CopySwitchesFrom(from_command_line, | 2653 to_command_line->CopySwitchesFrom(from_command_line, |
| 2622 kWebRtcDevSwitchNames, | 2654 kWebRtcDevSwitchNames, |
| 2623 arraysize(kWebRtcDevSwitchNames)); | 2655 arraysize(kWebRtcDevSwitchNames)); |
| 2624 } | 2656 } |
| 2625 } | 2657 } |
| 2626 #endif // defined(ENABLE_WEBRTC) | 2658 #endif // defined(ENABLE_WEBRTC) |
| 2627 | 2659 |
| 2628 } // namespace chrome | 2660 } // namespace chrome |
| OLD | NEW |