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

Unified Diff: components/safe_browsing/password_protection/password_protection_service.cc

Issue 2905343002: Show interstitial on a password on focus ping with PHISHING verdict. (Closed)
Patch Set: nit 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/password_protection/password_protection_service.cc
diff --git a/components/safe_browsing/password_protection/password_protection_service.cc b/components/safe_browsing/password_protection/password_protection_service.cc
index bdc9cff88cd86249d117228a884115980fe56264..a16ef3afd719de6a893d9adbc83b0685b1ec5030 100644
--- a/components/safe_browsing/password_protection/password_protection_service.cc
+++ b/components/safe_browsing/password_protection/password_protection_service.cc
@@ -74,6 +74,9 @@ const base::Feature kPasswordFieldOnFocusPinging{
const base::Feature kProtectedPasswordEntryPinging{
"ProtectedPasswordEntryPinging", base::FEATURE_DISABLED_BY_DEFAULT};
+const base::Feature kPasswordProtectionInterstitial{
+ "PasswordProtectionInterstitial", base::FEATURE_DISABLED_BY_DEFAULT};
+
const char kPasswordOnFocusRequestOutcomeHistogramName[] =
"PasswordProtection.RequestOutcome.PasswordFieldOnFocus";
const char kPasswordEntryRequestOutcomeHistogramName[] =
@@ -319,12 +322,26 @@ bool PasswordProtectionService::CanSendPing(const base::Feature& feature,
void PasswordProtectionService::RequestFinished(
PasswordProtectionRequest* request,
+ bool already_cached,
std::unique_ptr<LoginReputationClientResponse> response) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
-
DCHECK(request);
- if (response)
- CacheVerdict(request->main_frame_url(), response.get(), base::Time::Now());
+
+ if (response) {
+ if (!already_cached) {
+ CacheVerdict(request->main_frame_url(), response.get(),
+ base::Time::Now());
+ }
+
+ if (request->request_type() ==
+ LoginReputationClientRequest::UNFAMILIAR_LOGIN_PAGE &&
+ response->verdict_type() == LoginReputationClientResponse::PHISHING &&
+ base::FeatureList::IsEnabled(kPasswordProtectionInterstitial)) {
+ ShowPhishingInterstitial(request->main_frame_url(),
+ response->verdict_token(),
+ request->web_contents());
+ }
+ }
// Finished processing this request. Remove it from pending list.
for (auto it = requests_.begin(); it != requests_.end(); it++) {

Powered by Google App Engine
This is Rietveld 408576698