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

Side by Side Diff: components/security_interstitials/core/ssl_error_ui.cc

Issue 1772143002: Use network time for bad clock interstitial. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: estark review 1 Created 4 years, 9 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/security_interstitials/core/ssl_error_ui.h" 5 #include "components/security_interstitials/core/ssl_error_ui.h"
6 6
7 #include "base/i18n/time_formatting.h" 7 #include "base/i18n/time_formatting.h"
8 #include "components/security_interstitials/core/common_string_util.h" 8 #include "components/security_interstitials/core/common_string_util.h"
9 #include "components/security_interstitials/core/metrics_helper.h" 9 #include "components/security_interstitials/core/metrics_helper.h"
10 #include "components/ssl_errors/error_classification.h" 10 #include "components/ssl_errors/error_classification.h"
11 #include "components/ssl_errors/error_info.h" 11 #include "components/ssl_errors/error_info.h"
12 #include "grit/components_strings.h" 12 #include "grit/components_strings.h"
13 #include "ui/base/l10n/l10n_util.h" 13 #include "ui/base/l10n/l10n_util.h"
14 14
15 namespace security_interstitials { 15 namespace security_interstitials {
16 namespace { 16 namespace {
17 17
18 // URL for help page. 18 // URL for help page.
19 const char kHelpURL[] = "https://support.google.com/chrome/answer/4454607"; 19 const char kHelpURL[] = "https://support.google.com/chrome/answer/4454607";
20 20
21 bool IsMasked(int options, SSLErrorUI::SSLErrorOptionsMask mask) { 21 bool IsMasked(int options, SSLErrorUI::SSLErrorOptionsMask mask) {
22 return ((options & mask) != 0); 22 return ((options & mask) != 0);
23 } 23 }
24 24
25 } // namespace 25 } // namespace
26 26
27 SSLErrorUI::SSLErrorUI(const GURL& request_url, 27 SSLErrorUI::SSLErrorUI(
28 int cert_error, 28 const GURL& request_url, int cert_error, const net::SSLInfo& ssl_info,
29 const net::SSLInfo& ssl_info, 29 int display_options, const base::Time& time_triggered,
30 int display_options, 30 const network_time::NetworkTimeTracker* network_time_tracker,
31 const base::Time& time_triggered, 31 const std::string& languages, ControllerClient* controller)
32 const std::string& languages,
33 ControllerClient* controller)
34 : request_url_(request_url), 32 : request_url_(request_url),
35 cert_error_(cert_error), 33 cert_error_(cert_error),
36 ssl_info_(ssl_info), 34 ssl_info_(ssl_info),
37 time_triggered_(time_triggered), 35 time_triggered_(time_triggered),
38 languages_(languages), 36 languages_(languages),
39 requested_strict_enforcement_( 37 requested_strict_enforcement_(
40 IsMasked(display_options, STRICT_ENFORCEMENT)), 38 IsMasked(display_options, STRICT_ENFORCEMENT)),
41 soft_override_enabled_(IsMasked(display_options, SOFT_OVERRIDE_ENABLED)), 39 soft_override_enabled_(IsMasked(display_options, SOFT_OVERRIDE_ENABLED)),
42 hard_override_enabled_( 40 hard_override_enabled_(
43 !IsMasked(display_options, HARD_OVERRIDE_DISABLED)), 41 !IsMasked(display_options, HARD_OVERRIDE_DISABLED)),
44 controller_(controller), 42 controller_(controller),
45 user_made_decision_(false) { 43 user_made_decision_(false) {
46 controller_->metrics_helper()->RecordUserDecision(MetricsHelper::SHOW); 44 controller_->metrics_helper()->RecordUserDecision(MetricsHelper::SHOW);
47 controller_->metrics_helper()->RecordUserInteraction( 45 controller_->metrics_helper()->RecordUserInteraction(
48 MetricsHelper::TOTAL_VISITS); 46 MetricsHelper::TOTAL_VISITS);
49 ssl_errors::RecordUMAStatistics(soft_override_enabled_, time_triggered_, 47 ssl_errors::RecordUMAStatistics(
50 request_url, cert_error_, 48 soft_override_enabled_, time_triggered_, network_time_tracker,
51 *ssl_info_.cert.get()); 49 request_url, cert_error_, *ssl_info_.cert.get());
52 } 50 }
53 51
54 SSLErrorUI::~SSLErrorUI() { 52 SSLErrorUI::~SSLErrorUI() {
55 // If the page is closing without an explicit decision, record it as not 53 // If the page is closing without an explicit decision, record it as not
56 // proceeding. 54 // proceeding.
57 if (!user_made_decision_) { 55 if (!user_made_decision_) {
58 controller_->metrics_helper()->RecordUserDecision( 56 controller_->metrics_helper()->RecordUserDecision(
59 MetricsHelper::DONT_PROCEED); 57 MetricsHelper::DONT_PROCEED);
60 } 58 }
61 controller_->metrics_helper()->RecordShutdownMetrics(); 59 controller_->metrics_helper()->RecordShutdownMetrics();
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 NOTREACHED() << "Unsupported command: " << command; 191 NOTREACHED() << "Unsupported command: " << command;
194 case CMD_ERROR: 192 case CMD_ERROR:
195 case CMD_TEXT_FOUND: 193 case CMD_TEXT_FOUND:
196 case CMD_TEXT_NOT_FOUND: 194 case CMD_TEXT_NOT_FOUND:
197 // Commands are for testing. 195 // Commands are for testing.
198 break; 196 break;
199 } 197 }
200 } 198 }
201 199
202 } // security_interstitials 200 } // security_interstitials
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698