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

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

Issue 2220603003: Remove unnecessary |result| argument from AllowCertificateError() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove unnecessary include Created 4 years, 4 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
« no previous file with comments | « chrome/browser/ssl/ssl_blocking_page.h ('k') | chrome/browser/ssl/ssl_browser_tests.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/browser/ssl/ssl_blocking_page.h" 5 #include "chrome/browser/ssl/ssl_blocking_page.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 // Note that we always create a navigation entry with SSL errors. 108 // Note that we always create a navigation entry with SSL errors.
109 // No error happening loading a sub-resource triggers an interstitial so far. 109 // No error happening loading a sub-resource triggers an interstitial so far.
110 SSLBlockingPage::SSLBlockingPage( 110 SSLBlockingPage::SSLBlockingPage(
111 content::WebContents* web_contents, 111 content::WebContents* web_contents,
112 int cert_error, 112 int cert_error,
113 const net::SSLInfo& ssl_info, 113 const net::SSLInfo& ssl_info,
114 const GURL& request_url, 114 const GURL& request_url,
115 int options_mask, 115 int options_mask,
116 const base::Time& time_triggered, 116 const base::Time& time_triggered,
117 std::unique_ptr<SSLCertReporter> ssl_cert_reporter, 117 std::unique_ptr<SSLCertReporter> ssl_cert_reporter,
118 const base::Callback<void(bool)>& callback) 118 const base::Callback<void(content::CertificateRequestResultType)>& callback)
119 : SecurityInterstitialPage(web_contents, request_url), 119 : SecurityInterstitialPage(web_contents, request_url),
120 callback_(callback), 120 callback_(callback),
121 ssl_info_(ssl_info), 121 ssl_info_(ssl_info),
122 overridable_(IsOverridable( 122 overridable_(IsOverridable(
123 options_mask, 123 options_mask,
124 Profile::FromBrowserContext(web_contents->GetBrowserContext()))), 124 Profile::FromBrowserContext(web_contents->GetBrowserContext()))),
125 expired_but_previously_allowed_( 125 expired_but_previously_allowed_(
126 (options_mask & SSLErrorUI::EXPIRED_BUT_PREVIOUSLY_ALLOWED) != 0), 126 (options_mask & SSLErrorUI::EXPIRED_BUT_PREVIOUSLY_ALLOWED) != 0),
127 controller_(new ChromeControllerClient(web_contents)) { 127 controller_(new ChromeControllerClient(web_contents)) {
128 // Override prefs for the SSLErrorUI. 128 // Override prefs for the SSLErrorUI.
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 233
234 void SSLBlockingPage::OnProceed() { 234 void SSLBlockingPage::OnProceed() {
235 // Finish collecting metrics, if the user opted into it. 235 // Finish collecting metrics, if the user opted into it.
236 cert_report_helper_->FinishCertCollection( 236 cert_report_helper_->FinishCertCollection(
237 certificate_reporting::ErrorReport::USER_PROCEEDED); 237 certificate_reporting::ErrorReport::USER_PROCEEDED);
238 RecordSSLExpirationPageEventState( 238 RecordSSLExpirationPageEventState(
239 expired_but_previously_allowed_, true, overridable_); 239 expired_but_previously_allowed_, true, overridable_);
240 240
241 // Accepting the certificate resumes the loading of the page. 241 // Accepting the certificate resumes the loading of the page.
242 DCHECK(!callback_.is_null()); 242 DCHECK(!callback_.is_null());
243 callback_.Run(true); 243 callback_.Run(content::CERTIFICATE_REQUEST_RESULT_TYPE_CONTINUE);
244 callback_.Reset(); 244 callback_.Reset();
245 } 245 }
246 246
247 void SSLBlockingPage::OnDontProceed() { 247 void SSLBlockingPage::OnDontProceed() {
248 // Finish collecting metrics, if the user opted into it. 248 // Finish collecting metrics, if the user opted into it.
249 cert_report_helper_->FinishCertCollection( 249 cert_report_helper_->FinishCertCollection(
250 certificate_reporting::ErrorReport::USER_DID_NOT_PROCEED); 250 certificate_reporting::ErrorReport::USER_DID_NOT_PROCEED);
251 RecordSSLExpirationPageEventState( 251 RecordSSLExpirationPageEventState(
252 expired_but_previously_allowed_, false, overridable_); 252 expired_but_previously_allowed_, false, overridable_);
253 253
254 NotifyDenyCertificate(); 254 NotifyDenyCertificate();
255 } 255 }
256 256
257 void SSLBlockingPage::NotifyDenyCertificate() { 257 void SSLBlockingPage::NotifyDenyCertificate() {
258 // It's possible that callback_ may not exist if the user clicks "Proceed" 258 // It's possible that callback_ may not exist if the user clicks "Proceed"
259 // followed by pressing the back button before the interstitial is hidden. 259 // followed by pressing the back button before the interstitial is hidden.
260 // In that case the certificate will still be treated as allowed. 260 // In that case the certificate will still be treated as allowed.
261 if (callback_.is_null()) 261 if (callback_.is_null())
262 return; 262 return;
263 263
264 callback_.Run(false); 264 callback_.Run(content::CERTIFICATE_REQUEST_RESULT_TYPE_CANCEL);
265 callback_.Reset(); 265 callback_.Reset();
266 } 266 }
267 267
268 // static 268 // static
269 bool SSLBlockingPage::IsOverridable(int options_mask, 269 bool SSLBlockingPage::IsOverridable(int options_mask,
270 const Profile* const profile) { 270 const Profile* const profile) {
271 const bool is_overridable = 271 const bool is_overridable =
272 (options_mask & SSLErrorUI::SOFT_OVERRIDE_ENABLED) && 272 (options_mask & SSLErrorUI::SOFT_OVERRIDE_ENABLED) &&
273 !(options_mask & SSLErrorUI::STRICT_ENFORCEMENT) && 273 !(options_mask & SSLErrorUI::STRICT_ENFORCEMENT) &&
274 profile->GetPrefs()->GetBoolean(prefs::kSSLErrorOverrideAllowed); 274 profile->GetPrefs()->GetBoolean(prefs::kSSLErrorOverrideAllowed);
275 return is_overridable; 275 return is_overridable;
276 } 276 }
OLDNEW
« no previous file with comments | « chrome/browser/ssl/ssl_blocking_page.h ('k') | chrome/browser/ssl/ssl_browser_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698