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

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 4 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,
29 const net::SSLInfo& ssl_info, 29 int cert_error,
30 int display_options, 30 const net::SSLInfo& ssl_info,
31 const base::Time& time_triggered, 31 int display_options,
32 const std::string& languages, 32 const base::Time& time_triggered,
33 ControllerClient* controller) 33 const network_time::NetworkTimeTracker* network_time_tracker,
34 const std::string& languages,
35 ControllerClient* controller)
34 : request_url_(request_url), 36 : request_url_(request_url),
35 cert_error_(cert_error), 37 cert_error_(cert_error),
36 ssl_info_(ssl_info), 38 ssl_info_(ssl_info),
37 time_triggered_(time_triggered), 39 time_triggered_(time_triggered),
38 languages_(languages), 40 languages_(languages),
39 requested_strict_enforcement_( 41 requested_strict_enforcement_(
40 IsMasked(display_options, STRICT_ENFORCEMENT)), 42 IsMasked(display_options, STRICT_ENFORCEMENT)),
41 soft_override_enabled_(IsMasked(display_options, SOFT_OVERRIDE_ENABLED)), 43 soft_override_enabled_(IsMasked(display_options, SOFT_OVERRIDE_ENABLED)),
42 hard_override_enabled_( 44 hard_override_enabled_(
43 !IsMasked(display_options, HARD_OVERRIDE_DISABLED)), 45 !IsMasked(display_options, HARD_OVERRIDE_DISABLED)),
44 controller_(controller), 46 controller_(controller),
45 user_made_decision_(false) { 47 user_made_decision_(false) {
46 controller_->metrics_helper()->RecordUserDecision(MetricsHelper::SHOW); 48 controller_->metrics_helper()->RecordUserDecision(MetricsHelper::SHOW);
47 controller_->metrics_helper()->RecordUserInteraction( 49 controller_->metrics_helper()->RecordUserInteraction(
48 MetricsHelper::TOTAL_VISITS); 50 MetricsHelper::TOTAL_VISITS);
49 ssl_errors::RecordUMAStatistics(soft_override_enabled_, time_triggered_, 51 ssl_errors::RecordUMAStatistics(soft_override_enabled_, time_triggered_,
50 request_url, cert_error_, 52 network_time_tracker, request_url,
51 *ssl_info_.cert.get()); 53 cert_error_, *ssl_info_.cert.get());
52 } 54 }
53 55
54 SSLErrorUI::~SSLErrorUI() { 56 SSLErrorUI::~SSLErrorUI() {
55 // If the page is closing without an explicit decision, record it as not 57 // If the page is closing without an explicit decision, record it as not
56 // proceeding. 58 // proceeding.
57 if (!user_made_decision_) { 59 if (!user_made_decision_) {
58 controller_->metrics_helper()->RecordUserDecision( 60 controller_->metrics_helper()->RecordUserDecision(
59 MetricsHelper::DONT_PROCEED); 61 MetricsHelper::DONT_PROCEED);
60 } 62 }
61 controller_->metrics_helper()->RecordShutdownMetrics(); 63 controller_->metrics_helper()->RecordShutdownMetrics();
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 NOTREACHED() << "Unsupported command: " << command; 195 NOTREACHED() << "Unsupported command: " << command;
194 case CMD_ERROR: 196 case CMD_ERROR:
195 case CMD_TEXT_FOUND: 197 case CMD_TEXT_FOUND:
196 case CMD_TEXT_NOT_FOUND: 198 case CMD_TEXT_NOT_FOUND:
197 // Commands are for testing. 199 // Commands are for testing.
198 break; 200 break;
199 } 201 }
200 } 202 }
201 203
202 } // security_interstitials 204 } // security_interstitials
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698