OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "components/security_interstitials/core/superfish_error_ui.h" |
| 6 |
| 7 #include "components/security_interstitials/core/common_string_util.h" |
| 8 #include "components/security_interstitials/core/controller_client.h" |
| 9 #include "components/security_interstitials/core/metrics_helper.h" |
| 10 #include "components/strings/grit/components_strings.h" |
| 11 #include "ui/base/l10n/l10n_util.h" |
| 12 |
| 13 namespace security_interstitials { |
| 14 |
| 15 namespace { |
| 16 |
| 17 // URL for Superfish-specific help page. |
| 18 const char kHelpURL[] = "https://support.google.com/chrome/?p=superfish"; |
| 19 |
| 20 } // namespace |
| 21 |
| 22 SuperfishErrorUI::SuperfishErrorUI( |
| 23 const GURL& request_url, |
| 24 int cert_error, |
| 25 const net::SSLInfo& ssl_info, |
| 26 int display_options, // Bitmask of SSLErrorOptionsMask values. |
| 27 const base::Time& time_triggered, |
| 28 ControllerClient* controller) |
| 29 : SSLErrorUI(request_url, |
| 30 cert_error, |
| 31 ssl_info, |
| 32 display_options, |
| 33 time_triggered, |
| 34 controller) {} |
| 35 |
| 36 void SuperfishErrorUI::PopulateStringsForHTML( |
| 37 base::DictionaryValue* load_time_data) { |
| 38 common_string_util::PopulateSSLDebuggingStrings(ssl_info(), time_triggered(), |
| 39 load_time_data); |
| 40 |
| 41 load_time_data->SetBoolean("overridable", false); |
| 42 load_time_data->SetBoolean("bad_clock", false); |
| 43 load_time_data->SetBoolean("hide_primary_button", true); |
| 44 load_time_data->SetString("tabTitle", |
| 45 l10n_util::GetStringUTF16(IDS_SSL_V2_TITLE)); |
| 46 load_time_data->SetString( |
| 47 "heading", l10n_util::GetStringUTF16(IDS_SSL_SUPERFISH_HEADING)); |
| 48 load_time_data->SetString( |
| 49 "primaryParagraph", |
| 50 l10n_util::GetStringUTF16(IDS_SSL_SUPERFISH_PRIMARY_PARAGRAPH)); |
| 51 |
| 52 load_time_data->SetString("explanationParagraph", std::string()); |
| 53 load_time_data->SetString("primaryButtonText", std::string()); |
| 54 load_time_data->SetString("finalParagraph", std::string()); |
| 55 load_time_data->SetString("openDetails", base::string16()); |
| 56 load_time_data->SetString("closeDetails", base::string16()); |
| 57 } |
| 58 |
| 59 void SuperfishErrorUI::HandleCommand(SecurityInterstitialCommands command) { |
| 60 // Override the Help Center link to point to a Superfish-specific page. |
| 61 if (command == CMD_OPEN_HELP_CENTER) { |
| 62 controller()->metrics_helper()->RecordUserInteraction( |
| 63 security_interstitials::MetricsHelper::SHOW_LEARN_MORE); |
| 64 controller()->OpenUrlInCurrentTab(GURL(kHelpURL)); |
| 65 return; |
| 66 } |
| 67 SSLErrorUI::HandleCommand(command); |
| 68 } |
| 69 |
| 70 } // namespace security_interstitials |
OLD | NEW |