| 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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 this), | 400 this), |
| 401 is_load_to_different_document_(false), | 401 is_load_to_different_document_(false), |
| 402 crashed_status_(base::TERMINATION_STATUS_STILL_RUNNING), | 402 crashed_status_(base::TERMINATION_STATUS_STILL_RUNNING), |
| 403 crashed_error_code_(0), | 403 crashed_error_code_(0), |
| 404 waiting_for_response_(false), | 404 waiting_for_response_(false), |
| 405 load_state_(net::LOAD_STATE_IDLE, base::string16()), | 405 load_state_(net::LOAD_STATE_IDLE, base::string16()), |
| 406 upload_size_(0), | 406 upload_size_(0), |
| 407 upload_position_(0), | 407 upload_position_(0), |
| 408 is_resume_pending_(false), | 408 is_resume_pending_(false), |
| 409 displayed_insecure_content_(false), | 409 displayed_insecure_content_(false), |
| 410 displayed_content_with_cert_errors_(false), |
| 410 has_accessed_initial_document_(false), | 411 has_accessed_initial_document_(false), |
| 411 theme_color_(SK_ColorTRANSPARENT), | 412 theme_color_(SK_ColorTRANSPARENT), |
| 412 last_sent_theme_color_(SK_ColorTRANSPARENT), | 413 last_sent_theme_color_(SK_ColorTRANSPARENT), |
| 413 did_first_visually_non_empty_paint_(false), | 414 did_first_visually_non_empty_paint_(false), |
| 414 capturer_count_(0), | 415 capturer_count_(0), |
| 415 should_normally_be_visible_(true), | 416 should_normally_be_visible_(true), |
| 416 did_first_set_visible_(false), | 417 did_first_set_visible_(false), |
| 417 is_being_destroyed_(false), | 418 is_being_destroyed_(false), |
| 418 notify_disconnection_(false), | 419 notify_disconnection_(false), |
| 419 dialog_manager_(NULL), | 420 dialog_manager_(NULL), |
| (...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1178 } | 1179 } |
| 1179 | 1180 |
| 1180 const std::string& WebContentsImpl::GetEncoding() const { | 1181 const std::string& WebContentsImpl::GetEncoding() const { |
| 1181 return canonical_encoding_; | 1182 return canonical_encoding_; |
| 1182 } | 1183 } |
| 1183 | 1184 |
| 1184 bool WebContentsImpl::DisplayedInsecureContent() const { | 1185 bool WebContentsImpl::DisplayedInsecureContent() const { |
| 1185 return displayed_insecure_content_; | 1186 return displayed_insecure_content_; |
| 1186 } | 1187 } |
| 1187 | 1188 |
| 1189 bool WebContentsImpl::DisplayedContentWithCertErrors() const { |
| 1190 return displayed_content_with_cert_errors_; |
| 1191 } |
| 1192 |
| 1188 void WebContentsImpl::IncrementCapturerCount(const gfx::Size& capture_size) { | 1193 void WebContentsImpl::IncrementCapturerCount(const gfx::Size& capture_size) { |
| 1189 DCHECK(!is_being_destroyed_); | 1194 DCHECK(!is_being_destroyed_); |
| 1190 ++capturer_count_; | 1195 ++capturer_count_; |
| 1191 DVLOG(1) << "There are now " << capturer_count_ | 1196 DVLOG(1) << "There are now " << capturer_count_ |
| 1192 << " capturing(s) of WebContentsImpl@" << this; | 1197 << " capturing(s) of WebContentsImpl@" << this; |
| 1193 | 1198 |
| 1194 // Note: This provides a hint to upstream code to size the views optimally | 1199 // Note: This provides a hint to upstream code to size the views optimally |
| 1195 // for quality (e.g., to avoid scaling). | 1200 // for quality (e.g., to avoid scaling). |
| 1196 if (!capture_size.IsEmpty() && preferred_size_for_capture_.IsEmpty()) { | 1201 if (!capture_size.IsEmpty() && preferred_size_for_capture_.IsEmpty()) { |
| 1197 preferred_size_for_capture_ = capture_size; | 1202 preferred_size_for_capture_ = capture_size; |
| (...skipping 2297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3495 if (base::EndsWith(security_origin.spec(), kDotGoogleDotCom, | 3500 if (base::EndsWith(security_origin.spec(), kDotGoogleDotCom, |
| 3496 base::CompareCase::INSENSITIVE_ASCII)) | 3501 base::CompareCase::INSENSITIVE_ASCII)) |
| 3497 RecordAction(base::UserMetricsAction("SSL.RanInsecureContentGoogle")); | 3502 RecordAction(base::UserMetricsAction("SSL.RanInsecureContentGoogle")); |
| 3498 controller_.ssl_manager()->DidRunInsecureContent(security_origin); | 3503 controller_.ssl_manager()->DidRunInsecureContent(security_origin); |
| 3499 SSLManager::NotifySSLInternalStateChanged( | 3504 SSLManager::NotifySSLInternalStateChanged( |
| 3500 GetController().GetBrowserContext()); | 3505 GetController().GetBrowserContext()); |
| 3501 } | 3506 } |
| 3502 | 3507 |
| 3503 void WebContentsImpl::OnDidDisplayContentWithCertificateErrors( | 3508 void WebContentsImpl::OnDidDisplayContentWithCertificateErrors( |
| 3504 const GURL& url) { | 3509 const GURL& url) { |
| 3505 // Check that the main frame navigation entry has a cryptographic | 3510 displayed_content_with_cert_errors_ = true; |
| 3506 // scheme; the security UI is associated with the main frame rather | |
| 3507 // than the subframe (if any) that actually displayed the subresource | |
| 3508 // with errors. | |
| 3509 NavigationEntry* entry = controller_.GetLastCommittedEntry(); | |
| 3510 if (!entry || !entry->GetURL().SchemeIsCryptographic()) | |
| 3511 return; | |
| 3512 | |
| 3513 displayed_insecure_content_ = true; | |
| 3514 SSLManager::NotifySSLInternalStateChanged( | 3511 SSLManager::NotifySSLInternalStateChanged( |
| 3515 GetController().GetBrowserContext()); | 3512 GetController().GetBrowserContext()); |
| 3516 } | 3513 } |
| 3517 | 3514 |
| 3518 void WebContentsImpl::OnDidRunContentWithCertificateErrors( | 3515 void WebContentsImpl::OnDidRunContentWithCertificateErrors( |
| 3519 const GURL& url) { | 3516 const GURL& url) { |
| 3520 // Check that the main frame navigation entry has a cryptographic | 3517 NavigationEntry* entry = controller_.GetVisibleEntry(); |
| 3521 // scheme; the security UI is associated with the main frame rather | 3518 if (!entry) |
| 3522 // than the subframe (if any) that actually displayed the subresource | |
| 3523 // with errors. | |
| 3524 NavigationEntry* entry = controller_.GetLastCommittedEntry(); | |
| 3525 if (!entry || !entry->GetURL().SchemeIsCryptographic()) | |
| 3526 return; | 3519 return; |
| 3527 | 3520 |
| 3528 // TODO(estark): check that this does something reasonable for | 3521 // TODO(estark): check that this does something reasonable for |
| 3529 // about:blank and sandboxed origins. https://crbug.com/609527 | 3522 // about:blank and sandboxed origins. https://crbug.com/609527 |
| 3530 controller_.ssl_manager()->DidRunInsecureContent(entry->GetURL().GetOrigin()); | 3523 controller_.ssl_manager()->DidRunContentWithCertErrors( |
| 3524 entry->GetURL().GetOrigin()); |
| 3531 SSLManager::NotifySSLInternalStateChanged( | 3525 SSLManager::NotifySSLInternalStateChanged( |
| 3532 GetController().GetBrowserContext()); | 3526 GetController().GetBrowserContext()); |
| 3533 } | 3527 } |
| 3534 | 3528 |
| 3535 void WebContentsImpl::OnDocumentLoadedInFrame() { | 3529 void WebContentsImpl::OnDocumentLoadedInFrame() { |
| 3536 if (!HasValidFrameSource()) | 3530 if (!HasValidFrameSource()) |
| 3537 return; | 3531 return; |
| 3538 | 3532 |
| 3539 RenderFrameHostImpl* rfh = | 3533 RenderFrameHostImpl* rfh = |
| 3540 static_cast<RenderFrameHostImpl*>(render_frame_message_source_); | 3534 static_cast<RenderFrameHostImpl*>(render_frame_message_source_); |
| (...skipping 1691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5232 for (RenderViewHost* render_view_host : render_view_host_set) | 5226 for (RenderViewHost* render_view_host : render_view_host_set) |
| 5233 render_view_host->OnWebkitPreferencesChanged(); | 5227 render_view_host->OnWebkitPreferencesChanged(); |
| 5234 } | 5228 } |
| 5235 | 5229 |
| 5236 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( | 5230 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( |
| 5237 JavaScriptDialogManager* dialog_manager) { | 5231 JavaScriptDialogManager* dialog_manager) { |
| 5238 dialog_manager_ = dialog_manager; | 5232 dialog_manager_ = dialog_manager; |
| 5239 } | 5233 } |
| 5240 | 5234 |
| 5241 } // namespace content | 5235 } // namespace content |
| OLD | NEW |