Commit 44ead483 authored by Joe DeBlasio's avatar Joe DeBlasio Committed by Commit Bot

Lookalike interstitial: Update strings and remove 'details'.

This CL mostly reverts crrev/c/1717191, but includes updated strings. The
interstitial now looks like this:
  https://storage.cloud.google.com/chromium-translation-screenshots/a0e10eb89867355fc98c930e468397e8dadf4f17

Bug: 996794
Change-Id: Ib5b85f16184bab7cbad955d07a75b648b6f34b7e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1765661
Auto-Submit: Joe DeBlasio <jdeblasio@chromium.org>
Reviewed-by: default avatarEmily Stark <estark@chromium.org>
Commit-Queue: Joe DeBlasio <jdeblasio@chromium.org>
Cr-Commit-Position: refs/heads/master@{#689972}
parent 242d258d
...@@ -6,8 +6,6 @@ ...@@ -6,8 +6,6 @@
#include <utility> #include <utility>
#include "base/metrics/field_trial_params.h"
#include "chrome/common/chrome_features.h"
#include "components/grit/components_resources.h" #include "components/grit/components_resources.h"
#include "components/security_interstitials/content/security_interstitial_controller_client.h" #include "components/security_interstitials/content/security_interstitial_controller_client.h"
#include "components/security_interstitials/core/common_string_util.h" #include "components/security_interstitials/core/common_string_util.h"
...@@ -23,13 +21,6 @@ ...@@ -23,13 +21,6 @@
using security_interstitials::MetricsHelper; using security_interstitials::MetricsHelper;
namespace {
const base::FeatureParam<bool> kEnableAdvancedSection{
&features::kLookalikeUrlNavigationSuggestionsUI, "show_advanced", false};
} // namespace
// static // static
const content::InterstitialPageDelegate::TypeID const content::InterstitialPageDelegate::TypeID
LookalikeUrlInterstitialPage::kTypeForTesting = LookalikeUrlInterstitialPage::kTypeForTesting =
...@@ -96,10 +87,6 @@ void LookalikeUrlInterstitialPage::PopulateInterstitialStrings( ...@@ -96,10 +87,6 @@ void LookalikeUrlInterstitialPage::PopulateInterstitialStrings(
security_interstitials::common_string_util::PopulateDarkModeDisplaySetting( security_interstitials::common_string_util::PopulateDarkModeDisplaySetting(
load_time_data); load_time_data);
auto formatted_hostname =
security_interstitials::common_string_util::GetFormattedHostName(
request_url());
load_time_data->SetString( load_time_data->SetString(
"tabTitle", "tabTitle",
l10n_util::GetStringFUTF16( l10n_util::GetStringFUTF16(
...@@ -107,50 +94,19 @@ void LookalikeUrlInterstitialPage::PopulateInterstitialStrings( ...@@ -107,50 +94,19 @@ void LookalikeUrlInterstitialPage::PopulateInterstitialStrings(
security_interstitials::common_string_util::GetFormattedHostName( security_interstitials::common_string_util::GetFormattedHostName(
request_url()))); request_url())));
load_time_data->SetString( load_time_data->SetString(
"heading", l10n_util::GetStringFUTF16(IDS_LOOKALIKE_URL_HEADING, "heading",
formatted_hostname)); l10n_util::GetStringFUTF16(
IDS_LOOKALIKE_URL_HEADING,
security_interstitials::common_string_util::GetFormattedHostName(
request_url())));
load_time_data->SetString(
"primaryParagraph",
l10n_util::GetStringUTF16(IDS_LOOKALIKE_URL_PRIMARY_PARAGRAPH));
load_time_data->SetString( load_time_data->SetString(
"proceedButtonText", l10n_util::GetStringUTF16(IDS_LOOKALIKE_URL_IGNORE)); "proceedButtonText", l10n_util::GetStringUTF16(IDS_LOOKALIKE_URL_IGNORE));
load_time_data->SetString( load_time_data->SetString(
"primaryButtonText", "primaryButtonText",
l10n_util::GetStringUTF16(IDS_LOOKALIKE_URL_CONTINUE)); l10n_util::GetStringUTF16(IDS_LOOKALIKE_URL_CONTINUE));
load_time_data->SetString(
"openDetails", l10n_util::GetStringUTF16(IDS_LOOKALIKE_URL_SHOW_DETAILS));
load_time_data->SetString(
"closeDetails",
l10n_util::GetStringUTF16(IDS_LOOKALIKE_URL_HIDE_DETAILS));
load_time_data->SetString(
"finalParagraph",
l10n_util::GetStringFUTF16(IDS_LOOKALIKE_URL_FINAL_PARAGRAPH,
formatted_hostname));
switch (match_type_) {
case MatchType::kNone: // kNone used by chrome://interstitials
case MatchType::kTopSite:
load_time_data->SetString(
"primaryParagraph",
l10n_util::GetStringUTF16(IDS_LOOKALIKE_URL_PRIMARY_PARAGRAPH_TOP));
load_time_data->SetString(
"explanationParagraph",
l10n_util::GetStringFUTF16(IDS_LOOKALIKE_URL_EXPLANATION_TOP,
formatted_hostname));
break;
case MatchType::kSiteEngagement:
load_time_data->SetString(
"primaryParagraph",
l10n_util::GetStringUTF16(
IDS_LOOKALIKE_URL_PRIMARY_PARAGRAPH_ENGAGEMENT));
load_time_data->SetString(
"explanationParagraph",
l10n_util::GetStringFUTF16(IDS_LOOKALIKE_URL_EXPLANATION_ENGAGEMENT,
formatted_hostname));
break;
case MatchType::kEditDistance:
case MatchType::kEditDistanceSiteEngagement:
NOTREACHED();
}
load_time_data->SetBoolean("show_advanced", kEnableAdvancedSection.Get());
} }
void LookalikeUrlInterstitialPage::OnInterstitialClosing() { void LookalikeUrlInterstitialPage::OnInterstitialClosing() {
...@@ -186,12 +142,9 @@ void LookalikeUrlInterstitialPage::CommandReceived(const std::string& command) { ...@@ -186,12 +142,9 @@ void LookalikeUrlInterstitialPage::CommandReceived(const std::string& command) {
ReportUkmIfNeeded(UserAction::kClickThrough); ReportUkmIfNeeded(UserAction::kClickThrough);
controller()->Proceed(); controller()->Proceed();
break; break;
case security_interstitials::CMD_SHOW_MORE_SECTION:
controller()->metrics_helper()->RecordUserInteraction(
MetricsHelper::SHOW_ADVANCED);
break;
case security_interstitials::CMD_DO_REPORT: case security_interstitials::CMD_DO_REPORT:
case security_interstitials::CMD_DONT_REPORT: case security_interstitials::CMD_DONT_REPORT:
case security_interstitials::CMD_SHOW_MORE_SECTION:
case security_interstitials::CMD_OPEN_DATE_SETTINGS: case security_interstitials::CMD_OPEN_DATE_SETTINGS:
case security_interstitials::CMD_OPEN_REPORTING_PRIVACY: case security_interstitials::CMD_OPEN_REPORTING_PRIVACY:
case security_interstitials::CMD_OPEN_WHITEPAPER: case security_interstitials::CMD_OPEN_WHITEPAPER:
...@@ -223,6 +176,7 @@ void LookalikeUrlInterstitialPage::PopulateStringsForSharedHTML( ...@@ -223,6 +176,7 @@ void LookalikeUrlInterstitialPage::PopulateStringsForSharedHTML(
load_time_data->SetBoolean("show_recurrent_error_paragraph", false); load_time_data->SetBoolean("show_recurrent_error_paragraph", false);
load_time_data->SetString("recurrentErrorParagraph", ""); load_time_data->SetString("recurrentErrorParagraph", "");
load_time_data->SetString("openDetails", "");
load_time_data->SetString("explanationParagraph", ""); load_time_data->SetString("explanationParagraph", "");
load_time_data->SetString("finalParagraph", ""); load_time_data->SetString("finalParagraph", "");
......
...@@ -1070,19 +1070,3 @@ IN_PROC_BROWSER_TEST_F(LookalikeUrlInterstitialPageBrowserTest, ...@@ -1070,19 +1070,3 @@ IN_PROC_BROWSER_TEST_F(LookalikeUrlInterstitialPageBrowserTest,
embedded_test_server()->GetURL("example.net", "/")); embedded_test_server()->GetURL("example.net", "/"));
} }
// Verify that displaying the advanced section records UMA.
IN_PROC_BROWSER_TEST_F(LookalikeUrlInterstitialPageBrowserTest,
MetricsRecordedOnAdvancedShown) {
base::HistogramTester histograms;
LoadAndCheckInterstitialAt(browser(), GetURL("googlé.com"));
SendInterstitialCommand(browser()->tab_strip_model()->GetActiveWebContents(),
SecurityInterstitialCommand::CMD_SHOW_MORE_SECTION);
SendInterstitialCommandSync(browser(),
SecurityInterstitialCommand::CMD_PROCEED);
histograms.ExpectTotalCount(kInterstitialInteractionMetric, 2);
histograms.ExpectBucketCount(kInterstitialInteractionMetric,
MetricsHelper::TOTAL_VISITS, 1);
histograms.ExpectBucketCount(kInterstitialInteractionMetric,
MetricsHelper::SHOW_ADVANCED, 1);
}
...@@ -53,9 +53,6 @@ ...@@ -53,9 +53,6 @@
$i18n{openDetails} $i18n{openDetails}
</button> </button>
</div> </div>
<div id="subnav-wrapper" class="hidden">
<a href="#" id="details-link">$i18n{openDetails}</a>
</div>
<div id="details" class="hidden"> <div id="details" class="hidden">
<p>$i18nRaw{explanationParagraph}</p> <p>$i18nRaw{explanationParagraph}</p>
<p id="final-paragraph">$i18nRaw{finalParagraph}</p> <p id="final-paragraph">$i18nRaw{finalParagraph}</p>
......
...@@ -134,13 +134,7 @@ function setupEvents() { ...@@ -134,13 +134,7 @@ function setupEvents() {
if (lookalike) { if (lookalike) {
var proceed_button = 'proceed-button'; var proceed_button = 'proceed-button';
// Lookalike warnings use multiple "don't proceed" links. $() syntax only var dont_proceed_link = 'dont-proceed-link';
// allows unique IDs (not classes), so we enumerate them all here.
var dont_proceed_links = [
'dont-proceed-link1',
'dont-proceed-link2',
'dont-proceed-link3',
];
$(proceed_button).classList.remove(HIDDEN_CLASS); $(proceed_button).classList.remove(HIDDEN_CLASS);
$(proceed_button).textContent = $(proceed_button).textContent =
...@@ -150,10 +144,8 @@ function setupEvents() { ...@@ -150,10 +144,8 @@ function setupEvents() {
sendCommand(SecurityInterstitialCommandId.CMD_PROCEED); sendCommand(SecurityInterstitialCommandId.CMD_PROCEED);
}); });
dont_proceed_links.forEach(function(link_id) { $(dont_proceed_link).addEventListener('click', function(event) {
$(link_id).addEventListener('click', function(event) { sendCommand(SecurityInterstitialCommandId.CMD_DONT_PROCEED);
sendCommand(SecurityInterstitialCommandId.CMD_DONT_PROCEED);
});
}); });
} }
...@@ -171,7 +163,7 @@ function setupEvents() { ...@@ -171,7 +163,7 @@ function setupEvents() {
$(overrideElement).textContent = $(overrideElement).textContent =
loadTimeData.getString('proceedButtonText'); loadTimeData.getString('proceedButtonText');
} }
} else if (!ssl && !lookalike) { } else if (!ssl) {
$('final-paragraph').classList.add(HIDDEN_CLASS); $('final-paragraph').classList.add(HIDDEN_CLASS);
} }
...@@ -195,23 +187,11 @@ function setupEvents() { ...@@ -195,23 +187,11 @@ function setupEvents() {
} }
var details_id = null; var details_id = null;
if (captivePortal || billing) { if (captivePortal || billing || lookalike) {
// Captive portal and billing pages don't have details buttons. // Captive portal, billing and lookalike pages don't have details buttons.
$('details-button').classList.add('hidden'); $('details-button').classList.add('hidden');
} else if (lookalike) {
// Lookalike pages has a details link instead.
if (loadTimeData.getBoolean('show_advanced')) {
$('subnav-wrapper').classList.remove('hidden');
}
$('details-button').classList.add('hidden');
details_id = 'details-link';
} else { } else {
details_id = 'details-button'; $('details-button').addEventListener('click', function(event) {
}
if (details_id) {
$(details_id).addEventListener('click', function(event) {
var hiddenDetails = $('details').classList.toggle(HIDDEN_CLASS); var hiddenDetails = $('details').classList.toggle(HIDDEN_CLASS);
if (mobileNav) { if (mobileNav) {
...@@ -221,7 +201,7 @@ function setupEvents() { ...@@ -221,7 +201,7 @@ function setupEvents() {
$('main-content').classList.remove(HIDDEN_CLASS); $('main-content').classList.remove(HIDDEN_CLASS);
} }
$(details_id).innerText = hiddenDetails ? $('details-button').innerText = hiddenDetails ?
loadTimeData.getString('openDetails') : loadTimeData.getString('openDetails') :
loadTimeData.getString('closeDetails'); loadTimeData.getString('closeDetails');
if (!expandedDetails) { if (!expandedDetails) {
......
...@@ -18,14 +18,3 @@ ...@@ -18,14 +18,3 @@
filter: invert(1); filter: invert(1);
} }
} }
.lookalike-url #subnav-wrapper {
padding: 25px 0 0;
margin: 0;
}
.lookalike-url #details-link {
text-transform: uppercase;
text-decoration: none;
font-size: .875em;
}
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
Continue to <ph name="DOMAIN">$1<ex>example.com</ex></ph>? Continue to <ph name="DOMAIN">$1<ex>example.com</ex></ph>?
</message> </message>
<message name="IDS_LOOKALIKE_URL_HEADING" desc="Large heading. Context: the error page that's shown when the requested URL might be trying to trick the user since it looks like a more popular URL."> <message name="IDS_LOOKALIKE_URL_HEADING" desc="Large heading. Context: the error page that's shown when the requested URL might be trying to trick the user since it looks like a more popular URL.">
Continue to &lt;a href="#" id="dont-proceed-link1"&gt;<ph name="DOMAIN">$1<ex>example.com</ex></ph>&lt;/a&gt;? Continue to &lt;a href="#" id="dont-proceed-link"&gt;<ph name="DOMAIN">$1<ex>example.com</ex></ph>&lt;/a&gt;?
</message> </message>
<message name="IDS_LOOKALIKE_URL_IGNORE" desc="Button text. Context: the error page that's shown when the requested URL might be trying to trick the user since it looks like a more popular URL. This button dismisses the interstitial and navigates to the originally-requested URL."> <message name="IDS_LOOKALIKE_URL_IGNORE" desc="Button text. Context: the error page that's shown when the requested URL might be trying to trick the user since it looks like a more popular URL. This button dismisses the interstitial and navigates to the originally-requested URL.">
Ignore Ignore
...@@ -77,28 +77,8 @@ ...@@ -77,28 +77,8 @@
<message name="IDS_LOOKALIKE_URL_CONTINUE" desc="Button text. Context: the error page that's shown when the requested URL might be trying to trick the user since it looks like a more popular URL. This button dismisses the interstitial and navigates to the suggested (safe) URL."> <message name="IDS_LOOKALIKE_URL_CONTINUE" desc="Button text. Context: the error page that's shown when the requested URL might be trying to trick the user since it looks like a more popular URL. This button dismisses the interstitial and navigates to the suggested (safe) URL.">
Continue Continue
</message> </message>
<message name="IDS_LOOKALIKE_URL_SHOW_DETAILS" desc="Button text. Context: the error page that's shown when the requested URL might be trying to trick the user since it looks like a more popular URL. This button expands the explanation to reveal additional details."> <message name="IDS_LOOKALIKE_URL_PRIMARY_PARAGRAPH" desc="Main paragraph of an error message. Context: the error page that's shown when the requested URL might be trying to trick the user since it looks like a more popular URL.">
Details The site you just tried to visit looks fake. Attackers sometimes mimic sites by making small, hard-to-see changes to the URL.
</message>
<message name="IDS_LOOKALIKE_URL_HIDE_DETAILS" desc="Button text. Context: the error page that's shown when the requested URL might be trying to trick the user since it looks like a more popular URL. This button hides additional details.">
Hide details
</message>
<message name="IDS_LOOKALIKE_URL_FINAL_PARAGRAPH" desc="Final paragraph of an error message clarifying what the buttons do. Context: the error page that's shown when the requested URL might be trying to trick the user since it looks like a more popular URL.">
Clicking Continue will take you to the more common site &lt;a href="#" id="dont-proceed-link3"&gt;<ph name="DOMAIN">$1<ex>example.com</ex></ph>&lt;/a&gt;.
</message>
<message name="IDS_LOOKALIKE_URL_PRIMARY_PARAGRAPH_ENGAGEMENT" desc="Main paragraph of an error message. Context: the error page that's shown when the requested URL might be trying to trick the user since it looks like a different URL that the user usually visits.">
The link you opened goes to a site you don't usually visit. It might be trying to confuse you.
</message>
<message name="IDS_LOOKALIKE_URL_EXPLANATION_ENGAGEMENT" desc="Extended description for an error page hidden behind an 'Advanced' button. Context: the error page that's shown when the requested URL might be trying to trick the user since it looks like a different URL that the user usually visits.">
You usually visit &lt;a href="#" id="dont-proceed-link2"&gt;<ph name="DOMAIN">$1<ex>example.com</ex></ph>&lt;/a&gt;. The URL you just tried to visit appears similar, but does not exactly match the site from your history. Attackers sometimes use this technique to trick or scam you.
</message>
<message name="IDS_LOOKALIKE_URL_PRIMARY_PARAGRAPH_TOP" desc="Main paragraph of an error message. Context: the error page that's shown when the requested URL might be trying to trick the user since it looks like a more popular URL.">
The link you opened goes to an uncommon site. It might be trying to confuse you.
</message>
<message name="IDS_LOOKALIKE_URL_EXPLANATION_TOP" desc="Extended description for an error page hidden behind an 'Advanced' button. Context: the error page that's shown when the requested URL might be trying to trick the user since it looks like a more popular URL.">
You usually visit &lt;a href="#" id="dont-proceed-link2"&gt;<ph name="DOMAIN">$1<ex>example.com</ex></ph>&lt;/a&gt;. The site you just tried to visit appears similar to, but does not exactly match, the site from your history. Attackers sometimes use this technique to trick or scam you.
</message> </message>
<!-- Clock errors --> <!-- Clock errors -->
......
ceaa8e7cb8069659b8893df6f00218c83fe517ed
\ No newline at end of file
ceaa8e7cb8069659b8893df6f00218c83fe517ed
\ No newline at end of file
fb5f55f88faf660ea83d210f659a32ba74ba48fb
\ No newline at end of file
a0e10eb89867355fc98c930e468397e8dadf4f17
\ No newline at end of file
269cc52136ae3794106e94ce671f321162997ef8
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment