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 "chrome/browser/ssl/ssl_blocking_page.h" | 5 #include "chrome/browser/ssl/ssl_blocking_page.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/build_time.h" | 9 #include "base/build_time.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 const base::Time& time_triggered, | 244 const base::Time& time_triggered, |
245 scoped_ptr<SSLCertReporter> ssl_cert_reporter, | 245 scoped_ptr<SSLCertReporter> ssl_cert_reporter, |
246 const base::Callback<void(bool)>& callback) | 246 const base::Callback<void(bool)>& callback) |
247 : SecurityInterstitialPage(web_contents, request_url), | 247 : SecurityInterstitialPage(web_contents, request_url), |
248 callback_(callback), | 248 callback_(callback), |
249 cert_error_(cert_error), | 249 cert_error_(cert_error), |
250 ssl_info_(ssl_info), | 250 ssl_info_(ssl_info), |
251 overridable_(IsOverridable( | 251 overridable_(IsOverridable( |
252 options_mask, | 252 options_mask, |
253 Profile::FromBrowserContext(web_contents->GetBrowserContext()))), | 253 Profile::FromBrowserContext(web_contents->GetBrowserContext()))), |
254 danger_overridable_(true), | 254 danger_overridable_(DoesPolicyAllowDangerOverride( |
| 255 Profile::FromBrowserContext(web_contents->GetBrowserContext()))), |
255 strict_enforcement_((options_mask & STRICT_ENFORCEMENT) != 0), | 256 strict_enforcement_((options_mask & STRICT_ENFORCEMENT) != 0), |
256 expired_but_previously_allowed_( | 257 expired_but_previously_allowed_( |
257 (options_mask & EXPIRED_BUT_PREVIOUSLY_ALLOWED) != 0), | 258 (options_mask & EXPIRED_BUT_PREVIOUSLY_ALLOWED) != 0), |
258 time_triggered_(time_triggered), | 259 time_triggered_(time_triggered), |
259 ssl_cert_reporter_(ssl_cert_reporter.Pass()) { | 260 ssl_cert_reporter_(ssl_cert_reporter.Pass()) { |
260 interstitial_reason_ = | 261 interstitial_reason_ = |
261 IsErrorDueToBadClock(time_triggered_, cert_error_) ? | 262 IsErrorDueToBadClock(time_triggered_, cert_error_) ? |
262 SSL_REASON_BAD_CLOCK : SSL_REASON_SSL; | 263 SSL_REASON_BAD_CLOCK : SSL_REASON_SSL; |
263 | 264 |
264 // We collapse the Rappor metric name to just "ssl" so we don't leak | 265 // We collapse the Rappor metric name to just "ssl" so we don't leak |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 | 707 |
707 // static | 708 // static |
708 bool SSLBlockingPage::IsOverridable(int options_mask, | 709 bool SSLBlockingPage::IsOverridable(int options_mask, |
709 const Profile* const profile) { | 710 const Profile* const profile) { |
710 const bool is_overridable = | 711 const bool is_overridable = |
711 (options_mask & SSLBlockingPage::OVERRIDABLE) && | 712 (options_mask & SSLBlockingPage::OVERRIDABLE) && |
712 !(options_mask & SSLBlockingPage::STRICT_ENFORCEMENT) && | 713 !(options_mask & SSLBlockingPage::STRICT_ENFORCEMENT) && |
713 profile->GetPrefs()->GetBoolean(prefs::kSSLErrorOverrideAllowed); | 714 profile->GetPrefs()->GetBoolean(prefs::kSSLErrorOverrideAllowed); |
714 return is_overridable; | 715 return is_overridable; |
715 } | 716 } |
| 717 |
| 718 // static |
| 719 bool SSLBlockingPage::DoesPolicyAllowDangerOverride( |
| 720 const Profile* const profile) { |
| 721 return profile->GetPrefs()->GetBoolean(prefs::kSSLErrorOverrideAllowed); |
| 722 } |
OLD | NEW |