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

Unified Diff: components/autofill/core/browser/autofill_manager.cc

Issue 2676513007: Do not show Scan or Sign In options when credit card form is non-secure (Closed)
Patch Set: Simplify logic Created 3 years, 10 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
« no previous file with comments | « components/autofill/core/browser/autofill_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/core/browser/autofill_manager.cc
diff --git a/components/autofill/core/browser/autofill_manager.cc b/components/autofill/core/browser/autofill_manager.cc
index 72cf42156b3eb55a299558fdbe890ff651ddb29b..2f70e8c494575d95449b0ffed5ccfcdddd680be9 100644
--- a/components/autofill/core/browser/autofill_manager.cc
+++ b/components/autofill/core/browser/autofill_manager.cc
@@ -309,6 +309,9 @@ bool AutofillManager::ShouldShowScanCreditCard(const FormData& form,
if (!is_card_number_field && !is_scannable_name_on_card_field)
return false;
+ if (IsFormNonSecure(form))
+ return false;
+
static const int kShowScanCreditCardMaxValueLength = 6;
return field.value.size() <= kShowScanCreditCardMaxValueLength;
}
@@ -329,6 +332,9 @@ bool AutofillManager::ShouldShowCreditCardSigninPromo(
!client_->ShouldShowSigninPromo())
return false;
+ if (IsFormNonSecure(form))
+ return false;
+
// The last step is checking if we are under the limit of impressions.
int impression_count = client_->GetPrefs()->GetInteger(
prefs::kAutofillCreditCardSigninPromoImpressionCount);
@@ -527,6 +533,15 @@ void AutofillManager::OnTextFieldDidChange(const FormData& form,
UpdateInitialInteractionTimestamp(timestamp);
}
+bool AutofillManager::IsFormNonSecure(const FormData& form) const {
Mathieu 2017/02/06 18:16:41 short unit test? AutofillClient functionality will
elawrence 2017/02/07 20:16:47 My new Unit tests exercise the IsFormNonSecure fun
+ if (!client_->IsContextSecure(form.origin))
+ return true;
+ if (form.action.is_valid() && form.action.SchemeIs("http"))
Mathieu 2017/02/06 18:16:41 return !client_->IsContextSecure(form.origin) || (
elawrence 2017/02/07 20:16:47 Done.
+ return true;
+
+ return false;
+}
+
void AutofillManager::OnQueryFormFieldAutofill(int query_id,
const FormData& form,
const FormFieldData& field,
@@ -563,11 +578,8 @@ void AutofillManager::OnQueryFormFieldAutofill(int query_id,
}
std::vector<Suggestion> suggestions;
- const bool is_context_secure =
- !form_structure ||
- (client_->IsContextSecure(form_structure->source_url()) &&
- (!form_structure->target_url().is_valid() ||
- !form_structure->target_url().SchemeIs("http")));
+ const bool is_context_secure = !IsFormNonSecure(form);
+
const bool is_http_warning_enabled =
security_state::IsHttpWarningInFormEnabled();
« no previous file with comments | « components/autofill/core/browser/autofill_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698