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

Side by Side Diff: chrome/browser/ssl/captive_portal_blocking_page.cc

Issue 2408713003: Show red lock icon on captive portal SSL interstitial (Closed)
Patch Set: Created 4 years, 2 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/ssl/captive_portal_blocking_page.h" 5 #include "chrome/browser/ssl/captive_portal_blocking_page.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "base/metrics/histogram_macros.h" 11 #include "base/metrics/histogram_macros.h"
12 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
13 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
14 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
15 #include "base/values.h" 15 #include "base/values.h"
16 #include "build/build_config.h" 16 #include "build/build_config.h"
17 #include "chrome/browser/captive_portal/captive_portal_tab_helper.h" 17 #include "chrome/browser/captive_portal/captive_portal_tab_helper.h"
18 #include "chrome/browser/interstitials/chrome_controller_client.h" 18 #include "chrome/browser/interstitials/chrome_controller_client.h"
19 #include "chrome/browser/interstitials/chrome_metrics_helper.h" 19 #include "chrome/browser/interstitials/chrome_metrics_helper.h"
20 #include "chrome/browser/ssl/cert_report_helper.h" 20 #include "chrome/browser/ssl/cert_report_helper.h"
21 #include "chrome/browser/ssl/ssl_cert_reporter.h" 21 #include "chrome/browser/ssl/ssl_cert_reporter.h"
22 #include "chrome/grit/generated_resources.h" 22 #include "chrome/grit/generated_resources.h"
23 #include "components/captive_portal/captive_portal_detector.h" 23 #include "components/captive_portal/captive_portal_detector.h"
24 #include "components/certificate_reporting/error_reporter.h" 24 #include "components/certificate_reporting/error_reporter.h"
25 #include "components/security_interstitials/core/common_string_util.h" 25 #include "components/security_interstitials/core/common_string_util.h"
26 #include "components/security_interstitials/core/controller_client.h" 26 #include "components/security_interstitials/core/controller_client.h"
27 #include "components/security_interstitials/core/metrics_helper.h" 27 #include "components/security_interstitials/core/metrics_helper.h"
28 #include "components/url_formatter/url_formatter.h" 28 #include "components/url_formatter/url_formatter.h"
29 #include "components/wifi/wifi_service.h" 29 #include "components/wifi/wifi_service.h"
30 #include "content/public/browser/navigation_entry.h"
31 #include "content/public/browser/ssl_status.h"
30 #include "content/public/browser/web_contents.h" 32 #include "content/public/browser/web_contents.h"
31 #include "net/base/network_change_notifier.h" 33 #include "net/base/network_change_notifier.h"
32 #include "net/base/network_interfaces.h" 34 #include "net/base/network_interfaces.h"
33 #include "net/ssl/ssl_info.h" 35 #include "net/ssl/ssl_info.h"
34 #include "ui/base/l10n/l10n_util.h" 36 #include "ui/base/l10n/l10n_util.h"
35 37
36 namespace { 38 namespace {
37 39
38 const char kMetricsName[] = "captive_portal"; 40 const char kMetricsName[] = "captive_portal";
39 41
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 content::WebContents* web_contents, 73 content::WebContents* web_contents,
72 const GURL& request_url, 74 const GURL& request_url,
73 const GURL& login_url, 75 const GURL& login_url,
74 std::unique_ptr<SSLCertReporter> ssl_cert_reporter, 76 std::unique_ptr<SSLCertReporter> ssl_cert_reporter,
75 const net::SSLInfo& ssl_info, 77 const net::SSLInfo& ssl_info,
76 const base::Callback<void(content::CertificateRequestResultType)>& callback) 78 const base::Callback<void(content::CertificateRequestResultType)>& callback)
77 : SecurityInterstitialPage(web_contents, 79 : SecurityInterstitialPage(web_contents,
78 request_url, 80 request_url,
79 CreateMetricsHelper(web_contents, request_url)), 81 CreateMetricsHelper(web_contents, request_url)),
80 login_url_(login_url), 82 login_url_(login_url),
83 ssl_info_(ssl_info),
81 callback_(callback) { 84 callback_(callback) {
82 DCHECK(login_url_.is_valid()); 85 DCHECK(login_url_.is_valid());
83 86
84 if (ssl_cert_reporter) { 87 if (ssl_cert_reporter) {
85 cert_report_helper_.reset(new CertReportHelper( 88 cert_report_helper_.reset(new CertReportHelper(
86 std::move(ssl_cert_reporter), web_contents, request_url, ssl_info, 89 std::move(ssl_cert_reporter), web_contents, request_url, ssl_info,
87 certificate_reporting::ErrorReport::INTERSTITIAL_CAPTIVE_PORTAL, false, 90 certificate_reporting::ErrorReport::INTERSTITIAL_CAPTIVE_PORTAL, false,
88 nullptr)); 91 nullptr));
89 } 92 }
90 93
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 case security_interstitials::CMD_TEXT_FOUND: 237 case security_interstitials::CMD_TEXT_FOUND:
235 case security_interstitials::CMD_TEXT_NOT_FOUND: 238 case security_interstitials::CMD_TEXT_NOT_FOUND:
236 // Commands are for testing. 239 // Commands are for testing.
237 break; 240 break;
238 default: 241 default:
239 NOTREACHED() << "Command " << cmd 242 NOTREACHED() << "Command " << cmd
240 << " isn't handled by the captive portal interstitial."; 243 << " isn't handled by the captive portal interstitial.";
241 } 244 }
242 } 245 }
243 246
247 void CaptivePortalBlockingPage::OverrideEntry(content::NavigationEntry* entry) {
248 entry->GetSSL() = content::SSLStatus(
249 content::SECURITY_STYLE_AUTHENTICATION_BROKEN, ssl_info_.cert, ssl_info_);
250 }
meacer 2016/10/10 19:14:43 Is it possible to push this call to the superclass
estark 2016/10/10 21:41:38 That's a surprisingly hard question to answer. :)
meacer 2016/10/10 22:08:50 Sounds great! Thanks for looking into this.
251
244 void CaptivePortalBlockingPage::OnProceed() { 252 void CaptivePortalBlockingPage::OnProceed() {
245 NOTREACHED() 253 NOTREACHED()
246 << "Cannot proceed through the error on a captive portal interstitial."; 254 << "Cannot proceed through the error on a captive portal interstitial.";
247 } 255 }
248 256
249 void CaptivePortalBlockingPage::OnDontProceed() { 257 void CaptivePortalBlockingPage::OnDontProceed() {
250 if (cert_report_helper_) { 258 if (cert_report_helper_) {
251 // Finish collecting information about invalid certificates, if the 259 // Finish collecting information about invalid certificates, if the
252 // user opted in to. 260 // user opted in to.
253 cert_report_helper_->FinishCertCollection( 261 cert_report_helper_->FinishCertCollection(
254 certificate_reporting::ErrorReport::USER_DID_NOT_PROCEED); 262 certificate_reporting::ErrorReport::USER_DID_NOT_PROCEED);
255 } 263 }
256 264
257 // Need to explicity deny the certificate via the callback, otherwise memory 265 // Need to explicity deny the certificate via the callback, otherwise memory
258 // is leaked. 266 // is leaked.
259 if (!callback_.is_null()) { 267 if (!callback_.is_null()) {
260 callback_.Run(content::CERTIFICATE_REQUEST_RESULT_TYPE_CANCEL); 268 callback_.Run(content::CERTIFICATE_REQUEST_RESULT_TYPE_CANCEL);
261 callback_.Reset(); 269 callback_.Reset();
262 } 270 }
263 } 271 }
OLDNEW
« no previous file with comments | « chrome/browser/ssl/captive_portal_blocking_page.h ('k') | chrome/browser/ssl/captive_portal_blocking_page_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698