| 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" | |
| 28 #include "chrome/browser/browser_about_handler.h" | 27 #include "chrome/browser/browser_about_handler.h" |
| 29 #include "chrome/browser/browser_process.h" | 28 #include "chrome/browser/browser_process.h" |
| 30 #include "chrome/browser/browser_shutdown.h" | 29 #include "chrome/browser/browser_shutdown.h" |
| 31 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 30 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
| 32 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 31 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
| 33 #include "chrome/browser/character_encoding.h" | 32 #include "chrome/browser/character_encoding.h" |
| 34 #include "chrome/browser/chrome_content_browser_client_parts.h" | 33 #include "chrome/browser/chrome_content_browser_client_parts.h" |
| 35 #include "chrome/browser/chrome_net_benchmarking_message_filter.h" | 34 #include "chrome/browser/chrome_net_benchmarking_message_filter.h" |
| 36 #include "chrome/browser/chrome_quota_permission_context.h" | 35 #include "chrome/browser/chrome_quota_permission_context.h" |
| 37 #include "chrome/browser/content_settings/cookie_settings_factory.h" | 36 #include "chrome/browser/content_settings/cookie_settings_factory.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 #include "components/variations/variations_associated_data.h" | 113 #include "components/variations/variations_associated_data.h" |
| 115 #include "components/version_info/version_info.h" | 114 #include "components/version_info/version_info.h" |
| 116 #include "content/public/browser/browser_child_process_host.h" | 115 #include "content/public/browser/browser_child_process_host.h" |
| 117 #include "content/public/browser/browser_main_parts.h" | 116 #include "content/public/browser/browser_main_parts.h" |
| 118 #include "content/public/browser/browser_ppapi_host.h" | 117 #include "content/public/browser/browser_ppapi_host.h" |
| 119 #include "content/public/browser/browser_thread.h" | 118 #include "content/public/browser/browser_thread.h" |
| 120 #include "content/public/browser/browser_url_handler.h" | 119 #include "content/public/browser/browser_url_handler.h" |
| 121 #include "content/public/browser/child_process_data.h" | 120 #include "content/public/browser/child_process_data.h" |
| 122 #include "content/public/browser/child_process_security_policy.h" | 121 #include "content/public/browser/child_process_security_policy.h" |
| 123 #include "content/public/browser/client_certificate_delegate.h" | 122 #include "content/public/browser/client_certificate_delegate.h" |
| 124 #include "content/public/browser/navigation_handle.h" | |
| 125 #include "content/public/browser/navigation_throttle.h" | |
| 126 #include "content/public/browser/render_frame_host.h" | 123 #include "content/public/browser/render_frame_host.h" |
| 127 #include "content/public/browser/render_process_host.h" | 124 #include "content/public/browser/render_process_host.h" |
| 128 #include "content/public/browser/render_view_host.h" | 125 #include "content/public/browser/render_view_host.h" |
| 129 #include "content/public/browser/resource_context.h" | 126 #include "content/public/browser/resource_context.h" |
| 130 #include "content/public/browser/site_instance.h" | 127 #include "content/public/browser/site_instance.h" |
| 131 #include "content/public/browser/web_contents.h" | 128 #include "content/public/browser/web_contents.h" |
| 132 #include "content/public/common/child_process_host.h" | 129 #include "content/public/common/child_process_host.h" |
| 133 #include "content/public/common/content_descriptors.h" | 130 #include "content/public/common/content_descriptors.h" |
| 134 #include "content/public/common/sandbox_type.h" | 131 #include "content/public/common/sandbox_type.h" |
| 135 #include "content/public/common/service_registry.h" | 132 #include "content/public/common/service_registry.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 #include "chromeos/chromeos_switches.h" | 166 #include "chromeos/chromeos_switches.h" |
| 170 #include "components/user_manager/user_manager.h" | 167 #include "components/user_manager/user_manager.h" |
| 171 #elif defined(OS_LINUX) | 168 #elif defined(OS_LINUX) |
| 172 #include "chrome/browser/chrome_browser_main_linux.h" | 169 #include "chrome/browser/chrome_browser_main_linux.h" |
| 173 #elif defined(OS_ANDROID) | 170 #elif defined(OS_ANDROID) |
| 174 #include "chrome/browser/android/new_tab_page_url_handler.h" | 171 #include "chrome/browser/android/new_tab_page_url_handler.h" |
| 175 #include "chrome/browser/android/webapps/single_tab_mode_tab_helper.h" | 172 #include "chrome/browser/android/webapps/single_tab_mode_tab_helper.h" |
| 176 #include "chrome/browser/chrome_browser_main_android.h" | 173 #include "chrome/browser/chrome_browser_main_android.h" |
| 177 #include "chrome/common/descriptors_android.h" | 174 #include "chrome/common/descriptors_android.h" |
| 178 #include "components/crash/content/browser/crash_dump_manager_android.h" | 175 #include "components/crash/content/browser/crash_dump_manager_android.h" |
| 179 #include "components/navigation_interception/intercept_navigation_delegate.h" | |
| 180 #include "components/service_tab_launcher/browser/android/service_tab_launcher.h
" | 176 #include "components/service_tab_launcher/browser/android/service_tab_launcher.h
" |
| 181 #include "ui/base/resource/resource_bundle_android.h" | 177 #include "ui/base/resource/resource_bundle_android.h" |
| 182 #elif defined(OS_POSIX) | 178 #elif defined(OS_POSIX) |
| 183 #include "chrome/browser/chrome_browser_main_posix.h" | 179 #include "chrome/browser/chrome_browser_main_posix.h" |
| 184 #endif | 180 #endif |
| 185 | 181 |
| 186 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 182 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 187 #include "base/debug/leak_annotations.h" | 183 #include "base/debug/leak_annotations.h" |
| 188 #include "components/crash/content/app/breakpad_linux.h" | 184 #include "components/crash/content/app/breakpad_linux.h" |
| 189 #include "components/crash/content/browser/crash_handler_host_linux.h" | 185 #include "components/crash/content/browser/crash_handler_host_linux.h" |
| (...skipping 2405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2595 } | 2591 } |
| 2596 | 2592 |
| 2597 void ChromeContentBrowserClient::RecordURLMetric(const std::string& metric, | 2593 void ChromeContentBrowserClient::RecordURLMetric(const std::string& metric, |
| 2598 const GURL& url) { | 2594 const GURL& url) { |
| 2599 if (url.is_valid()) { | 2595 if (url.is_valid()) { |
| 2600 rappor::SampleDomainAndRegistryFromGURL(g_browser_process->rappor_service(), | 2596 rappor::SampleDomainAndRegistryFromGURL(g_browser_process->rappor_service(), |
| 2601 metric, url); | 2597 metric, url); |
| 2602 } | 2598 } |
| 2603 } | 2599 } |
| 2604 | 2600 |
| 2605 ScopedVector<content::NavigationThrottle> | |
| 2606 ChromeContentBrowserClient::CreateThrottlesForNavigation( | |
| 2607 content::NavigationHandle* handle) { | |
| 2608 ScopedVector<content::NavigationThrottle> throttles; | |
| 2609 #if defined(OS_ANDROID) | |
| 2610 // TODO(davidben): This is insufficient to integrate with prerender properly. | |
| 2611 // https://crbug.com/370595 | |
| 2612 prerender::PrerenderContents* prerender_contents = | |
| 2613 prerender::PrerenderContents::FromWebContents(handle->GetWebContents()); | |
| 2614 if (!prerender_contents && handle->IsInMainFrame()) { | |
| 2615 throttles.push_back( | |
| 2616 navigation_interception::InterceptNavigationDelegate::CreateThrottleFor( | |
| 2617 handle) | |
| 2618 .Pass()); | |
| 2619 } | |
| 2620 #else | |
| 2621 if (handle->IsInMainFrame()) { | |
| 2622 // Redirect some navigations to apps that have registered matching URL | |
| 2623 // handlers ('url_handlers' in the manifest). | |
| 2624 scoped_ptr<content::NavigationThrottle> url_to_app_throttle = | |
| 2625 AppUrlRedirector::MaybeCreateThrottleFor(handle); | |
| 2626 if (url_to_app_throttle) | |
| 2627 throttles.push_back(url_to_app_throttle.Pass()); | |
| 2628 } | |
| 2629 #endif | |
| 2630 return throttles.Pass(); | |
| 2631 } | |
| 2632 | |
| 2633 content::DevToolsManagerDelegate* | 2601 content::DevToolsManagerDelegate* |
| 2634 ChromeContentBrowserClient::GetDevToolsManagerDelegate() { | 2602 ChromeContentBrowserClient::GetDevToolsManagerDelegate() { |
| 2635 return new ChromeDevToolsManagerDelegate(); | 2603 return new ChromeDevToolsManagerDelegate(); |
| 2636 } | 2604 } |
| 2637 | 2605 |
| 2638 content::TracingDelegate* ChromeContentBrowserClient::GetTracingDelegate() { | 2606 content::TracingDelegate* ChromeContentBrowserClient::GetTracingDelegate() { |
| 2639 #if !defined(OS_ANDROID) | 2607 #if !defined(OS_ANDROID) |
| 2640 return new ChromeTracingDelegate(); | 2608 return new ChromeTracingDelegate(); |
| 2641 #else | 2609 #else |
| 2642 return nullptr; | 2610 return nullptr; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2701 if (channel <= kMaxDisableEncryptionChannel) { | 2669 if (channel <= kMaxDisableEncryptionChannel) { |
| 2702 static const char* const kWebRtcDevSwitchNames[] = { | 2670 static const char* const kWebRtcDevSwitchNames[] = { |
| 2703 switches::kDisableWebRtcEncryption, | 2671 switches::kDisableWebRtcEncryption, |
| 2704 }; | 2672 }; |
| 2705 to_command_line->CopySwitchesFrom(from_command_line, | 2673 to_command_line->CopySwitchesFrom(from_command_line, |
| 2706 kWebRtcDevSwitchNames, | 2674 kWebRtcDevSwitchNames, |
| 2707 arraysize(kWebRtcDevSwitchNames)); | 2675 arraysize(kWebRtcDevSwitchNames)); |
| 2708 } | 2676 } |
| 2709 } | 2677 } |
| 2710 #endif // defined(ENABLE_WEBRTC) | 2678 #endif // defined(ENABLE_WEBRTC) |
| OLD | NEW |