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

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

Issue 2253343003: Only show the credit card assist feature in secure contexts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move invariant check out of loop Created 4 years, 4 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 | « no previous file | components/autofill/core/browser/autofill_assistant_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/core/browser/autofill_assistant.cc
diff --git a/components/autofill/core/browser/autofill_assistant.cc b/components/autofill/core/browser/autofill_assistant.cc
index 982dd0591716353cf0a97e28c10aa2e7c2c85d75..1684643443ed15a1378e25293976d00530da9bd5 100644
--- a/components/autofill/core/browser/autofill_assistant.cc
+++ b/components/autofill/core/browser/autofill_assistant.cc
@@ -27,8 +27,13 @@ void AutofillAssistant::Reset() {
bool AutofillAssistant::CanShowCreditCardAssist(
const std::vector<FormStructure*>& form_structures) {
- if (!IsAutofillCreditCardAssistEnabled() || credit_card_form_data_)
+ if (form_structures.empty() || // No forms?
+ credit_card_form_data_ != nullptr || // Already done?
+ !IsAutofillCreditCardAssistEnabled() || // Assist disabled?
+ !autofill_manager_->client()->IsContextSecure( // Insecure?
Evan Stade 2016/08/22 15:07:08 nit: I don't think these comments are that helpful
Roger McFarlane (Chromium) 2016/08/23 21:58:44 Done.
+ form_structures.front()->source_url())) {
return false;
+ }
for (FormStructure* cur_form : base::Reversed(form_structures)) {
if (cur_form->IsCompleteCreditCardForm()) {
@@ -36,7 +41,7 @@ bool AutofillAssistant::CanShowCreditCardAssist(
break;
}
}
- return !!credit_card_form_data_;
+ return credit_card_form_data_ != nullptr;
}
void AutofillAssistant::ShowAssistForCreditCard(const CreditCard& card) {
« no previous file with comments | « no previous file | components/autofill/core/browser/autofill_assistant_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698