| 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_certificate_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::DisplayedContentWithCertificateErrors() const { |
| 1190 return displayed_content_with_certificate_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 2173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3371 did_first_visually_non_empty_paint_ = false; | 3376 did_first_visually_non_empty_paint_ = false; |
| 3372 | 3377 |
| 3373 // Reset theme color on navigation to new page. | 3378 // Reset theme color on navigation to new page. |
| 3374 theme_color_ = SK_ColorTRANSPARENT; | 3379 theme_color_ = SK_ColorTRANSPARENT; |
| 3375 } | 3380 } |
| 3376 | 3381 |
| 3377 if (!details.is_in_page) { | 3382 if (!details.is_in_page) { |
| 3378 // Once the main frame is navigated, we're no longer considered to have | 3383 // Once the main frame is navigated, we're no longer considered to have |
| 3379 // displayed insecure content. | 3384 // displayed insecure content. |
| 3380 displayed_insecure_content_ = false; | 3385 displayed_insecure_content_ = false; |
| 3386 displayed_content_with_certificate_errors_ = false; |
| 3381 SSLManager::NotifySSLInternalStateChanged( | 3387 SSLManager::NotifySSLInternalStateChanged( |
| 3382 GetController().GetBrowserContext()); | 3388 GetController().GetBrowserContext()); |
| 3383 } | 3389 } |
| 3384 | 3390 |
| 3385 // Notify observers about navigation. | 3391 // Notify observers about navigation. |
| 3386 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 3392 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 3387 DidNavigateMainFrame(details, params)); | 3393 DidNavigateMainFrame(details, params)); |
| 3388 | 3394 |
| 3389 if (delegate_) | 3395 if (delegate_) |
| 3390 delegate_->DidNavigateMainFramePostCommit(this); | 3396 delegate_->DidNavigateMainFramePostCommit(this); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3503 void WebContentsImpl::OnDidDisplayContentWithCertificateErrors( | 3509 void WebContentsImpl::OnDidDisplayContentWithCertificateErrors( |
| 3504 const GURL& url) { | 3510 const GURL& url) { |
| 3505 // Check that the main frame navigation entry has a cryptographic | 3511 // Check that the main frame navigation entry has a cryptographic |
| 3506 // scheme; the security UI is associated with the main frame rather | 3512 // scheme; the security UI is associated with the main frame rather |
| 3507 // than the subframe (if any) that actually displayed the subresource | 3513 // than the subframe (if any) that actually displayed the subresource |
| 3508 // with errors. | 3514 // with errors. |
| 3509 NavigationEntry* entry = controller_.GetLastCommittedEntry(); | 3515 NavigationEntry* entry = controller_.GetLastCommittedEntry(); |
| 3510 if (!entry || !entry->GetURL().SchemeIsCryptographic()) | 3516 if (!entry || !entry->GetURL().SchemeIsCryptographic()) |
| 3511 return; | 3517 return; |
| 3512 | 3518 |
| 3513 displayed_insecure_content_ = true; | 3519 displayed_content_with_certificate_errors_ = true; |
| 3514 SSLManager::NotifySSLInternalStateChanged( | 3520 SSLManager::NotifySSLInternalStateChanged( |
| 3515 GetController().GetBrowserContext()); | 3521 GetController().GetBrowserContext()); |
| 3516 } | 3522 } |
| 3517 | 3523 |
| 3518 void WebContentsImpl::OnDidRunContentWithCertificateErrors( | 3524 void WebContentsImpl::OnDidRunContentWithCertificateErrors( |
| 3519 const GURL& url) { | 3525 const GURL& url) { |
| 3520 // Check that the main frame navigation entry has a cryptographic | 3526 // Check that the main frame navigation entry has a cryptographic |
| 3521 // scheme; the security UI is associated with the main frame rather | 3527 // scheme; the security UI is associated with the main frame rather |
| 3522 // than the subframe (if any) that actually displayed the subresource | 3528 // than the subframe (if any) that actually displayed the subresource |
| 3523 // with errors. | 3529 // with errors. |
| 3524 NavigationEntry* entry = controller_.GetLastCommittedEntry(); | 3530 NavigationEntry* entry = controller_.GetLastCommittedEntry(); |
| 3525 if (!entry || !entry->GetURL().SchemeIsCryptographic()) | 3531 if (!entry || !entry->GetURL().SchemeIsCryptographic()) |
| 3526 return; | 3532 return; |
| 3527 | 3533 |
| 3528 // TODO(estark): check that this does something reasonable for | 3534 // TODO(estark): check that this does something reasonable for |
| 3529 // about:blank and sandboxed origins. https://crbug.com/609527 | 3535 // about:blank and sandboxed origins. https://crbug.com/609527 |
| 3530 controller_.ssl_manager()->DidRunInsecureContent(entry->GetURL().GetOrigin()); | 3536 controller_.ssl_manager()->DidRunContentWithCertificateErrors( |
| 3537 entry->GetURL().GetOrigin()); |
| 3531 SSLManager::NotifySSLInternalStateChanged( | 3538 SSLManager::NotifySSLInternalStateChanged( |
| 3532 GetController().GetBrowserContext()); | 3539 GetController().GetBrowserContext()); |
| 3533 } | 3540 } |
| 3534 | 3541 |
| 3535 void WebContentsImpl::OnDocumentLoadedInFrame() { | 3542 void WebContentsImpl::OnDocumentLoadedInFrame() { |
| 3536 if (!HasValidFrameSource()) | 3543 if (!HasValidFrameSource()) |
| 3537 return; | 3544 return; |
| 3538 | 3545 |
| 3539 RenderFrameHostImpl* rfh = | 3546 RenderFrameHostImpl* rfh = |
| 3540 static_cast<RenderFrameHostImpl*>(render_frame_message_source_); | 3547 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) | 5239 for (RenderViewHost* render_view_host : render_view_host_set) |
| 5233 render_view_host->OnWebkitPreferencesChanged(); | 5240 render_view_host->OnWebkitPreferencesChanged(); |
| 5234 } | 5241 } |
| 5235 | 5242 |
| 5236 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( | 5243 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( |
| 5237 JavaScriptDialogManager* dialog_manager) { | 5244 JavaScriptDialogManager* dialog_manager) { |
| 5238 dialog_manager_ = dialog_manager; | 5245 dialog_manager_ = dialog_manager; |
| 5239 } | 5246 } |
| 5240 | 5247 |
| 5241 } // namespace content | 5248 } // namespace content |
| OLD | NEW |