| OLD | NEW |
| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 // Reissue the most recent query, which will reopen the Autofill popup. | 261 // Reissue the most recent query, which will reopen the Autofill popup. |
| 262 manager_->OnQueryFormFieldAutofill(query_id_, query_form_, query_field_, | 262 manager_->OnQueryFormFieldAutofill(query_id_, query_form_, query_field_, |
| 263 element_bounds_); | 263 element_bounds_); |
| 264 } | 264 } |
| 265 | 265 |
| 266 base::WeakPtr<AutofillExternalDelegate> AutofillExternalDelegate::GetWeakPtr() { | 266 base::WeakPtr<AutofillExternalDelegate> AutofillExternalDelegate::GetWeakPtr() { |
| 267 return weak_ptr_factory_.GetWeakPtr(); | 267 return weak_ptr_factory_.GetWeakPtr(); |
| 268 } | 268 } |
| 269 | 269 |
| 270 void AutofillExternalDelegate::OnCreditCardScanned( | 270 void AutofillExternalDelegate::OnCreditCardScanned( |
| 271 const base::string16& card_holder_name, |
| 271 const base::string16& card_number, | 272 const base::string16& card_number, |
| 272 int expiration_month, | 273 int expiration_month, |
| 273 int expiration_year) { | 274 int expiration_year) { |
| 274 manager_->FillCreditCardForm( | 275 manager_->FillCreditCardForm(query_id_, query_form_, query_field_, |
| 275 query_id_, query_form_, query_field_, | 276 CreditCard(card_holder_name, card_number, |
| 276 CreditCard(card_number, expiration_month, expiration_year), | 277 expiration_month, expiration_year), |
| 277 base::string16()); | 278 base::string16()); |
| 278 } | 279 } |
| 279 | 280 |
| 280 void AutofillExternalDelegate::FillAutofillFormData(int unique_id, | 281 void AutofillExternalDelegate::FillAutofillFormData(int unique_id, |
| 281 bool is_preview) { | 282 bool is_preview) { |
| 282 // If the selected element is a warning we don't want to do anything. | 283 // If the selected element is a warning we don't want to do anything. |
| 283 if (unique_id == POPUP_ITEM_ID_WARNING_MESSAGE) | 284 if (unique_id == POPUP_ITEM_ID_WARNING_MESSAGE) |
| 284 return; | 285 return; |
| 285 | 286 |
| 286 AutofillDriver::RendererFormDataAction renderer_action = is_preview ? | 287 AutofillDriver::RendererFormDataAction renderer_action = is_preview ? |
| 287 AutofillDriver::FORM_DATA_ACTION_PREVIEW : | 288 AutofillDriver::FORM_DATA_ACTION_PREVIEW : |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 suggestions->insert(suggestions->begin(), data_list_values_.size(), | 365 suggestions->insert(suggestions->begin(), data_list_values_.size(), |
| 365 Suggestion()); | 366 Suggestion()); |
| 366 for (size_t i = 0; i < data_list_values_.size(); i++) { | 367 for (size_t i = 0; i < data_list_values_.size(); i++) { |
| 367 (*suggestions)[i].value = data_list_values_[i]; | 368 (*suggestions)[i].value = data_list_values_[i]; |
| 368 (*suggestions)[i].label = data_list_labels_[i]; | 369 (*suggestions)[i].label = data_list_labels_[i]; |
| 369 (*suggestions)[i].frontend_id = POPUP_ITEM_ID_DATALIST_ENTRY; | 370 (*suggestions)[i].frontend_id = POPUP_ITEM_ID_DATALIST_ENTRY; |
| 370 } | 371 } |
| 371 } | 372 } |
| 372 | 373 |
| 373 } // namespace autofill | 374 } // namespace autofill |
| OLD | NEW |