| 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 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1184 } | 1185 } |
| 1185 | 1186 |
| 1186 uint64_t WebContentsImpl::GetUploadPosition() const { | 1187 uint64_t WebContentsImpl::GetUploadPosition() const { |
| 1187 return upload_position_; | 1188 return upload_position_; |
| 1188 } | 1189 } |
| 1189 | 1190 |
| 1190 const std::string& WebContentsImpl::GetEncoding() const { | 1191 const std::string& WebContentsImpl::GetEncoding() const { |
| 1191 return canonical_encoding_; | 1192 return canonical_encoding_; |
| 1192 } | 1193 } |
| 1193 | 1194 |
| 1194 bool WebContentsImpl::DisplayedInsecureContent() const { | |
| 1195 return displayed_insecure_content_; | |
| 1196 } | |
| 1197 | |
| 1198 void WebContentsImpl::IncrementCapturerCount(const gfx::Size& capture_size) { | 1195 void WebContentsImpl::IncrementCapturerCount(const gfx::Size& capture_size) { |
| 1199 DCHECK(!is_being_destroyed_); | 1196 DCHECK(!is_being_destroyed_); |
| 1200 ++capturer_count_; | 1197 ++capturer_count_; |
| 1201 DVLOG(1) << "There are now " << capturer_count_ | 1198 DVLOG(1) << "There are now " << capturer_count_ |
| 1202 << " capturing(s) of WebContentsImpl@" << this; | 1199 << " capturing(s) of WebContentsImpl@" << this; |
| 1203 | 1200 |
| 1204 // Note: This provides a hint to upstream code to size the views optimally | 1201 // Note: This provides a hint to upstream code to size the views optimally |
| 1205 // for quality (e.g., to avoid scaling). | 1202 // for quality (e.g., to avoid scaling). |
| 1206 if (!capture_size.IsEmpty() && preferred_size_for_capture_.IsEmpty()) { | 1203 if (!capture_size.IsEmpty() && preferred_size_for_capture_.IsEmpty()) { |
| 1207 preferred_size_for_capture_ = capture_size; | 1204 preferred_size_for_capture_ = capture_size; |
| (...skipping 1302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2510 void WebContentsImpl::ResizeDueToAutoResize( | 2507 void WebContentsImpl::ResizeDueToAutoResize( |
| 2511 RenderWidgetHostImpl* render_widget_host, | 2508 RenderWidgetHostImpl* render_widget_host, |
| 2512 const gfx::Size& new_size) { | 2509 const gfx::Size& new_size) { |
| 2513 if (render_widget_host != GetRenderViewHost()->GetWidget()) | 2510 if (render_widget_host != GetRenderViewHost()->GetWidget()) |
| 2514 return; | 2511 return; |
| 2515 | 2512 |
| 2516 if (delegate_) | 2513 if (delegate_) |
| 2517 delegate_->ResizeDueToAutoResize(this, new_size); | 2514 delegate_->ResizeDueToAutoResize(this, new_size); |
| 2518 } | 2515 } |
| 2519 | 2516 |
| 2517 bool WebContentsImpl::DisplayedInsecureContent() const { |
| 2518 return displayed_insecure_content_; |
| 2519 } |
| 2520 |
| 2521 bool WebContentsImpl::DisplayedContentWithCertErrors() const { |
| 2522 return displayed_content_with_cert_errors_; |
| 2523 } |
| 2524 |
| 2520 WebContents* WebContentsImpl::OpenURL(const OpenURLParams& params) { | 2525 WebContents* WebContentsImpl::OpenURL(const OpenURLParams& params) { |
| 2521 if (!delegate_) | 2526 if (!delegate_) |
| 2522 return NULL; | 2527 return NULL; |
| 2523 | 2528 |
| 2524 WebContents* new_contents = delegate_->OpenURLFromTab(this, params); | 2529 WebContents* new_contents = delegate_->OpenURLFromTab(this, params); |
| 2525 return new_contents; | 2530 return new_contents; |
| 2526 } | 2531 } |
| 2527 | 2532 |
| 2528 bool WebContentsImpl::Send(IPC::Message* message) { | 2533 bool WebContentsImpl::Send(IPC::Message* message) { |
| 2529 if (!GetRenderViewHost()) { | 2534 if (!GetRenderViewHost()) { |
| (...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3502 if (base::EndsWith(security_origin.spec(), kDotGoogleDotCom, | 3507 if (base::EndsWith(security_origin.spec(), kDotGoogleDotCom, |
| 3503 base::CompareCase::INSENSITIVE_ASCII)) | 3508 base::CompareCase::INSENSITIVE_ASCII)) |
| 3504 RecordAction(base::UserMetricsAction("SSL.RanInsecureContentGoogle")); | 3509 RecordAction(base::UserMetricsAction("SSL.RanInsecureContentGoogle")); |
| 3505 controller_.ssl_manager()->DidRunInsecureContent(security_origin); | 3510 controller_.ssl_manager()->DidRunInsecureContent(security_origin); |
| 3506 SSLManager::NotifySSLInternalStateChanged( | 3511 SSLManager::NotifySSLInternalStateChanged( |
| 3507 GetController().GetBrowserContext()); | 3512 GetController().GetBrowserContext()); |
| 3508 } | 3513 } |
| 3509 | 3514 |
| 3510 void WebContentsImpl::OnDidDisplayContentWithCertificateErrors( | 3515 void WebContentsImpl::OnDidDisplayContentWithCertificateErrors( |
| 3511 const GURL& url) { | 3516 const GURL& url) { |
| 3512 // Check that the main frame navigation entry has a cryptographic | 3517 displayed_content_with_cert_errors_ = true; |
| 3513 // scheme; the security UI is associated with the main frame rather | |
| 3514 // than the subframe (if any) that actually displayed the subresource | |
| 3515 // with errors. | |
| 3516 NavigationEntry* entry = controller_.GetLastCommittedEntry(); | |
| 3517 if (!entry || !entry->GetURL().SchemeIsCryptographic()) | |
| 3518 return; | |
| 3519 | |
| 3520 displayed_insecure_content_ = true; | |
| 3521 SSLManager::NotifySSLInternalStateChanged( | 3518 SSLManager::NotifySSLInternalStateChanged( |
| 3522 GetController().GetBrowserContext()); | 3519 GetController().GetBrowserContext()); |
| 3523 } | 3520 } |
| 3524 | 3521 |
| 3525 void WebContentsImpl::OnDidRunContentWithCertificateErrors( | 3522 void WebContentsImpl::OnDidRunContentWithCertificateErrors( |
| 3526 const GURL& url) { | 3523 const GURL& url) { |
| 3527 // Check that the main frame navigation entry has a cryptographic | 3524 NavigationEntry* entry = controller_.GetVisibleEntry(); |
| 3528 // scheme; the security UI is associated with the main frame rather | 3525 if (!entry) |
| 3529 // than the subframe (if any) that actually displayed the subresource | |
| 3530 // with errors. | |
| 3531 NavigationEntry* entry = controller_.GetLastCommittedEntry(); | |
| 3532 if (!entry || !entry->GetURL().SchemeIsCryptographic()) | |
| 3533 return; | 3526 return; |
| 3534 | 3527 |
| 3535 // TODO(estark): check that this does something reasonable for | 3528 // TODO(estark): check that this does something reasonable for |
| 3536 // about:blank and sandboxed origins. https://crbug.com/609527 | 3529 // about:blank and sandboxed origins. https://crbug.com/609527 |
| 3537 controller_.ssl_manager()->DidRunInsecureContent(entry->GetURL().GetOrigin()); | 3530 controller_.ssl_manager()->DidRunContentWithCertErrors( |
| 3531 entry->GetURL().GetOrigin()); |
| 3538 SSLManager::NotifySSLInternalStateChanged( | 3532 SSLManager::NotifySSLInternalStateChanged( |
| 3539 GetController().GetBrowserContext()); | 3533 GetController().GetBrowserContext()); |
| 3540 } | 3534 } |
| 3541 | 3535 |
| 3542 void WebContentsImpl::OnDocumentLoadedInFrame() { | 3536 void WebContentsImpl::OnDocumentLoadedInFrame() { |
| 3543 if (!HasValidFrameSource()) | 3537 if (!HasValidFrameSource()) |
| 3544 return; | 3538 return; |
| 3545 | 3539 |
| 3546 RenderFrameHostImpl* rfh = | 3540 RenderFrameHostImpl* rfh = |
| 3547 static_cast<RenderFrameHostImpl*>(render_frame_message_source_); | 3541 static_cast<RenderFrameHostImpl*>(render_frame_message_source_); |
| (...skipping 1691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5239 for (RenderViewHost* render_view_host : render_view_host_set) | 5233 for (RenderViewHost* render_view_host : render_view_host_set) |
| 5240 render_view_host->OnWebkitPreferencesChanged(); | 5234 render_view_host->OnWebkitPreferencesChanged(); |
| 5241 } | 5235 } |
| 5242 | 5236 |
| 5243 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( | 5237 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( |
| 5244 JavaScriptDialogManager* dialog_manager) { | 5238 JavaScriptDialogManager* dialog_manager) { |
| 5245 dialog_manager_ = dialog_manager; | 5239 dialog_manager_ = dialog_manager; |
| 5246 } | 5240 } |
| 5247 | 5241 |
| 5248 } // namespace content | 5242 } // namespace content |
| OLD | NEW |