Chromium Code Reviews| 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 "content/browser/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 3465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3476 RecordAction(base::UserMetricsAction("SSL.RanInsecureContent")); | 3476 RecordAction(base::UserMetricsAction("SSL.RanInsecureContent")); |
| 3477 if (base::EndsWith(security_origin.spec(), kDotGoogleDotCom, | 3477 if (base::EndsWith(security_origin.spec(), kDotGoogleDotCom, |
| 3478 base::CompareCase::INSENSITIVE_ASCII)) | 3478 base::CompareCase::INSENSITIVE_ASCII)) |
| 3479 RecordAction(base::UserMetricsAction("SSL.RanInsecureContentGoogle")); | 3479 RecordAction(base::UserMetricsAction("SSL.RanInsecureContentGoogle")); |
| 3480 controller_.ssl_manager()->DidRunInsecureContent(security_origin); | 3480 controller_.ssl_manager()->DidRunInsecureContent(security_origin); |
| 3481 SSLManager::NotifySSLInternalStateChanged( | 3481 SSLManager::NotifySSLInternalStateChanged( |
| 3482 GetController().GetBrowserContext()); | 3482 GetController().GetBrowserContext()); |
| 3483 } | 3483 } |
| 3484 | 3484 |
| 3485 void WebContentsImpl::OnDidDisplayContentWithCertificateErrors( | 3485 void WebContentsImpl::OnDidDisplayContentWithCertificateErrors( |
| 3486 const GURL& url, | 3486 const GURL& url) { |
| 3487 const std::string& security_info) { | |
| 3488 // Check that the main frame navigation entry has a cryptographic | 3487 // Check that the main frame navigation entry has a cryptographic |
| 3489 // scheme; the security UI is associated with the main frame rather | 3488 // scheme; the security UI is associated with the main frame rather |
| 3490 // than the subframe (if any) that actually displayed the subresource | 3489 // than the subframe (if any) that actually displayed the subresource |
| 3491 // with errors. | 3490 // with errors. |
| 3492 NavigationEntry* entry = controller_.GetLastCommittedEntry(); | 3491 NavigationEntry* entry = controller_.GetLastCommittedEntry(); |
| 3493 if (!entry || !entry->GetURL().SchemeIsCryptographic()) | 3492 if (!entry || !entry->GetURL().SchemeIsCryptographic()) |
| 3494 return; | 3493 return; |
| 3495 | 3494 |
| 3496 SSLStatus ssl; | |
| 3497 if (!DeserializeSecurityInfo(security_info, &ssl)) { | |
| 3498 bad_message::ReceivedBadMessage( | |
| 3499 GetRenderProcessHost(), | |
| 3500 bad_message::WC_CONTENT_WITH_CERT_ERRORS_BAD_SECURITY_INFO); | |
|
nasko
2016/07/21 21:52:09
nit: Let's mark this value as no longer used in th
jam
2016/07/21 22:44:05
I've updated the header per the other example ther
| |
| 3501 return; | |
| 3502 } | |
| 3503 | |
| 3504 displayed_insecure_content_ = true; | 3495 displayed_insecure_content_ = true; |
| 3505 SSLManager::NotifySSLInternalStateChanged( | 3496 SSLManager::NotifySSLInternalStateChanged( |
| 3506 GetController().GetBrowserContext()); | 3497 GetController().GetBrowserContext()); |
| 3507 } | 3498 } |
| 3508 | 3499 |
| 3509 void WebContentsImpl::OnDidRunContentWithCertificateErrors( | 3500 void WebContentsImpl::OnDidRunContentWithCertificateErrors( |
| 3510 const GURL& url, | 3501 const GURL& url) { |
| 3511 const std::string& security_info) { | |
| 3512 // Check that the main frame navigation entry has a cryptographic | 3502 // Check that the main frame navigation entry has a cryptographic |
| 3513 // scheme; the security UI is associated with the main frame rather | 3503 // scheme; the security UI is associated with the main frame rather |
| 3514 // than the subframe (if any) that actually displayed the subresource | 3504 // than the subframe (if any) that actually displayed the subresource |
| 3515 // with errors. | 3505 // with errors. |
| 3516 NavigationEntry* entry = controller_.GetLastCommittedEntry(); | 3506 NavigationEntry* entry = controller_.GetLastCommittedEntry(); |
| 3517 if (!entry || !entry->GetURL().SchemeIsCryptographic()) | 3507 if (!entry || !entry->GetURL().SchemeIsCryptographic()) |
| 3518 return; | 3508 return; |
| 3519 | 3509 |
| 3520 SSLStatus ssl; | |
| 3521 if (!DeserializeSecurityInfo(security_info, &ssl)) { | |
| 3522 bad_message::ReceivedBadMessage( | |
| 3523 GetRenderProcessHost(), | |
| 3524 bad_message::WC_CONTENT_WITH_CERT_ERRORS_BAD_SECURITY_INFO); | |
| 3525 return; | |
| 3526 } | |
| 3527 | |
| 3528 // TODO(estark): check that this does something reasonable for | 3510 // TODO(estark): check that this does something reasonable for |
| 3529 // about:blank and sandboxed origins. https://crbug.com/609527 | 3511 // about:blank and sandboxed origins. https://crbug.com/609527 |
| 3530 controller_.ssl_manager()->DidRunInsecureContent(entry->GetURL().GetOrigin()); | 3512 controller_.ssl_manager()->DidRunInsecureContent(entry->GetURL().GetOrigin()); |
| 3531 SSLManager::NotifySSLInternalStateChanged( | 3513 SSLManager::NotifySSLInternalStateChanged( |
| 3532 GetController().GetBrowserContext()); | 3514 GetController().GetBrowserContext()); |
| 3533 } | 3515 } |
| 3534 | 3516 |
| 3535 void WebContentsImpl::OnDocumentLoadedInFrame() { | 3517 void WebContentsImpl::OnDocumentLoadedInFrame() { |
| 3536 if (!HasValidFrameSource()) | 3518 if (!HasValidFrameSource()) |
| 3537 return; | 3519 return; |
| (...skipping 1638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5176 for (RenderViewHost* render_view_host : render_view_host_set) | 5158 for (RenderViewHost* render_view_host : render_view_host_set) |
| 5177 render_view_host->OnWebkitPreferencesChanged(); | 5159 render_view_host->OnWebkitPreferencesChanged(); |
| 5178 } | 5160 } |
| 5179 | 5161 |
| 5180 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( | 5162 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( |
| 5181 JavaScriptDialogManager* dialog_manager) { | 5163 JavaScriptDialogManager* dialog_manager) { |
| 5182 dialog_manager_ = dialog_manager; | 5164 dialog_manager_ = dialog_manager; |
| 5183 } | 5165 } |
| 5184 | 5166 |
| 5185 } // namespace content | 5167 } // namespace content |
| OLD | NEW |