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

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

Issue 756333003: Prompt for unmasking Wallet credit card on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix compile post-merge Created 6 years 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_external_delegate.h" 5 #include "components/autofill/core/browser/autofill_external_delegate.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 return; 95 return;
96 96
97 std::vector<base::string16> values(suggested_values); 97 std::vector<base::string16> values(suggested_values);
98 std::vector<base::string16> labels(suggested_labels); 98 std::vector<base::string16> labels(suggested_labels);
99 std::vector<base::string16> icons(suggested_icons); 99 std::vector<base::string16> icons(suggested_icons);
100 std::vector<int> ids(suggested_unique_ids); 100 std::vector<int> ids(suggested_unique_ids);
101 101
102 // Add or hide warnings as appropriate. 102 // Add or hide warnings as appropriate.
103 ApplyAutofillWarnings(&values, &labels, &icons, &ids); 103 ApplyAutofillWarnings(&values, &labels, &icons, &ids);
104 104
105 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
106 switches::kEnableWalletCardImport)) {
107 // For now, add a fake masked card.
108 values.push_back(base::ASCIIToUTF16("Visa - 1111"));
109 labels.push_back(base::ASCIIToUTF16("[tap to unlock]"));
110 icons.push_back(base::string16());
111 ids.push_back(POPUP_ITEM_ID_FAKE_MASKED_INSTRUMENT);
112 }
113
105 // Add a separator to go between the values and menu items. 114 // Add a separator to go between the values and menu items.
106 values.push_back(base::string16()); 115 values.push_back(base::string16());
107 labels.push_back(base::string16()); 116 labels.push_back(base::string16());
108 icons.push_back(base::string16()); 117 icons.push_back(base::string16());
109 ids.push_back(POPUP_ITEM_ID_SEPARATOR); 118 ids.push_back(POPUP_ITEM_ID_SEPARATOR);
110 119
111 if (manager_->ShouldShowScanCreditCard(query_form_, query_field_)) { 120 if (manager_->ShouldShowScanCreditCard(query_form_, query_field_)) {
112 values.push_back(l10n_util::GetStringUTF16(IDS_AUTOFILL_SCAN_CREDIT_CARD)); 121 values.push_back(l10n_util::GetStringUTF16(IDS_AUTOFILL_SCAN_CREDIT_CARD));
113 labels.push_back(base::string16()); 122 labels.push_back(base::string16());
114 icons.push_back(base::string16()); 123 icons.push_back(base::string16());
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 base::MessageLoop::current()->PostDelayedTask( 266 base::MessageLoop::current()->PostDelayedTask(
258 FROM_HERE, 267 FROM_HERE,
259 base::Bind(&AutofillExternalDelegate::PingRenderer, GetWeakPtr()), 268 base::Bind(&AutofillExternalDelegate::PingRenderer, GetWeakPtr()),
260 delay); 269 delay);
261 #else 270 #else
262 NOTREACHED(); 271 NOTREACHED();
263 #endif // defined(OS_MACOSX) && !defined(OS_IOS) 272 #endif // defined(OS_MACOSX) && !defined(OS_IOS)
264 } else if (identifier == POPUP_ITEM_ID_SCAN_CREDIT_CARD) { 273 } else if (identifier == POPUP_ITEM_ID_SCAN_CREDIT_CARD) {
265 manager_->client()->ScanCreditCard(base::Bind( 274 manager_->client()->ScanCreditCard(base::Bind(
266 &AutofillExternalDelegate::OnCreditCardScanned, GetWeakPtr())); 275 &AutofillExternalDelegate::OnCreditCardScanned, GetWeakPtr()));
276 } else if (identifier == POPUP_ITEM_ID_FAKE_MASKED_INSTRUMENT) {
277 manager_->client()->ShowUnmaskPrompt();
267 } else { 278 } else {
268 FillAutofillFormData(identifier, false); 279 FillAutofillFormData(identifier, false);
269 } 280 }
270 281
271 manager_->client()->HideAutofillPopup(); 282 manager_->client()->HideAutofillPopup();
272 } 283 }
273 284
274 void AutofillExternalDelegate::RemoveSuggestion(const base::string16& value, 285 void AutofillExternalDelegate::RemoveSuggestion(const base::string16& value,
275 int identifier) { 286 int identifier) {
276 if (identifier > 0) 287 if (identifier > 0)
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 POPUP_ITEM_ID_DATALIST_ENTRY); 444 POPUP_ITEM_ID_DATALIST_ENTRY);
434 } 445 }
435 446
436 #if defined(OS_MACOSX) && !defined(OS_IOS) 447 #if defined(OS_MACOSX) && !defined(OS_IOS)
437 void AutofillExternalDelegate::PingRenderer() { 448 void AutofillExternalDelegate::PingRenderer() {
438 driver_->PingRenderer(); 449 driver_->PingRenderer();
439 } 450 }
440 #endif // defined(OS_MACOSX) && !defined(OS_IOS) 451 #endif // defined(OS_MACOSX) && !defined(OS_IOS)
441 452
442 } // namespace autofill 453 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_client.h ('k') | components/autofill/core/browser/popup_item_ids.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698