| 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 || |
| 294 result->field(i)->type() == ADDRESS_BILLING_COUNTRY) { |
| 295 profile_->SetInfo(result->field(i)->type(), |
| 296 result->field(i)->value, |
| 297 // TODO(jam) remove once |
| 298 // https://codereview.chromium.org/13488009/ |
| 299 // lands, since that brings localle to AutofillManager. |
| 300 content::GetContentClient()->browser()-> |
| 301 GetApplicationLocale()); |
| 290 } else { | 302 } else { |
| 291 profile_->SetRawInfo(result->field(i)->type(), result->field(i)->value); | 303 profile_->SetRawInfo(result->field(i)->type(), result->field(i)->value); |
| 292 } | 304 } |
| 293 } | 305 } |
| 294 | 306 |
| 295 // Add 1.0 since page numbers are 0-indexed. | 307 // Add 1.0 since page numbers are 0-indexed. |
| 296 autofill_manager_->delegate()->UpdateProgressBar( | 308 autofill_manager_->delegate()->UpdateProgressBar( |
| 297 (1.0 + page_meta_data_->current_page_number) / | 309 (1.0 + page_meta_data_->current_page_number) / |
| 298 page_meta_data_->total_pages); | 310 page_meta_data_->total_pages); |
| 299 FillForms(); | 311 FillForms(); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 google_transaction_id_); | 379 google_transaction_id_); |
| 368 | 380 |
| 369 // Log the result of this Autocheckout flow to UMA. | 381 // Log the result of this Autocheckout flow to UMA. |
| 370 metric_logger_->LogAutocheckoutBuyFlowMetric( | 382 metric_logger_->LogAutocheckoutBuyFlowMetric( |
| 371 AutocheckoutStatusToUmaMetric(status)); | 383 AutocheckoutStatusToUmaMetric(status)); |
| 372 | 384 |
| 373 google_transaction_id_ = kTransactionIdNotSet; | 385 google_transaction_id_ = kTransactionIdNotSet; |
| 374 } | 386 } |
| 375 | 387 |
| 376 } // namespace autofill | 388 } // namespace autofill |
| OLD | NEW |