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/build_time.h" | 7 #include "base/build_time.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/i18n/time_formatting.h" | 10 #include "base/i18n/time_formatting.h" |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 SSLBlockingPage::SSLBlockingPage(content::WebContents* web_contents, | 324 SSLBlockingPage::SSLBlockingPage(content::WebContents* web_contents, |
325 int cert_error, | 325 int cert_error, |
326 const net::SSLInfo& ssl_info, | 326 const net::SSLInfo& ssl_info, |
327 const GURL& request_url, | 327 const GURL& request_url, |
328 int options_mask, | 328 int options_mask, |
329 const base::Callback<void(bool)>& callback) | 329 const base::Callback<void(bool)>& callback) |
330 : SecurityInterstitialPage(web_contents, request_url), | 330 : SecurityInterstitialPage(web_contents, request_url), |
331 callback_(callback), | 331 callback_(callback), |
332 cert_error_(cert_error), | 332 cert_error_(cert_error), |
333 ssl_info_(ssl_info), | 333 ssl_info_(ssl_info), |
334 overridable_(options_mask & OVERRIDABLE && | 334 overridable_(IsOptionsOverridable(options_mask)), |
335 !(options_mask & STRICT_ENFORCEMENT)), | |
336 danger_overridable_(true), | 335 danger_overridable_(true), |
337 strict_enforcement_((options_mask & STRICT_ENFORCEMENT) != 0), | 336 strict_enforcement_((options_mask & STRICT_ENFORCEMENT) != 0), |
338 internal_(false), | 337 internal_(false), |
339 num_visits_(-1), | 338 num_visits_(-1), |
340 expired_but_previously_allowed_( | 339 expired_but_previously_allowed_( |
341 (options_mask & EXPIRED_BUT_PREVIOUSLY_ALLOWED) != 0) { | 340 (options_mask & EXPIRED_BUT_PREVIOUSLY_ALLOWED) != 0) { |
342 Profile* profile = Profile::FromBrowserContext( | 341 Profile* profile = Profile::FromBrowserContext( |
343 web_contents->GetBrowserContext()); | 342 web_contents->GetBrowserContext()); |
344 // For UMA stats. | 343 // For UMA stats. |
345 if (SSLErrorClassification::IsHostnameNonUniqueOrDotless( | 344 if (SSLErrorClassification::IsHostnameNonUniqueOrDotless( |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 }; | 713 }; |
715 int i; | 714 int i; |
716 for (i = 0; i < static_cast<int>(extra_info.size()); i++) { | 715 for (i = 0; i < static_cast<int>(extra_info.size()); i++) { |
717 strings->SetString(keys[i], extra_info[i]); | 716 strings->SetString(keys[i], extra_info[i]); |
718 } | 717 } |
719 for (; i < 5; i++) { | 718 for (; i < 5; i++) { |
720 strings->SetString(keys[i], std::string()); | 719 strings->SetString(keys[i], std::string()); |
721 } | 720 } |
722 } | 721 } |
723 | 722 |
| 723 // static |
| 724 bool SSLBlockingPage::IsOptionsOverridable(int options_mask) { |
| 725 return (options_mask & SSLBlockingPage::OVERRIDABLE) && |
| 726 !(options_mask & SSLBlockingPage::STRICT_ENFORCEMENT); |
| 727 } |
| 728 |
724 void SSLBlockingPage::OnGotHistoryCount(bool success, | 729 void SSLBlockingPage::OnGotHistoryCount(bool success, |
725 int num_visits, | 730 int num_visits, |
726 base::Time first_visit) { | 731 base::Time first_visit) { |
727 num_visits_ = num_visits; | 732 num_visits_ = num_visits; |
728 } | 733 } |
OLD | NEW |