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

Side by Side Diff: components/autofill/core/browser/autofill_assistant.cc

Issue 2672623005: Record Autofill form events specially for nonsecure pages (Closed)
Patch Set: fix test added in rebase 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/autofill/core/browser/autofill_assistant.h" 5 #include "components/autofill/core/browser/autofill_assistant.h"
6 6
7 #include "base/containers/adapters.h" 7 #include "base/containers/adapters.h"
8 #include "base/strings/string16.h" 8 #include "base/strings/string16.h"
9 #include "components/autofill/core/browser/autofill_experiments.h" 9 #include "components/autofill/core/browser/autofill_experiments.h"
10 #include "components/autofill/core/browser/autofill_manager.h" 10 #include "components/autofill/core/browser/autofill_manager.h"
(...skipping 13 matching lines...) Expand all
24 void AutofillAssistant::Reset() { 24 void AutofillAssistant::Reset() {
25 credit_card_form_data_.reset(); 25 credit_card_form_data_.reset();
26 } 26 }
27 27
28 bool AutofillAssistant::CanShowCreditCardAssist( 28 bool AutofillAssistant::CanShowCreditCardAssist(
29 const std::vector<std::unique_ptr<FormStructure>>& form_structures) { 29 const std::vector<std::unique_ptr<FormStructure>>& form_structures) {
30 if (form_structures.empty() || credit_card_form_data_ != nullptr || 30 if (form_structures.empty() || credit_card_form_data_ != nullptr ||
31 !IsAutofillCreditCardAssistEnabled() || 31 !IsAutofillCreditCardAssistEnabled() ||
32 // Context of the page is not secure or target URL is valid but not 32 // Context of the page is not secure or target URL is valid but not
33 // secure. 33 // secure.
34 !(autofill_manager_->client()->IsContextSecure( 34 !(autofill_manager_->client()->IsContextSecure() &&
35 form_structures.front()->source_url()) &&
36 (!form_structures.front()->target_url().is_valid() || 35 (!form_structures.front()->target_url().is_valid() ||
37 !form_structures.front()->target_url().SchemeIs("http")))) { 36 !form_structures.front()->target_url().SchemeIs("http")))) {
38 return false; 37 return false;
39 } 38 }
40 39
41 for (auto& cur_form : base::Reversed(form_structures)) { 40 for (auto& cur_form : base::Reversed(form_structures)) {
42 if (cur_form->IsCompleteCreditCardForm()) { 41 if (cur_form->IsCompleteCreditCardForm()) {
43 credit_card_form_data_.reset(new FormData(cur_form->ToFormData())); 42 credit_card_form_data_.reset(new FormData(cur_form->ToFormData()));
44 break; 43 break;
45 } 44 }
(...skipping 17 matching lines...) Expand all
63 void AutofillAssistant::OnFullCardRequestSucceeded(const CreditCard& card, 62 void AutofillAssistant::OnFullCardRequestSucceeded(const CreditCard& card,
64 const base::string16& cvc) { 63 const base::string16& cvc) {
65 autofill_manager_->FillCreditCardForm(kNoQueryId, *credit_card_form_data_, 64 autofill_manager_->FillCreditCardForm(kNoQueryId, *credit_card_form_data_,
66 credit_card_form_data_->fields[0], card, 65 credit_card_form_data_->fields[0], card,
67 cvc); 66 cvc);
68 } 67 }
69 68
70 void AutofillAssistant::OnFullCardRequestFailed() {} 69 void AutofillAssistant::OnFullCardRequestFailed() {}
71 70
72 } // namespace autofill 71 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/browser/ui/autofill/chrome_autofill_client.cc ('k') | components/autofill/core/browser/autofill_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698