OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/browser/autocheckout_manager.h" | 5 #include "components/autofill/browser/autocheckout_manager.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "components/autofill/browser/autocheckout_request_manager.h" | 10 #include "components/autofill/browser/autocheckout_request_manager.h" |
11 #include "components/autofill/browser/autofill_country.h" | 11 #include "components/autofill/browser/autofill_country.h" |
12 #include "components/autofill/browser/autofill_field.h" | 12 #include "components/autofill/browser/autofill_field.h" |
13 #include "components/autofill/browser/autofill_manager.h" | 13 #include "components/autofill/browser/autofill_manager.h" |
14 #include "components/autofill/browser/autofill_metrics.h" | 14 #include "components/autofill/browser/autofill_metrics.h" |
15 #include "components/autofill/browser/autofill_profile.h" | 15 #include "components/autofill/browser/autofill_profile.h" |
16 #include "components/autofill/browser/credit_card.h" | 16 #include "components/autofill/browser/credit_card.h" |
17 #include "components/autofill/browser/field_types.h" | 17 #include "components/autofill/browser/field_types.h" |
18 #include "components/autofill/browser/form_structure.h" | 18 #include "components/autofill/browser/form_structure.h" |
19 #include "components/autofill/common/autofill_messages.h" | 19 #include "components/autofill/common/autofill_messages.h" |
20 #include "components/autofill/common/form_data.h" | 20 #include "components/autofill/common/form_data.h" |
21 #include "components/autofill/common/form_field_data.h" | 21 #include "components/autofill/common/form_field_data.h" |
22 #include "components/autofill/common/web_element_descriptor.h" | 22 #include "components/autofill/common/web_element_descriptor.h" |
23 // TODO(jam) remove once https://codereview.chromium.org/13488009/ lands, since | |
24 // that brings localle to AutofillManager. | |
25 #include "content/public/browser/content_browser_client.h" | |
23 #include "content/public/browser/render_view_host.h" | 26 #include "content/public/browser/render_view_host.h" |
24 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
25 #include "content/public/common/ssl_status.h" | 28 #include "content/public/common/ssl_status.h" |
26 #include "googleurl/src/gurl.h" | 29 #include "googleurl/src/gurl.h" |
27 #include "ui/gfx/rect.h" | 30 #include "ui/gfx/rect.h" |
28 | 31 |
29 using content::RenderViewHost; | 32 using content::RenderViewHost; |
30 using content::SSLStatus; | 33 using content::SSLStatus; |
31 using content::WebContents; | 34 using content::WebContents; |
32 | 35 |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
280 | 283 |
281 for (size_t i = 0; i < result->field_count(); ++i) { | 284 for (size_t i = 0; i < result->field_count(); ++i) { |
282 AutofillFieldType type = result->field(i)->type(); | 285 AutofillFieldType type = result->field(i)->type(); |
283 if (type == CREDIT_CARD_VERIFICATION_CODE) { | 286 if (type == CREDIT_CARD_VERIFICATION_CODE) { |
284 cvv_ = result->field(i)->value; | 287 cvv_ = result->field(i)->value; |
285 continue; | 288 continue; |
286 } | 289 } |
287 if (AutofillType(type).group() == AutofillType::CREDIT_CARD) { | 290 if (AutofillType(type).group() == AutofillType::CREDIT_CARD) { |
288 credit_card_->SetRawInfo(result->field(i)->type(), | 291 credit_card_->SetRawInfo(result->field(i)->type(), |
289 result->field(i)->value); | 292 result->field(i)->value); |
293 } else if (result->field(i)->type() == ADDRESS_HOME_COUNTRY) { | |
Ilya Sherman
2013/04/05 07:18:41
I think you need to handle ADDRESS_BILLING_COUNTRY
jam
2013/04/05 07:35:35
Done.
| |
294 profile_->SetInfo(ADDRESS_HOME_COUNTRY, | |
295 result->field(i)->value, | |
296 // TODO(jam) remove once | |
297 // https://codereview.chromium.org/13488009/ | |
298 // lands, since that brings localle to AutofillManager. | |
299 content::GetContentClient()->browser()-> | |
300 GetApplicationLocale()); | |
290 } else { | 301 } else { |
291 profile_->SetRawInfo(result->field(i)->type(), result->field(i)->value); | 302 profile_->SetRawInfo(result->field(i)->type(), result->field(i)->value); |
292 } | 303 } |
293 } | 304 } |
294 | 305 |
295 // Add 1.0 since page numbers are 0-indexed. | 306 // Add 1.0 since page numbers are 0-indexed. |
296 autofill_manager_->delegate()->UpdateProgressBar( | 307 autofill_manager_->delegate()->UpdateProgressBar( |
297 (1.0 + page_meta_data_->current_page_number) / | 308 (1.0 + page_meta_data_->current_page_number) / |
298 page_meta_data_->total_pages); | 309 page_meta_data_->total_pages); |
299 FillForms(); | 310 FillForms(); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
367 google_transaction_id_); | 378 google_transaction_id_); |
368 | 379 |
369 // Log the result of this Autocheckout flow to UMA. | 380 // Log the result of this Autocheckout flow to UMA. |
370 metric_logger_->LogAutocheckoutBuyFlowMetric( | 381 metric_logger_->LogAutocheckoutBuyFlowMetric( |
371 AutocheckoutStatusToUmaMetric(status)); | 382 AutocheckoutStatusToUmaMetric(status)); |
372 | 383 |
373 google_transaction_id_ = kTransactionIdNotSet; | 384 google_transaction_id_ = kTransactionIdNotSet; |
374 } | 385 } |
375 | 386 |
376 } // namespace autofill | 387 } // namespace autofill |
OLD | NEW |