Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(749)

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 1905033002: PlzNavigate: Move navigation-level mixed content checks to the browser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@console-security-message
Patch Set: Address jam@ comments; many minor code and comment updates. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 3520 matching lines...) Expand 10 before | Expand all | Expand 10 after
3531 : partition->GetURLRequestContext()); 3531 : partition->GetURLRequestContext());
3532 BrowserThread::PostTask( 3532 BrowserThread::PostTask(
3533 BrowserThread::IO, FROM_HERE, 3533 BrowserThread::IO, FROM_HERE,
3534 base::Bind(&NotifyCacheOnIO, request_context, url, http_method)); 3534 base::Bind(&NotifyCacheOnIO, request_context, url, http_method));
3535 } 3535 }
3536 } 3536 }
3537 3537
3538 void WebContentsImpl::OnDidDisplayInsecureContent(RenderFrameHostImpl* source) { 3538 void WebContentsImpl::OnDidDisplayInsecureContent(RenderFrameHostImpl* source) {
3539 // Any frame can trigger display of insecure content, so we don't check 3539 // Any frame can trigger display of insecure content, so we don't check
3540 // |source| here. 3540 // |source| here.
3541 DidDisplayInsecureContent();
3542 }
3543
3544 void WebContentsImpl::DidDisplayInsecureContent() {
3541 RecordAction(base::UserMetricsAction("SSL.DisplayedInsecureContent")); 3545 RecordAction(base::UserMetricsAction("SSL.DisplayedInsecureContent"));
3542 controller_.ssl_manager()->DidDisplayMixedContent(); 3546 controller_.ssl_manager()->DidDisplayMixedContent();
3543 } 3547 }
3544 3548
3545 void WebContentsImpl::OnDidRunInsecureContent(RenderFrameHostImpl* source, 3549 void WebContentsImpl::OnDidRunInsecureContent(RenderFrameHostImpl* source,
3546 const GURL& security_origin, 3550 const GURL& security_origin,
3547 const GURL& target_url) { 3551 const GURL& target_url) {
3548 // TODO(nick, estark): Should we call FilterURL using |source|'s process on 3552 // TODO(nick, estark): Should we call FilterURL using |source|'s process on
3549 // these parameters? |target_url| seems unused, except for a log message. And 3553 // these parameters? |target_url| seems unused, except for a log message. And
3550 // |security_origin| might be replaceable with the origin of the main frame. 3554 // |security_origin| might be replaceable with the origin of the main frame.
3555 DidRunInsecureContent(security_origin, target_url);
3556 }
3557
3558 void WebContentsImpl::DidRunInsecureContent(const GURL& security_origin,
3559 const GURL& target_url) {
3551 LOG(WARNING) << security_origin << " ran insecure content from " 3560 LOG(WARNING) << security_origin << " ran insecure content from "
3552 << target_url.possibly_invalid_spec(); 3561 << target_url.possibly_invalid_spec();
3553 RecordAction(base::UserMetricsAction("SSL.RanInsecureContent")); 3562 RecordAction(base::UserMetricsAction("SSL.RanInsecureContent"));
3554 if (base::EndsWith(security_origin.spec(), kDotGoogleDotCom, 3563 if (base::EndsWith(security_origin.spec(), kDotGoogleDotCom,
3555 base::CompareCase::INSENSITIVE_ASCII)) 3564 base::CompareCase::INSENSITIVE_ASCII))
3556 RecordAction(base::UserMetricsAction("SSL.RanInsecureContentGoogle")); 3565 RecordAction(base::UserMetricsAction("SSL.RanInsecureContentGoogle"));
3557 controller_.ssl_manager()->DidRunMixedContent(security_origin); 3566 controller_.ssl_manager()->DidRunMixedContent(security_origin);
3558 } 3567 }
3559 3568
3569 void WebContentsImpl::PassiveInsecureContentFound(const GURL& resource_url) {
3570 GetDelegate()->PassiveInsecureContentFound(resource_url);
3571 }
3572
3573 bool WebContentsImpl::ShouldAllowRunningInsecureContent(
3574 bool allowed_per_settings,
3575 const url::Origin& origin,
3576 const GURL& resource_url,
3577 WebContents* web_contents) {
3578 return GetDelegate()->ShouldAllowRunningInsecureContent(
3579 allowed_per_settings, origin, resource_url, web_contents);
3580 }
3581
3560 void WebContentsImpl::OnDidDisplayContentWithCertificateErrors( 3582 void WebContentsImpl::OnDidDisplayContentWithCertificateErrors(
3561 RenderFrameHostImpl* source, 3583 RenderFrameHostImpl* source,
3562 const GURL& url) { 3584 const GURL& url) {
3563 // TODO(nick): |url| is unused; get rid of it. 3585 // TODO(nick): |url| is unused; get rid of it.
3564 controller_.ssl_manager()->DidDisplayContentWithCertErrors(); 3586 controller_.ssl_manager()->DidDisplayContentWithCertErrors();
3565 } 3587 }
3566 3588
3567 void WebContentsImpl::OnDidRunContentWithCertificateErrors( 3589 void WebContentsImpl::OnDidRunContentWithCertificateErrors(
3568 RenderFrameHostImpl* source, 3590 RenderFrameHostImpl* source,
3569 const GURL& url) { 3591 const GURL& url) {
(...skipping 1849 matching lines...) Expand 10 before | Expand all | Expand 10 after
5419 GetMainFrame()->AddMessageToConsole( 5441 GetMainFrame()->AddMessageToConsole(
5420 content::CONSOLE_MESSAGE_LEVEL_WARNING, 5442 content::CONSOLE_MESSAGE_LEVEL_WARNING,
5421 base::StringPrintf("This site does not have a valid SSL " 5443 base::StringPrintf("This site does not have a valid SSL "
5422 "certificate! Without SSL, your site's and " 5444 "certificate! Without SSL, your site's and "
5423 "visitors' data is vulnerable to theft and " 5445 "visitors' data is vulnerable to theft and "
5424 "tampering. Get a valid SSL certificate before" 5446 "tampering. Get a valid SSL certificate before"
5425 " releasing your website to the public.")); 5447 " releasing your website to the public."));
5426 } 5448 }
5427 5449
5428 } // namespace content 5450 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698