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

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

Issue 2852333003: Rename SafeBrowsingErrorUI to SafeBrowsingLoudErrorUI (Closed)
Patch Set: Move SafeBrowsingErrorUI to SafeBrowsingLoudErrorUI Created 3 years, 8 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_error_ui.cc b/components/security_interstitials/core/safe_browsing_loud_error_ui.cc
similarity index 88%
rename from components/security_interstitials/core/safe_browsing_error_ui.cc
rename to components/security_interstitials/core/safe_browsing_loud_error_ui.cc
index 38566d65e6c5bbeecec6a36cd6b8ddaeb3c4f0bb..df5aa3335da4b5e2c8a74d7381b9606067f6ba3a 100644
--- a/components/security_interstitials/core/safe_browsing_error_ui.cc
+++ b/components/security_interstitials/core/safe_browsing_loud_error_ui.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "components/security_interstitials/core/safe_browsing_error_ui.h"
+#include "components/security_interstitials/core/safe_browsing_loud_error_ui.h"
#include "base/i18n/time_formatting.h"
#include "base/metrics/histogram_macros.h"
@@ -50,15 +50,16 @@ void RecordExtendedReportingPrefChanged(bool report, bool is_scout) {
} // namespace
-SafeBrowsingErrorUI::SafeBrowsingErrorUI(
+SafeBrowsingLoudErrorUI::SafeBrowsingLoudErrorUI(
const GURL& request_url,
const GURL& main_frame_url,
- SBInterstitialReason reason,
- const SBErrorDisplayOptions& display_options,
+ BaseSafeBrowsingErrorUI::SBInterstitialReason reason,
+ const BaseSafeBrowsingErrorUI::SBErrorDisplayOptions& display_options,
const std::string& app_locale,
const base::Time& time_triggered,
ControllerClient* controller)
- : request_url_(request_url),
+ : base_safe_browsing_error_ui(reason, display_options, app_locale),
+ request_url_(request_url),
main_frame_url_(main_frame_url),
interstitial_reason_(reason),
display_options_(display_options),
@@ -73,11 +74,11 @@ SafeBrowsingErrorUI::SafeBrowsingErrorUI(
security_interstitials::MetricsHelper::PROCEEDING_DISABLED);
}
-SafeBrowsingErrorUI::~SafeBrowsingErrorUI() {
+SafeBrowsingLoudErrorUI::~SafeBrowsingLoudErrorUI() {
controller_->metrics_helper()->RecordShutdownMetrics();
}
-void SafeBrowsingErrorUI::PopulateStringsForHTML(
+void SafeBrowsingLoudErrorUI::PopulateStringsForHTML(
base::DictionaryValue* load_time_data) {
DCHECK(load_time_data);
@@ -96,14 +97,19 @@ void SafeBrowsingErrorUI::PopulateStringsForHTML(
load_time_data->SetBoolean("overridable",
!display_options_.is_proceed_anyway_disabled);
+ // Webview layout does not allow going back to safety.
+ bool is_webview = controller_->IsWebView();
+ load_time_data->SetBoolean("hide_primary_button", is_webview);
+ load_time_data->SetBoolean("webview", is_webview);
+
switch (interstitial_reason_) {
- case SB_REASON_MALWARE:
+ case BaseSafeBrowsingErrorUI::SB_REASON_MALWARE:
PopulateMalwareLoadTimeData(load_time_data);
break;
- case SB_REASON_HARMFUL:
+ case BaseSafeBrowsingErrorUI::SB_REASON_HARMFUL:
PopulateHarmfulLoadTimeData(load_time_data);
break;
- case SB_REASON_PHISHING:
+ case BaseSafeBrowsingErrorUI::SB_REASON_PHISHING:
PopulatePhishingLoadTimeData(load_time_data);
break;
}
@@ -111,7 +117,8 @@ void SafeBrowsingErrorUI::PopulateStringsForHTML(
PopulateExtendedReportingOption(load_time_data);
}
-void SafeBrowsingErrorUI::HandleCommand(SecurityInterstitialCommands command) {
+void SafeBrowsingLoudErrorUI::HandleCommand(
+ SecurityInterstitialCommands command) {
switch (command) {
case CMD_PROCEED: {
// User pressed on the button to proceed.
@@ -215,11 +222,13 @@ void SafeBrowsingErrorUI::HandleCommand(SecurityInterstitialCommands command) {
}
}
-bool SafeBrowsingErrorUI::CanShowExtendedReportingOption() {
- return !is_off_the_record() && is_extended_reporting_opt_in_allowed();
+bool SafeBrowsingLoudErrorUI::CanShowExtendedReportingOption() {
+ return !base_safe_browsing_error_ui.is_off_the_record() &&
+ base_safe_browsing_error_ui.is_extended_reporting_opt_in_allowed() &&
+ !controller_->IsWebView();
}
-void SafeBrowsingErrorUI::PopulateMalwareLoadTimeData(
+void SafeBrowsingLoudErrorUI::PopulateMalwareLoadTimeData(
base::DictionaryValue* load_time_data) {
load_time_data->SetBoolean("phishing", false);
load_time_data->SetString("heading",
@@ -244,7 +253,7 @@ void SafeBrowsingErrorUI::PopulateMalwareLoadTimeData(
l10n_util::GetStringUTF16(IDS_MALWARE_V3_PROCEED_PARAGRAPH));
}
-void SafeBrowsingErrorUI::PopulateHarmfulLoadTimeData(
+void SafeBrowsingLoudErrorUI::PopulateHarmfulLoadTimeData(
base::DictionaryValue* load_time_data) {
load_time_data->SetBoolean("phishing", false);
load_time_data->SetString("heading",
@@ -264,7 +273,7 @@ void SafeBrowsingErrorUI::PopulateHarmfulLoadTimeData(
l10n_util::GetStringUTF16(IDS_HARMFUL_V3_PROCEED_PARAGRAPH));
}
-void SafeBrowsingErrorUI::PopulatePhishingLoadTimeData(
+void SafeBrowsingLoudErrorUI::PopulatePhishingLoadTimeData(
base::DictionaryValue* load_time_data) {
load_time_data->SetBoolean("phishing", true);
load_time_data->SetString("heading",
@@ -284,7 +293,7 @@ void SafeBrowsingErrorUI::PopulatePhishingLoadTimeData(
l10n_util::GetStringUTF16(IDS_PHISHING_V4_PROCEED_AND_REPORT_PARAGRAPH));
}
-void SafeBrowsingErrorUI::PopulateExtendedReportingOption(
+void SafeBrowsingLoudErrorUI::PopulateExtendedReportingOption(
base::DictionaryValue* load_time_data) {
bool can_show_extended_reporting_option = CanShowExtendedReportingOption();
load_time_data->SetBoolean(security_interstitials::kDisplayCheckBox,

Powered by Google App Engine
This is Rietveld 408576698