| 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 <set> | 7 #include <set> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 #include "chrome/browser/guestview/adview/adview_guest.h" | 46 #include "chrome/browser/guestview/adview/adview_guest.h" |
| 47 #include "chrome/browser/guestview/guestview_constants.h" | 47 #include "chrome/browser/guestview/guestview_constants.h" |
| 48 #include "chrome/browser/guestview/webview/webview_guest.h" | 48 #include "chrome/browser/guestview/webview/webview_guest.h" |
| 49 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | 49 #include "chrome/browser/media/media_capture_devices_dispatcher.h" |
| 50 #include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h" | 50 #include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h" |
| 51 #include "chrome/browser/nacl_host/nacl_browser.h" | 51 #include "chrome/browser/nacl_host/nacl_browser.h" |
| 52 #include "chrome/browser/nacl_host/nacl_browser_delegate_impl.h" | 52 #include "chrome/browser/nacl_host/nacl_browser_delegate_impl.h" |
| 53 #include "chrome/browser/nacl_host/nacl_host_message_filter.h" | 53 #include "chrome/browser/nacl_host/nacl_host_message_filter.h" |
| 54 #include "chrome/browser/nacl_host/nacl_process_host.h" | 54 #include "chrome/browser/nacl_host/nacl_process_host.h" |
| 55 #include "chrome/browser/net/chrome_net_log.h" | 55 #include "chrome/browser/net/chrome_net_log.h" |
| 56 #include "chrome/browser/net/keygen_handler.h" |
| 56 #include "chrome/browser/notifications/desktop_notification_service.h" | 57 #include "chrome/browser/notifications/desktop_notification_service.h" |
| 57 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | 58 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
| 58 #include "chrome/browser/platform_util.h" | 59 #include "chrome/browser/platform_util.h" |
| 59 #include "chrome/browser/plugins/plugin_info_message_filter.h" | 60 #include "chrome/browser/plugins/plugin_info_message_filter.h" |
| 60 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 61 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
| 61 #include "chrome/browser/prerender/prerender_final_status.h" | 62 #include "chrome/browser/prerender/prerender_final_status.h" |
| 62 #include "chrome/browser/prerender/prerender_manager.h" | 63 #include "chrome/browser/prerender/prerender_manager.h" |
| 63 #include "chrome/browser/prerender/prerender_manager_factory.h" | 64 #include "chrome/browser/prerender/prerender_manager_factory.h" |
| 64 #include "chrome/browser/prerender/prerender_message_filter.h" | 65 #include "chrome/browser/prerender/prerender_message_filter.h" |
| 65 #include "chrome/browser/prerender/prerender_tracker.h" | 66 #include "chrome/browser/prerender/prerender_tracker.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 #include "content/public/common/url_utils.h" | 132 #include "content/public/common/url_utils.h" |
| 132 #include "extensions/browser/view_type_utils.h" | 133 #include "extensions/browser/view_type_utils.h" |
| 133 #include "extensions/common/constants.h" | 134 #include "extensions/common/constants.h" |
| 134 #include "extensions/common/switches.h" | 135 #include "extensions/common/switches.h" |
| 135 #include "grit/generated_resources.h" | 136 #include "grit/generated_resources.h" |
| 136 #include "grit/ui_resources.h" | 137 #include "grit/ui_resources.h" |
| 137 #include "net/base/escape.h" | 138 #include "net/base/escape.h" |
| 138 #include "net/base/mime_util.h" | 139 #include "net/base/mime_util.h" |
| 139 #include "net/cookies/canonical_cookie.h" | 140 #include "net/cookies/canonical_cookie.h" |
| 140 #include "net/cookies/cookie_options.h" | 141 #include "net/cookies/cookie_options.h" |
| 142 #include "net/ssl/client_cert_store_impl.h" |
| 141 #include "net/ssl/ssl_cert_request_info.h" | 143 #include "net/ssl/ssl_cert_request_info.h" |
| 142 #include "ppapi/host/ppapi_host.h" | 144 #include "ppapi/host/ppapi_host.h" |
| 143 #include "ui/base/l10n/l10n_util.h" | 145 #include "ui/base/l10n/l10n_util.h" |
| 144 #include "ui/base/resource/resource_bundle.h" | 146 #include "ui/base/resource/resource_bundle.h" |
| 145 #include "ui/message_center/message_center_util.h" | 147 #include "ui/message_center/message_center_util.h" |
| 146 #include "webkit/browser/fileapi/external_mount_points.h" | 148 #include "webkit/browser/fileapi/external_mount_points.h" |
| 147 #include "webkit/common/webpreferences.h" | 149 #include "webkit/common/webpreferences.h" |
| 148 | 150 |
| 149 #if defined(OS_WIN) | 151 #if defined(OS_WIN) |
| 150 #include "chrome/browser/chrome_browser_main_win.h" | 152 #include "chrome/browser/chrome_browser_main_win.h" |
| 151 #include "sandbox/win/src/sandbox_policy.h" | 153 #include "sandbox/win/src/sandbox_policy.h" |
| 152 #elif defined(OS_MACOSX) | 154 #elif defined(OS_MACOSX) |
| 153 #include "chrome/browser/chrome_browser_main_mac.h" | 155 #include "chrome/browser/chrome_browser_main_mac.h" |
| 154 #include "chrome/browser/spellchecker/spellcheck_message_filter_mac.h" | 156 #include "chrome/browser/spellchecker/spellcheck_message_filter_mac.h" |
| 155 #include "components/breakpad/breakpad_mac.h" | 157 #include "components/breakpad/breakpad_mac.h" |
| 156 #elif defined(OS_CHROMEOS) | 158 #elif defined(OS_CHROMEOS) |
| 157 #include "chrome/browser/chromeos/chrome_browser_main_chromeos.h" | 159 #include "chrome/browser/chromeos/chrome_browser_main_chromeos.h" |
| 158 #include "chrome/browser/chromeos/drive/file_system_backend_delegate.h" | 160 #include "chrome/browser/chromeos/drive/file_system_backend_delegate.h" |
| 159 #include "chrome/browser/chromeos/fileapi/file_system_backend.h" | 161 #include "chrome/browser/chromeos/fileapi/file_system_backend.h" |
| 160 #include "chrome/browser/chromeos/login/startup_utils.h" | 162 #include "chrome/browser/chromeos/login/startup_utils.h" |
| 161 #include "chrome/browser/chromeos/login/user_manager.h" | 163 #include "chrome/browser/chromeos/login/user_manager.h" |
| 164 #include "chrome/browser/chromeos/net/client_cert_store_cros.h" |
| 162 #include "chrome/browser/chromeos/system/input_device_settings.h" | 165 #include "chrome/browser/chromeos/system/input_device_settings.h" |
| 163 #include "chromeos/chromeos_switches.h" | 166 #include "chromeos/chromeos_switches.h" |
| 164 #elif defined(OS_LINUX) | 167 #elif defined(OS_LINUX) |
| 165 #include "chrome/browser/chrome_browser_main_linux.h" | 168 #include "chrome/browser/chrome_browser_main_linux.h" |
| 166 #elif defined(OS_ANDROID) | 169 #elif defined(OS_ANDROID) |
| 167 #include "chrome/browser/android/crash_dump_manager.h" | 170 #include "chrome/browser/android/crash_dump_manager.h" |
| 168 #include "chrome/browser/android/webapps/single_tab_mode_tab_helper.h" | 171 #include "chrome/browser/android/webapps/single_tab_mode_tab_helper.h" |
| 169 #include "chrome/browser/chrome_browser_main_android.h" | 172 #include "chrome/browser/chrome_browser_main_android.h" |
| 170 #include "chrome/browser/media/encrypted_media_message_filter_android.h" | 173 #include "chrome/browser/media/encrypted_media_message_filter_android.h" |
| 171 #include "chrome/common/descriptors_android.h" | 174 #include "chrome/common/descriptors_android.h" |
| (...skipping 1584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1756 captive_portal::CaptivePortalTabHelper::FromWebContents(tab); | 1759 captive_portal::CaptivePortalTabHelper::FromWebContents(tab); |
| 1757 if (captive_portal_tab_helper) | 1760 if (captive_portal_tab_helper) |
| 1758 captive_portal_tab_helper->OnSSLCertError(ssl_info); | 1761 captive_portal_tab_helper->OnSSLCertError(ssl_info); |
| 1759 #endif | 1762 #endif |
| 1760 | 1763 |
| 1761 // Otherwise, display an SSL blocking page. | 1764 // Otherwise, display an SSL blocking page. |
| 1762 new SSLBlockingPage(tab, cert_error, ssl_info, request_url, overridable, | 1765 new SSLBlockingPage(tab, cert_error, ssl_info, request_url, overridable, |
| 1763 strict_enforcement, callback); | 1766 strict_enforcement, callback); |
| 1764 } | 1767 } |
| 1765 | 1768 |
| 1769 scoped_ptr<net::ClientCertStore> ChromeContentBrowserClient::GetClientCertStore( |
| 1770 content::ResourceContext* context) { |
| 1771 #if defined(OS_CHROMEOS) |
| 1772 return scoped_ptr<net::ClientCertStore>( |
| 1773 new chromeos::ClientCertStoreCros(context)); |
| 1774 #elif !defined(USE_OPENSSL) |
| 1775 return scoped_ptr<net::ClientCertStore>(new net::ClientCertStoreImpl()); |
| 1776 #else |
| 1777 return scoped_ptr<net::ClientCertStore>(); |
| 1778 #endif |
| 1779 } |
| 1780 |
| 1766 void ChromeContentBrowserClient::SelectClientCertificate( | 1781 void ChromeContentBrowserClient::SelectClientCertificate( |
| 1767 int render_process_id, | 1782 int render_process_id, |
| 1768 int render_view_id, | 1783 int render_view_id, |
| 1769 const net::HttpNetworkSession* network_session, | 1784 const net::HttpNetworkSession* network_session, |
| 1770 net::SSLCertRequestInfo* cert_request_info, | 1785 net::SSLCertRequestInfo* cert_request_info, |
| 1771 const base::Callback<void(net::X509Certificate*)>& callback) { | 1786 const base::Callback<void(net::X509Certificate*)>& callback) { |
| 1772 WebContents* tab = tab_util::GetWebContentsByID( | 1787 WebContents* tab = tab_util::GetWebContentsByID( |
| 1773 render_process_id, render_view_id); | 1788 render_process_id, render_view_id); |
| 1774 if (!tab) { | 1789 if (!tab) { |
| 1775 NOTREACHED(); | 1790 NOTREACHED(); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1824 net::URLRequest* request, | 1839 net::URLRequest* request, |
| 1825 net::CertificateMimeType cert_type, | 1840 net::CertificateMimeType cert_type, |
| 1826 const void* cert_data, | 1841 const void* cert_data, |
| 1827 size_t cert_size, | 1842 size_t cert_size, |
| 1828 int render_process_id, | 1843 int render_process_id, |
| 1829 int render_view_id) { | 1844 int render_view_id) { |
| 1830 chrome::SSLAddCertificate(request, cert_type, cert_data, cert_size, | 1845 chrome::SSLAddCertificate(request, cert_type, cert_data, cert_size, |
| 1831 render_process_id, render_view_id); | 1846 render_process_id, render_view_id); |
| 1832 } | 1847 } |
| 1833 | 1848 |
| 1849 void ChromeContentBrowserClient::GenerateKey( |
| 1850 content::ResourceContext* context, |
| 1851 int key_size_in_bits, |
| 1852 const std::string& challenge, |
| 1853 const GURL& url, |
| 1854 const base::Callback<void(const std::string*)>& callback) { |
| 1855 chrome_browser_net::GenerateKey( |
| 1856 context, key_size_in_bits, challenge, url, true, callback); |
| 1857 } |
| 1858 |
| 1834 content::MediaObserver* ChromeContentBrowserClient::GetMediaObserver() { | 1859 content::MediaObserver* ChromeContentBrowserClient::GetMediaObserver() { |
| 1835 return MediaCaptureDevicesDispatcher::GetInstance(); | 1860 return MediaCaptureDevicesDispatcher::GetInstance(); |
| 1836 } | 1861 } |
| 1837 | 1862 |
| 1838 void ChromeContentBrowserClient::RequestDesktopNotificationPermission( | 1863 void ChromeContentBrowserClient::RequestDesktopNotificationPermission( |
| 1839 const GURL& source_origin, | 1864 const GURL& source_origin, |
| 1840 int callback_context, | 1865 int callback_context, |
| 1841 int render_process_id, | 1866 int render_process_id, |
| 1842 int render_view_id) { | 1867 int render_view_id) { |
| 1843 #if defined(ENABLE_NOTIFICATIONS) | 1868 #if defined(ENABLE_NOTIFICATIONS) |
| (...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2578 result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_HANDLES, | 2603 result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_HANDLES, |
| 2579 sandbox::TargetPolicy::HANDLES_DUP_ANY, | 2604 sandbox::TargetPolicy::HANDLES_DUP_ANY, |
| 2580 L"File"); | 2605 L"File"); |
| 2581 if (result != sandbox::SBOX_ALL_OK) { | 2606 if (result != sandbox::SBOX_ALL_OK) { |
| 2582 *success = false; | 2607 *success = false; |
| 2583 return; | 2608 return; |
| 2584 } | 2609 } |
| 2585 } | 2610 } |
| 2586 #endif | 2611 #endif |
| 2587 | 2612 |
| 2588 #if defined(USE_NSS) | |
| 2589 crypto::CryptoModuleBlockingPasswordDelegate* | |
| 2590 ChromeContentBrowserClient::GetCryptoPasswordDelegate( | |
| 2591 const GURL& url) { | |
| 2592 return chrome::NewCryptoModuleBlockingDialogDelegate( | |
| 2593 chrome::kCryptoModulePasswordKeygen, url.host()); | |
| 2594 } | |
| 2595 #endif | |
| 2596 | |
| 2597 bool ChromeContentBrowserClient::IsPluginAllowedToCallRequestOSFileHandle( | 2613 bool ChromeContentBrowserClient::IsPluginAllowedToCallRequestOSFileHandle( |
| 2598 content::BrowserContext* browser_context, | 2614 content::BrowserContext* browser_context, |
| 2599 const GURL& url) { | 2615 const GURL& url) { |
| 2600 #if defined(ENABLE_PLUGINS) | 2616 #if defined(ENABLE_PLUGINS) |
| 2601 Profile* profile = Profile::FromBrowserContext(browser_context); | 2617 Profile* profile = Profile::FromBrowserContext(browser_context); |
| 2602 const ExtensionSet* extension_set = NULL; | 2618 const ExtensionSet* extension_set = NULL; |
| 2603 if (profile) { | 2619 if (profile) { |
| 2604 extension_set = extensions::ExtensionSystem::Get(profile)-> | 2620 extension_set = extensions::ExtensionSystem::Get(profile)-> |
| 2605 extension_service()->extensions(); | 2621 extension_service()->extensions(); |
| 2606 } | 2622 } |
| 2607 // TODO(teravest): Populate allowed_file_handle_origins_ when FileIO is moved | 2623 // TODO(teravest): Populate allowed_file_handle_origins_ when FileIO is moved |
| 2608 // from the renderer to the browser. | 2624 // from the renderer to the browser. |
| 2609 return IsExtensionOrSharedModuleWhitelisted(url, extension_set, | 2625 return IsExtensionOrSharedModuleWhitelisted(url, extension_set, |
| 2610 allowed_file_handle_origins_) || | 2626 allowed_file_handle_origins_) || |
| 2611 IsHostAllowedByCommandLine(url, extension_set, | 2627 IsHostAllowedByCommandLine(url, extension_set, |
| 2612 switches::kAllowNaClFileHandleAPI); | 2628 switches::kAllowNaClFileHandleAPI); |
| 2613 #else | 2629 #else |
| 2614 return false; | 2630 return false; |
| 2615 #endif | 2631 #endif |
| 2616 } | 2632 } |
| 2617 | 2633 |
| 2618 } // namespace chrome | 2634 } // namespace chrome |
| OLD | NEW |