| 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 "chrome/browser/ui/android/autofill/autofill_dialog_controller_android.
h" | 5 #include "chrome/browser/ui/android/autofill/autofill_dialog_controller_android.
h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
| 9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
| 10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 return scoped_ptr<DataModelWrapper>(); | 76 return scoped_ptr<DataModelWrapper>(); |
| 77 } | 77 } |
| 78 | 78 |
| 79 void FillOutputForSectionWithComparator( | 79 void FillOutputForSectionWithComparator( |
| 80 DialogSection section, const DetailInputs& inputs, | 80 DialogSection section, const DetailInputs& inputs, |
| 81 const InputFieldComparator& compare, | 81 const InputFieldComparator& compare, |
| 82 FormStructure& form_structure, wallet::FullWallet* full_wallet, | 82 FormStructure& form_structure, wallet::FullWallet* full_wallet, |
| 83 const base::string16& email_address) { | 83 const base::string16& email_address) { |
| 84 | 84 |
| 85 // Email is hidden while using Wallet, special case it. | 85 // Email is hidden while using Wallet, special case it. |
| 86 if (section == SECTION_EMAIL) { | 86 if (section == SECTION_CC_BILLING) { |
| 87 AutofillProfile profile; | 87 AutofillProfile profile; |
| 88 profile.SetRawInfo(EMAIL_ADDRESS, email_address); | 88 profile.SetRawInfo(EMAIL_ADDRESS, email_address); |
| 89 AutofillProfileWrapper profile_wrapper(&profile, 0); | 89 AutofillProfileWrapper profile_wrapper(&profile, 0); |
| 90 profile_wrapper.FillFormStructure(inputs, compare, &form_structure); | 90 profile_wrapper.FillFormStructure(inputs, compare, &form_structure); |
| 91 return; | 91 return; |
| 92 } | 92 } |
| 93 | 93 |
| 94 scoped_ptr<DataModelWrapper> wrapper = CreateWrapper(section, full_wallet); | 94 scoped_ptr<DataModelWrapper> wrapper = CreateWrapper(section, full_wallet); |
| 95 if (wrapper) | 95 if (wrapper) |
| 96 wrapper->FillFormStructure(inputs, compare, &form_structure); | 96 wrapper->FillFormStructure(inputs, compare, &form_structure); |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 const std::string last_used_billing = | 361 const std::string last_used_billing = |
| 362 base::android::ConvertJavaStringToUTF8(env, jlast_used_billing); | 362 base::android::ConvertJavaStringToUTF8(env, jlast_used_billing); |
| 363 const std::string last_used_shipping = | 363 const std::string last_used_shipping = |
| 364 base::android::ConvertJavaStringToUTF8(env, jlast_used_shipping); | 364 base::android::ConvertJavaStringToUTF8(env, jlast_used_shipping); |
| 365 const std::string last_used_card = | 365 const std::string last_used_card = |
| 366 base::android::ConvertJavaStringToUTF8(env, jlast_used_card); | 366 base::android::ConvertJavaStringToUTF8(env, jlast_used_card); |
| 367 | 367 |
| 368 scoped_ptr<wallet::FullWallet> full_wallet = | 368 scoped_ptr<wallet::FullWallet> full_wallet = |
| 369 AutofillDialogResult::ConvertFromJava(env, wallet); | 369 AutofillDialogResult::ConvertFromJava(env, wallet); |
| 370 FillOutputForSection( | 370 FillOutputForSection( |
| 371 SECTION_EMAIL, form_structure_, full_wallet.get(), email); | |
| 372 FillOutputForSection( | |
| 373 SECTION_CC_BILLING, form_structure_, full_wallet.get(), email); | 371 SECTION_CC_BILLING, form_structure_, full_wallet.get(), email); |
| 374 FillOutputForSection( | 372 FillOutputForSection( |
| 375 SECTION_SHIPPING, form_structure_, full_wallet.get(), email); | 373 SECTION_SHIPPING, form_structure_, full_wallet.get(), email); |
| 376 | 374 |
| 377 { | 375 { |
| 378 DictionaryPrefUpdate updater(profile_->GetPrefs(), | 376 DictionaryPrefUpdate updater(profile_->GetPrefs(), |
| 379 ::prefs::kAutofillDialogDefaults); | 377 ::prefs::kAutofillDialogDefaults); |
| 380 base::DictionaryValue* defaults = updater.Get(); | 378 base::DictionaryValue* defaults = updater.Get(); |
| 381 if (defaults) { | 379 if (defaults) { |
| 382 const bool last_used_choice_is_autofill = !!jlast_used_choice_is_autofill; | 380 const bool last_used_choice_is_autofill = !!jlast_used_choice_is_autofill; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 GetMetricLogger().LogDialogUiDuration( | 453 GetMetricLogger().LogDialogUiDuration( |
| 456 base::Time::Now() - dialog_shown_timestamp_, | 454 base::Time::Now() - dialog_shown_timestamp_, |
| 457 GetDialogType(), | 455 GetDialogType(), |
| 458 AutofillMetrics::DIALOG_CANCELED); | 456 AutofillMetrics::DIALOG_CANCELED); |
| 459 | 457 |
| 460 GetMetricLogger().LogDialogUiEvent( | 458 GetMetricLogger().LogDialogUiEvent( |
| 461 GetDialogType(), AutofillMetrics::DIALOG_UI_CANCELED); | 459 GetDialogType(), AutofillMetrics::DIALOG_UI_CANCELED); |
| 462 } | 460 } |
| 463 | 461 |
| 464 } // namespace autofill | 462 } // namespace autofill |
| OLD | NEW |