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

Unified Diff: components/safe_browsing/base_blocking_page.cc

Issue 2898593002: WebView: choose loud vs. quiet interstitial (Closed)
Patch Set: Rename test Created 3 years, 7 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/safe_browsing/base_blocking_page.cc
diff --git a/components/safe_browsing/base_blocking_page.cc b/components/safe_browsing/base_blocking_page.cc
index eaddeb8d36124a4208e87384fa42995d82cc8a10..8b25d29c04e52566702617a2d8a43914de4bbd30 100644
--- a/components/safe_browsing/base_blocking_page.cc
+++ b/components/safe_browsing/base_blocking_page.cc
@@ -13,6 +13,7 @@
#include "components/security_interstitials/content/security_interstitial_controller_client.h"
#include "components/security_interstitials/core/metrics_helper.h"
#include "components/security_interstitials/core/safe_browsing_loud_error_ui.h"
+#include "components/security_interstitials/core/safe_browsing_quiet_error_ui.h"
#include "content/public/browser/interstitial_page.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/web_contents.h"
@@ -21,6 +22,7 @@ using content::InterstitialPage;
using content::WebContents;
using security_interstitials::BaseSafeBrowsingErrorUI;
using security_interstitials::SafeBrowsingLoudErrorUI;
+using security_interstitials::SafeBrowsingQuietErrorUI;
using security_interstitials::SecurityInterstitialControllerClient;
namespace safe_browsing {
@@ -44,7 +46,8 @@ BaseBlockingPage::BaseBlockingPage(
const GURL& main_frame_url,
const UnsafeResourceList& unsafe_resources,
std::unique_ptr<SecurityInterstitialControllerClient> controller_client,
- const BaseSafeBrowsingErrorUI::SBErrorDisplayOptions& display_options)
+ const BaseSafeBrowsingErrorUI::SBErrorDisplayOptions& display_options,
+ ErrorUiType errorUiType)
: SecurityInterstitialPage(web_contents,
unsafe_resources[0].url,
std::move(controller_client)),
@@ -55,16 +58,21 @@ BaseBlockingPage::BaseBlockingPage(
? -1
: web_contents->GetController().GetLastCommittedEntryIndex()),
unsafe_resources_(unsafe_resources),
- sb_error_ui_(base::MakeUnique<SafeBrowsingLoudErrorUI>(
- unsafe_resources_[0].url,
- main_frame_url_,
- GetInterstitialReason(unsafe_resources_),
- display_options,
- ui_manager->app_locale(),
- base::Time::NowFromSystemTime(),
- controller())),
proceeded_(false),
threat_details_proceed_delay_ms_(kThreatDetailsProceedDelayMilliSeconds) {
+ if (errorUiType == ErrorUiType::LOUD) {
+ sb_error_ui_ = base::MakeUnique<SafeBrowsingLoudErrorUI>(
+ unsafe_resources_[0].url, main_frame_url_,
+ GetInterstitialReason(unsafe_resources_), display_options,
+ ui_manager->app_locale(), base::Time::NowFromSystemTime(),
+ controller());
+ } else {
+ sb_error_ui_ = base::MakeUnique<SafeBrowsingQuietErrorUI>(
+ unsafe_resources_[0].url, main_frame_url_,
+ GetInterstitialReason(unsafe_resources_), display_options,
+ ui_manager->app_locale(), base::Time::NowFromSystemTime(), controller(),
+ errorUiType == ErrorUiType::QUIET_GIANT);
+ }
}
BaseBlockingPage::~BaseBlockingPage() {}
@@ -106,7 +114,7 @@ void BaseBlockingPage::ShowBlockingPage(
ui_manager, web_contents, entry ? entry->GetURL() : GURL(),
unsafe_resources,
CreateControllerClient(web_contents, unsafe_resources, ui_manager),
- CreateDefaultDisplayOptions(unsafe_resources));
+ CreateDefaultDisplayOptions(unsafe_resources), ErrorUiType::LOUD);
blocking_page->Show();
}
}
@@ -351,4 +359,8 @@ BaseBlockingPage::CreateControllerClient(
ui_manager->app_locale(), ui_manager->default_safe_page());
}
+int BaseBlockingPage::GetHTMLTemplateId() {
+ return sb_error_ui_->GetHTMLTemplateId();
+}
+
} // namespace safe_browsing

Powered by Google App Engine
This is Rietveld 408576698