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