OLD | NEW |
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/bad_clock_ui.h" | 5 #include "components/security_interstitials/core/bad_clock_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 "grit/components_strings.h" | 10 #include "grit/components_strings.h" |
11 #include "ui/base/l10n/l10n_util.h" | 11 #include "ui/base/l10n/l10n_util.h" |
12 | 12 |
13 namespace security_interstitials { | 13 namespace security_interstitials { |
14 | 14 |
15 BadClockUI::BadClockUI(const GURL& request_url, | 15 BadClockUI::BadClockUI(const GURL& request_url, |
16 int cert_error, | 16 int cert_error, |
17 const net::SSLInfo& ssl_info, | 17 const net::SSLInfo& ssl_info, |
18 const base::Time& time_triggered, | 18 const base::Time& time_triggered, |
19 ssl_errors::ClockState clock_state, | 19 ssl_errors::ClockState clock_state, |
20 const std::string& languages, | |
21 ControllerClient* controller) | 20 ControllerClient* controller) |
22 : request_url_(request_url), | 21 : request_url_(request_url), |
23 cert_error_(cert_error), | 22 cert_error_(cert_error), |
24 ssl_info_(ssl_info), | 23 ssl_info_(ssl_info), |
25 time_triggered_(time_triggered), | 24 time_triggered_(time_triggered), |
26 languages_(languages), | |
27 controller_(controller), | 25 controller_(controller), |
28 clock_state_(clock_state) { | 26 clock_state_(clock_state) { |
29 controller_->metrics_helper()->RecordUserInteraction( | 27 controller_->metrics_helper()->RecordUserInteraction( |
30 security_interstitials::MetricsHelper::TOTAL_VISITS); | 28 security_interstitials::MetricsHelper::TOTAL_VISITS); |
31 | 29 |
32 ssl_errors::RecordUMAStatisticsForClockInterstitial(false, clock_state_, | 30 ssl_errors::RecordUMAStatisticsForClockInterstitial(false, clock_state_, |
33 cert_error_); | 31 cert_error_); |
34 } | 32 } |
35 | 33 |
36 BadClockUI::~BadClockUI() { | 34 BadClockUI::~BadClockUI() { |
(...skipping 30 matching lines...) Expand all Loading... |
67 NOTREACHED(); | 65 NOTREACHED(); |
68 } | 66 } |
69 load_time_data->SetString("tabTitle", | 67 load_time_data->SetString("tabTitle", |
70 l10n_util::GetStringUTF16(IDS_CLOCK_ERROR_TITLE)); | 68 l10n_util::GetStringUTF16(IDS_CLOCK_ERROR_TITLE)); |
71 load_time_data->SetString("heading", | 69 load_time_data->SetString("heading", |
72 l10n_util::GetStringUTF16(heading_string)); | 70 l10n_util::GetStringUTF16(heading_string)); |
73 load_time_data->SetString( | 71 load_time_data->SetString( |
74 "primaryParagraph", | 72 "primaryParagraph", |
75 l10n_util::GetStringFUTF16( | 73 l10n_util::GetStringFUTF16( |
76 IDS_CLOCK_ERROR_PRIMARY_PARAGRAPH, | 74 IDS_CLOCK_ERROR_PRIMARY_PARAGRAPH, |
77 common_string_util::GetFormattedHostName(request_url_, languages_), | 75 common_string_util::GetFormattedHostName(request_url_), |
78 base::TimeFormatFriendlyDateAndTime(time_triggered_))); | 76 base::TimeFormatFriendlyDateAndTime(time_triggered_))); |
79 load_time_data->SetString( | 77 load_time_data->SetString( |
80 "primaryButtonText", | 78 "primaryButtonText", |
81 l10n_util::GetStringUTF16(IDS_CLOCK_ERROR_UPDATE_DATE_AND_TIME)); | 79 l10n_util::GetStringUTF16(IDS_CLOCK_ERROR_UPDATE_DATE_AND_TIME)); |
82 load_time_data->SetString( | 80 load_time_data->SetString( |
83 "explanationParagraph", | 81 "explanationParagraph", |
84 l10n_util::GetStringUTF16(IDS_CLOCK_ERROR_EXPLANATION)); | 82 l10n_util::GetStringUTF16(IDS_CLOCK_ERROR_EXPLANATION)); |
85 } | 83 } |
86 | 84 |
87 void BadClockUI::HandleCommand(SecurityInterstitialCommands command) { | 85 void BadClockUI::HandleCommand(SecurityInterstitialCommands command) { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 NOTREACHED() << "Unsupported command: " << command; | 117 NOTREACHED() << "Unsupported command: " << command; |
120 case CMD_ERROR: | 118 case CMD_ERROR: |
121 case CMD_TEXT_FOUND: | 119 case CMD_TEXT_FOUND: |
122 case CMD_TEXT_NOT_FOUND: | 120 case CMD_TEXT_NOT_FOUND: |
123 // Commands are only for testing. | 121 // Commands are only for testing. |
124 NOTREACHED() << "Unexpected command: " << command; | 122 NOTREACHED() << "Unexpected command: " << command; |
125 } | 123 } |
126 } | 124 } |
127 | 125 |
128 } // security_interstitials | 126 } // security_interstitials |
OLD | NEW |