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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 #include "components/variations/variations_associated_data.h" | 114 #include "components/variations/variations_associated_data.h" |
114 #include "components/version_info/version_info.h" | 115 #include "components/version_info/version_info.h" |
115 #include "content/public/browser/browser_child_process_host.h" | 116 #include "content/public/browser/browser_child_process_host.h" |
116 #include "content/public/browser/browser_main_parts.h" | 117 #include "content/public/browser/browser_main_parts.h" |
117 #include "content/public/browser/browser_ppapi_host.h" | 118 #include "content/public/browser/browser_ppapi_host.h" |
118 #include "content/public/browser/browser_thread.h" | 119 #include "content/public/browser/browser_thread.h" |
119 #include "content/public/browser/browser_url_handler.h" | 120 #include "content/public/browser/browser_url_handler.h" |
120 #include "content/public/browser/child_process_data.h" | 121 #include "content/public/browser/child_process_data.h" |
121 #include "content/public/browser/child_process_security_policy.h" | 122 #include "content/public/browser/child_process_security_policy.h" |
122 #include "content/public/browser/client_certificate_delegate.h" | 123 #include "content/public/browser/client_certificate_delegate.h" |
| 124 #include "content/public/browser/navigation_handle.h" |
| 125 #include "content/public/browser/navigation_throttle.h" |
123 #include "content/public/browser/render_frame_host.h" | 126 #include "content/public/browser/render_frame_host.h" |
124 #include "content/public/browser/render_process_host.h" | 127 #include "content/public/browser/render_process_host.h" |
125 #include "content/public/browser/render_view_host.h" | 128 #include "content/public/browser/render_view_host.h" |
126 #include "content/public/browser/resource_context.h" | 129 #include "content/public/browser/resource_context.h" |
127 #include "content/public/browser/site_instance.h" | 130 #include "content/public/browser/site_instance.h" |
128 #include "content/public/browser/web_contents.h" | 131 #include "content/public/browser/web_contents.h" |
129 #include "content/public/common/child_process_host.h" | 132 #include "content/public/common/child_process_host.h" |
130 #include "content/public/common/content_descriptors.h" | 133 #include "content/public/common/content_descriptors.h" |
131 #include "content/public/common/sandbox_type.h" | 134 #include "content/public/common/sandbox_type.h" |
132 #include "content/public/common/service_registry.h" | 135 #include "content/public/common/service_registry.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 #include "chromeos/chromeos_switches.h" | 169 #include "chromeos/chromeos_switches.h" |
167 #include "components/user_manager/user_manager.h" | 170 #include "components/user_manager/user_manager.h" |
168 #elif defined(OS_LINUX) | 171 #elif defined(OS_LINUX) |
169 #include "chrome/browser/chrome_browser_main_linux.h" | 172 #include "chrome/browser/chrome_browser_main_linux.h" |
170 #elif defined(OS_ANDROID) | 173 #elif defined(OS_ANDROID) |
171 #include "chrome/browser/android/new_tab_page_url_handler.h" | 174 #include "chrome/browser/android/new_tab_page_url_handler.h" |
172 #include "chrome/browser/android/webapps/single_tab_mode_tab_helper.h" | 175 #include "chrome/browser/android/webapps/single_tab_mode_tab_helper.h" |
173 #include "chrome/browser/chrome_browser_main_android.h" | 176 #include "chrome/browser/chrome_browser_main_android.h" |
174 #include "chrome/common/descriptors_android.h" | 177 #include "chrome/common/descriptors_android.h" |
175 #include "components/crash/content/browser/crash_dump_manager_android.h" | 178 #include "components/crash/content/browser/crash_dump_manager_android.h" |
| 179 #include "components/navigation_interception/intercept_navigation_delegate.h" |
176 #include "components/service_tab_launcher/browser/android/service_tab_launcher.h
" | 180 #include "components/service_tab_launcher/browser/android/service_tab_launcher.h
" |
177 #include "ui/base/resource/resource_bundle_android.h" | 181 #include "ui/base/resource/resource_bundle_android.h" |
178 #elif defined(OS_POSIX) | 182 #elif defined(OS_POSIX) |
179 #include "chrome/browser/chrome_browser_main_posix.h" | 183 #include "chrome/browser/chrome_browser_main_posix.h" |
180 #endif | 184 #endif |
181 | 185 |
182 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 186 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
183 #include "base/debug/leak_annotations.h" | 187 #include "base/debug/leak_annotations.h" |
184 #include "components/crash/content/app/breakpad_linux.h" | 188 #include "components/crash/content/app/breakpad_linux.h" |
185 #include "components/crash/content/browser/crash_handler_host_linux.h" | 189 #include "components/crash/content/browser/crash_handler_host_linux.h" |
(...skipping 2405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2591 } | 2595 } |
2592 | 2596 |
2593 void ChromeContentBrowserClient::RecordURLMetric(const std::string& metric, | 2597 void ChromeContentBrowserClient::RecordURLMetric(const std::string& metric, |
2594 const GURL& url) { | 2598 const GURL& url) { |
2595 if (url.is_valid()) { | 2599 if (url.is_valid()) { |
2596 rappor::SampleDomainAndRegistryFromGURL(g_browser_process->rappor_service(), | 2600 rappor::SampleDomainAndRegistryFromGURL(g_browser_process->rappor_service(), |
2597 metric, url); | 2601 metric, url); |
2598 } | 2602 } |
2599 } | 2603 } |
2600 | 2604 |
| 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 |
2601 content::DevToolsManagerDelegate* | 2633 content::DevToolsManagerDelegate* |
2602 ChromeContentBrowserClient::GetDevToolsManagerDelegate() { | 2634 ChromeContentBrowserClient::GetDevToolsManagerDelegate() { |
2603 return new ChromeDevToolsManagerDelegate(); | 2635 return new ChromeDevToolsManagerDelegate(); |
2604 } | 2636 } |
2605 | 2637 |
2606 content::TracingDelegate* ChromeContentBrowserClient::GetTracingDelegate() { | 2638 content::TracingDelegate* ChromeContentBrowserClient::GetTracingDelegate() { |
2607 #if !defined(OS_ANDROID) | 2639 #if !defined(OS_ANDROID) |
2608 return new ChromeTracingDelegate(); | 2640 return new ChromeTracingDelegate(); |
2609 #else | 2641 #else |
2610 return nullptr; | 2642 return nullptr; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2669 if (channel <= kMaxDisableEncryptionChannel) { | 2701 if (channel <= kMaxDisableEncryptionChannel) { |
2670 static const char* const kWebRtcDevSwitchNames[] = { | 2702 static const char* const kWebRtcDevSwitchNames[] = { |
2671 switches::kDisableWebRtcEncryption, | 2703 switches::kDisableWebRtcEncryption, |
2672 }; | 2704 }; |
2673 to_command_line->CopySwitchesFrom(from_command_line, | 2705 to_command_line->CopySwitchesFrom(from_command_line, |
2674 kWebRtcDevSwitchNames, | 2706 kWebRtcDevSwitchNames, |
2675 arraysize(kWebRtcDevSwitchNames)); | 2707 arraysize(kWebRtcDevSwitchNames)); |
2676 } | 2708 } |
2677 } | 2709 } |
2678 #endif // defined(ENABLE_WEBRTC) | 2710 #endif // defined(ENABLE_WEBRTC) |
OLD | NEW |