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

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: Now using shared scheme collections from url_util.h. 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 3521 matching lines...) Expand 10 before | Expand all | Expand 10 after
3532 : partition->GetURLRequestContext()); 3532 : partition->GetURLRequestContext());
3533 BrowserThread::PostTask( 3533 BrowserThread::PostTask(
3534 BrowserThread::IO, FROM_HERE, 3534 BrowserThread::IO, FROM_HERE,
3535 base::Bind(&NotifyCacheOnIO, request_context, url, http_method)); 3535 base::Bind(&NotifyCacheOnIO, request_context, url, http_method));
3536 } 3536 }
3537 } 3537 }
3538 3538
3539 void WebContentsImpl::OnDidDisplayInsecureContent(RenderFrameHostImpl* source) { 3539 void WebContentsImpl::OnDidDisplayInsecureContent(RenderFrameHostImpl* source) {
3540 // Any frame can trigger display of insecure content, so we don't check 3540 // Any frame can trigger display of insecure content, so we don't check
3541 // |source| here. 3541 // |source| here.
3542 DidDisplayInsecureContent();
3543 }
3544
3545 void WebContentsImpl::DidDisplayInsecureContent() {
3542 RecordAction(base::UserMetricsAction("SSL.DisplayedInsecureContent")); 3546 RecordAction(base::UserMetricsAction("SSL.DisplayedInsecureContent"));
3543 controller_.ssl_manager()->DidDisplayMixedContent(); 3547 controller_.ssl_manager()->DidDisplayMixedContent();
3544 } 3548 }
3545 3549
3546 void WebContentsImpl::OnDidRunInsecureContent(RenderFrameHostImpl* source, 3550 void WebContentsImpl::OnDidRunInsecureContent(RenderFrameHostImpl* source,
3547 const GURL& security_origin, 3551 const GURL& security_origin,
3548 const GURL& target_url) { 3552 const GURL& target_url) {
3549 // TODO(nick, estark): Should we call FilterURL using |source|'s process on 3553 // TODO(nick, estark): Should we call FilterURL using |source|'s process on
3550 // these parameters? |target_url| seems unused, except for a log message. And 3554 // these parameters? |target_url| seems unused, except for a log message. And
3551 // |security_origin| might be replaceable with the origin of the main frame. 3555 // |security_origin| might be replaceable with the origin of the main frame.
3556 DidRunInsecureContent(security_origin, target_url);
3557 }
3558
3559 void WebContentsImpl::DidRunInsecureContent(const GURL& security_origin,
3560 const GURL& target_url) {
3552 LOG(WARNING) << security_origin << " ran insecure content from " 3561 LOG(WARNING) << security_origin << " ran insecure content from "
3553 << target_url.possibly_invalid_spec(); 3562 << target_url.possibly_invalid_spec();
3554 RecordAction(base::UserMetricsAction("SSL.RanInsecureContent")); 3563 RecordAction(base::UserMetricsAction("SSL.RanInsecureContent"));
3555 if (base::EndsWith(security_origin.spec(), kDotGoogleDotCom, 3564 if (base::EndsWith(security_origin.spec(), kDotGoogleDotCom,
3556 base::CompareCase::INSENSITIVE_ASCII)) 3565 base::CompareCase::INSENSITIVE_ASCII))
3557 RecordAction(base::UserMetricsAction("SSL.RanInsecureContentGoogle")); 3566 RecordAction(base::UserMetricsAction("SSL.RanInsecureContentGoogle"));
3558 controller_.ssl_manager()->DidRunMixedContent(security_origin); 3567 controller_.ssl_manager()->DidRunMixedContent(security_origin);
3559 } 3568 }
3560 3569
3570 void WebContentsImpl::PassiveInsecureContentFound(const GURL& resource_url) {
3571 GetDelegate()->PassiveInsecureContentFound(resource_url);
3572 }
3573
3574 bool WebContentsImpl::ShouldAllowRunningInsecureContent(
3575 WebContents* web_contents,
3576 bool allowed_per_settings,
3577 const url::Origin& origin,
3578 const GURL& resource_url) {
3579 return GetDelegate()->ShouldAllowRunningInsecureContent(
3580 web_contents, allowed_per_settings, origin, resource_url);
3581 }
3582
3561 void WebContentsImpl::OnDidDisplayContentWithCertificateErrors( 3583 void WebContentsImpl::OnDidDisplayContentWithCertificateErrors(
3562 RenderFrameHostImpl* source, 3584 RenderFrameHostImpl* source,
3563 const GURL& url) { 3585 const GURL& url) {
3564 // TODO(nick): |url| is unused; get rid of it. 3586 // TODO(nick): |url| is unused; get rid of it.
3565 controller_.ssl_manager()->DidDisplayContentWithCertErrors(); 3587 controller_.ssl_manager()->DidDisplayContentWithCertErrors();
3566 } 3588 }
3567 3589
3568 void WebContentsImpl::OnDidRunContentWithCertificateErrors( 3590 void WebContentsImpl::OnDidRunContentWithCertificateErrors(
3569 RenderFrameHostImpl* source, 3591 RenderFrameHostImpl* source,
3570 const GURL& url) { 3592 const GURL& url) {
(...skipping 1857 matching lines...) Expand 10 before | Expand all | Expand 10 after
5428 GetMainFrame()->AddMessageToConsole( 5450 GetMainFrame()->AddMessageToConsole(
5429 content::CONSOLE_MESSAGE_LEVEL_WARNING, 5451 content::CONSOLE_MESSAGE_LEVEL_WARNING,
5430 base::StringPrintf("This site does not have a valid SSL " 5452 base::StringPrintf("This site does not have a valid SSL "
5431 "certificate! Without SSL, your site's and " 5453 "certificate! Without SSL, your site's and "
5432 "visitors' data is vulnerable to theft and " 5454 "visitors' data is vulnerable to theft and "
5433 "tampering. Get a valid SSL certificate before" 5455 "tampering. Get a valid SSL certificate before"
5434 " releasing your website to the public.")); 5456 " releasing your website to the public."));
5435 } 5457 }
5436 5458
5437 } // namespace content 5459 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698