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

Unified Diff: components/security_interstitials/core/safe_browsing_loud_error_ui.cc

Issue 2955503002: Make interstitial links open in a new tab (Closed)
Patch Set: Fix compilation error Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: components/security_interstitials/core/safe_browsing_loud_error_ui.cc
diff --git a/components/security_interstitials/core/safe_browsing_loud_error_ui.cc b/components/security_interstitials/core/safe_browsing_loud_error_ui.cc
index 12e67e3f66a91f33bc78fc2aafa3e718d1cf6179..85a5dfa32b86038686eca9ab22aa124c3db6d14c 100644
--- a/components/security_interstitials/core/safe_browsing_loud_error_ui.cc
+++ b/components/security_interstitials/core/safe_browsing_loud_error_ui.cc
@@ -20,9 +20,6 @@
namespace security_interstitials {
namespace {
-// URL for the Help Center
-const char kLearnMore[] = "https://support.google.com/chrome/";
-
// For malware interstitial pages, we link the problematic URL to Google's
// diagnostic page.
#if defined(GOOGLE_CHROME_BUILD)
@@ -70,9 +67,10 @@ SafeBrowsingLoudErrorUI::SafeBrowsingLoudErrorUI(
controller->metrics_helper()->RecordUserDecision(MetricsHelper::SHOW);
controller->metrics_helper()->RecordUserInteraction(
MetricsHelper::TOTAL_VISITS);
- if (is_proceed_anyway_disabled())
+ if (is_proceed_anyway_disabled()) {
controller->metrics_helper()->RecordUserDecision(
security_interstitials::MetricsHelper::PROCEEDING_DISABLED);
+ }
}
SafeBrowsingLoudErrorUI::~SafeBrowsingLoudErrorUI() {
@@ -165,12 +163,13 @@ void SafeBrowsingLoudErrorUI::HandleCommand(
// User pressed "Learn more".
controller()->metrics_helper()->RecordUserInteraction(
security_interstitials::MetricsHelper::SHOW_LEARN_MORE);
- GURL learn_more_url(kLearnMore);
+
+ GURL learn_more_url = controller()->GetBaseHelpCenterUrl();
learn_more_url = net::AppendQueryParameter(
learn_more_url, "p", get_help_center_article_link());
learn_more_url =
google_util::AppendGoogleLocaleParam(learn_more_url, app_locale());
- controller()->OpenUrlInCurrentTab(learn_more_url);
+ OpenURL(learn_more_url);
break;
}
case CMD_RELOAD: {
@@ -197,7 +196,7 @@ void SafeBrowsingLoudErrorUI::HandleCommand(
GURL diagnostic_url(diagnostic);
diagnostic_url =
google_util::AppendGoogleLocaleParam(diagnostic_url, app_locale());
- controller()->OpenUrlInCurrentTab(diagnostic_url);
+ OpenURL(diagnostic_url);
break;
}
case CMD_REPORT_PHISHING_ERROR: {
@@ -206,7 +205,7 @@ void SafeBrowsingLoudErrorUI::HandleCommand(
GURL phishing_error_url(kReportPhishingErrorUrl);
phishing_error_url = google_util::AppendGoogleLocaleParam(
phishing_error_url, app_locale());
- controller()->OpenUrlInCurrentTab(phishing_error_url);
+ OpenURL(phishing_error_url);
break;
}
case CMD_OPEN_DATE_SETTINGS:
@@ -288,8 +287,9 @@ void SafeBrowsingLoudErrorUI::PopulateExtendedReportingOption(
bool can_show_extended_reporting_option = CanShowExtendedReportingOption();
load_time_data->SetBoolean(security_interstitials::kDisplayCheckBox,
can_show_extended_reporting_option);
- if (!can_show_extended_reporting_option)
+ if (!can_show_extended_reporting_option) {
return;
+ }
const std::string privacy_link = base::StringPrintf(
security_interstitials::kPrivacyLinkHtml,
@@ -305,6 +305,14 @@ void SafeBrowsingLoudErrorUI::PopulateExtendedReportingOption(
is_extended_reporting_enabled());
}
+void SafeBrowsingLoudErrorUI::OpenURL(const GURL& url) {
+ if (should_open_links_in_new_tab()) {
+ controller()->OpenUrlInNewForegroundTab(url);
+ } else {
+ controller()->OpenUrlInCurrentTab(url);
+ }
+}
+
int SafeBrowsingLoudErrorUI::GetHTMLTemplateId() const {
return IDR_SECURITY_INTERSTITIAL_HTML;
};

Powered by Google App Engine
This is Rietveld 408576698