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 2405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2590 } | 2594 } |
2591 | 2595 |
2592 void ChromeContentBrowserClient::RecordURLMetric(const std::string& metric, | 2596 void ChromeContentBrowserClient::RecordURLMetric(const std::string& metric, |
2593 const GURL& url) { | 2597 const GURL& url) { |
2594 if (url.is_valid()) { | 2598 if (url.is_valid()) { |
2595 rappor::SampleDomainAndRegistryFromGURL(g_browser_process->rappor_service(), | 2599 rappor::SampleDomainAndRegistryFromGURL(g_browser_process->rappor_service(), |
2596 metric, url); | 2600 metric, url); |
2597 } | 2601 } |
2598 } | 2602 } |
2599 | 2603 |
| 2604 ScopedVector<content::NavigationThrottle> |
| 2605 ChromeContentBrowserClient::CreateThrottlesForNavigation( |
| 2606 content::NavigationHandle* handle) { |
| 2607 ScopedVector<content::NavigationThrottle> throttles; |
| 2608 #if defined(OS_ANDROID) |
| 2609 // TODO(davidben): This is insufficient to integrate with prerender properly. |
| 2610 // https://crbug.com/370595 |
| 2611 prerender::PrerenderContents* prerender_contents = |
| 2612 prerender::PrerenderContents::FromWebContents(web_contents); |
| 2613 if (!prerender_contents && handle->IsInMainFrame()) { |
| 2614 throttles.push_back( |
| 2615 navigation_interception::InterceptNavigationDelegate::CreateThrottleFor( |
| 2616 handle) |
| 2617 .Pass()); |
| 2618 } |
| 2619 #else |
| 2620 if (handle->IsInMainFrame()) { |
| 2621 // Redirect some navigations to apps that have registered matching URL |
| 2622 // handlers ('url_handlers' in the manifest). |
| 2623 scoped_ptr<content::NavigationThrottle> url_to_app_throttle = |
| 2624 AppUrlRedirector::MaybeCreateThrottleFor(handle); |
| 2625 if (url_to_app_throttle) |
| 2626 throttles.push_back(url_to_app_throttle.Pass()); |
| 2627 } |
| 2628 #endif |
| 2629 return throttles.Pass(); |
| 2630 } |
| 2631 |
2600 content::DevToolsManagerDelegate* | 2632 content::DevToolsManagerDelegate* |
2601 ChromeContentBrowserClient::GetDevToolsManagerDelegate() { | 2633 ChromeContentBrowserClient::GetDevToolsManagerDelegate() { |
2602 return new ChromeDevToolsManagerDelegate(); | 2634 return new ChromeDevToolsManagerDelegate(); |
2603 } | 2635 } |
2604 | 2636 |
2605 content::TracingDelegate* ChromeContentBrowserClient::GetTracingDelegate() { | 2637 content::TracingDelegate* ChromeContentBrowserClient::GetTracingDelegate() { |
2606 #if !defined(OS_ANDROID) | 2638 #if !defined(OS_ANDROID) |
2607 return new ChromeTracingDelegate(); | 2639 return new ChromeTracingDelegate(); |
2608 #else | 2640 #else |
2609 return nullptr; | 2641 return nullptr; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2670 switches::kDisableWebRtcEncryption, | 2702 switches::kDisableWebRtcEncryption, |
2671 }; | 2703 }; |
2672 to_command_line->CopySwitchesFrom(from_command_line, | 2704 to_command_line->CopySwitchesFrom(from_command_line, |
2673 kWebRtcDevSwitchNames, | 2705 kWebRtcDevSwitchNames, |
2674 arraysize(kWebRtcDevSwitchNames)); | 2706 arraysize(kWebRtcDevSwitchNames)); |
2675 } | 2707 } |
2676 } | 2708 } |
2677 #endif // defined(ENABLE_WEBRTC) | 2709 #endif // defined(ENABLE_WEBRTC) |
2678 | 2710 |
2679 } // namespace chrome | 2711 } // namespace chrome |
OLD | NEW |