| 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 1765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1776 NOTREACHED(); | 1776 NOTREACHED(); |
| 1777 return; | 1777 return; |
| 1778 } | 1778 } |
| 1779 WebContents* tab = WebContents::FromRenderFrameHost(render_frame_host); | 1779 WebContents* tab = WebContents::FromRenderFrameHost(render_frame_host); |
| 1780 if (!tab) { | 1780 if (!tab) { |
| 1781 NOTREACHED(); | 1781 NOTREACHED(); |
| 1782 return; | 1782 return; |
| 1783 } | 1783 } |
| 1784 | 1784 |
| 1785 prerender::PrerenderContents* prerender_contents = | 1785 prerender::PrerenderContents* prerender_contents = |
| 1786 prerender::PrerenderContents::FromWebContents(tab); | 1786 prerender::PrerenderContents::FromWebContents(tab); |
| 1787 if (prerender_contents) { | 1787 if (prerender_contents) { |
| 1788 prerender_contents->Destroy(prerender::FINAL_STATUS_SSL_ERROR); | 1788 prerender_contents->Destroy(prerender::FINAL_STATUS_SSL_ERROR); |
| 1789 *result = content::CERTIFICATE_REQUEST_RESULT_TYPE_CANCEL; | 1789 *result = content::CERTIFICATE_REQUEST_RESULT_TYPE_CANCEL; |
| 1790 return; | 1790 return; |
| 1791 } | 1791 } |
| 1792 | 1792 |
| 1793 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) | 1793 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) |
| 1794 captive_portal::CaptivePortalTabHelper* captive_portal_tab_helper = | 1794 captive_portal::CaptivePortalTabHelper* captive_portal_tab_helper = |
| 1795 captive_portal::CaptivePortalTabHelper::FromWebContents(tab); | 1795 captive_portal::CaptivePortalTabHelper::FromWebContents(tab); |
| 1796 if (captive_portal_tab_helper) | 1796 if (captive_portal_tab_helper) |
| 1797 captive_portal_tab_helper->OnSSLCertError(ssl_info); | 1797 captive_portal_tab_helper->OnSSLCertError(ssl_info); |
| 1798 #endif | 1798 #endif |
| 1799 | 1799 |
| 1800 // Otherwise, display an SSL blocking page. | 1800 // Otherwise, display an SSL blocking page. |
| 1801 new SSLBlockingPage(tab, cert_error, ssl_info, request_url, overridable, | 1801 new SSLBlockingPage(tab, cert_error, ssl_info, request_url, overridable, |
| 1802 strict_enforcement, callback); | 1802 strict_enforcement, callback); |
| 1803 } | 1803 } |
| 1804 | 1804 |
| 1805 void ChromeContentBrowserClient::SelectClientCertificate( | 1805 void ChromeContentBrowserClient::SelectClientCertificate( |
| 1806 int render_process_id, | 1806 int render_process_id, |
| 1807 int render_frame_id, | 1807 int render_frame_id, |
| 1808 const net::HttpNetworkSession* network_session, | 1808 const net::HttpNetworkSession* network_session, |
| 1809 net::SSLCertRequestInfo* cert_request_info, | 1809 net::SSLCertRequestInfo* cert_request_info, |
| 1810 const base::Callback<void(net::X509Certificate*)>& callback) { | 1810 const base::Callback<void(net::X509Certificate*)>& callback) { |
| 1811 content::RenderFrameHost* rfh = content::RenderFrameHost::FromID( | 1811 content::RenderFrameHost* rfh = content::RenderFrameHost::FromID( |
| 1812 render_process_id, render_frame_id); | 1812 render_process_id, render_frame_id); |
| 1813 if (!rfh) { | |
| 1814 NOTREACHED(); | |
| 1815 return; | |
| 1816 } | |
| 1817 | |
| 1818 WebContents* tab = WebContents::FromRenderFrameHost(rfh); | 1813 WebContents* tab = WebContents::FromRenderFrameHost(rfh); |
| 1819 if (!tab) { | 1814 if (!tab) { |
| 1820 NOTREACHED(); | 1815 NOTREACHED(); |
| 1821 return; | 1816 return; |
| 1822 } | 1817 } |
| 1823 | 1818 |
| 1819 prerender::PrerenderContents* prerender_contents = |
| 1820 prerender::PrerenderContents::FromWebContents(tab); |
| 1821 if (prerender_contents) { |
| 1822 prerender_contents->Destroy( |
| 1823 prerender::FINAL_STATUS_SSL_CLIENT_CERTIFICATE_REQUESTED); |
| 1824 return; |
| 1825 } |
| 1826 |
| 1824 GURL requesting_url("https://" + cert_request_info->host_and_port.ToString()); | 1827 GURL requesting_url("https://" + cert_request_info->host_and_port.ToString()); |
| 1825 DCHECK(requesting_url.is_valid()) | 1828 DCHECK(requesting_url.is_valid()) |
| 1826 << "Invalid URL string: https://" | 1829 << "Invalid URL string: https://" |
| 1827 << cert_request_info->host_and_port.ToString(); | 1830 << cert_request_info->host_and_port.ToString(); |
| 1828 | 1831 |
| 1829 Profile* profile = Profile::FromBrowserContext(tab->GetBrowserContext()); | 1832 Profile* profile = Profile::FromBrowserContext(tab->GetBrowserContext()); |
| 1830 scoped_ptr<base::Value> filter( | 1833 scoped_ptr<base::Value> filter( |
| 1831 profile->GetHostContentSettingsMap()->GetWebsiteSetting( | 1834 profile->GetHostContentSettingsMap()->GetWebsiteSetting( |
| 1832 requesting_url, | 1835 requesting_url, |
| 1833 requesting_url, | 1836 requesting_url, |
| (...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2652 // releases of Chrome. Permitting "Unknown" allows these APIs to be used on | 2655 // releases of Chrome. Permitting "Unknown" allows these APIs to be used on |
| 2653 // Chromium builds as well. | 2656 // Chromium builds as well. |
| 2654 return channel <= chrome::VersionInfo::CHANNEL_DEV; | 2657 return channel <= chrome::VersionInfo::CHANNEL_DEV; |
| 2655 #else | 2658 #else |
| 2656 return false; | 2659 return false; |
| 2657 #endif | 2660 #endif |
| 2658 } | 2661 } |
| 2659 | 2662 |
| 2660 | 2663 |
| 2661 } // namespace chrome | 2664 } // namespace chrome |
| OLD | NEW |