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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 (section == SECTION_SHIPPING && !full_wallet->shipping_address())) { | 108 (section == SECTION_SHIPPING && !full_wallet->shipping_address())) { |
109 return; | 109 return; |
110 } | 110 } |
111 | 111 |
112 base::Callback<base::string16(const AutofillType&)> get_info = | 112 base::Callback<base::string16(const AutofillType&)> get_info = |
113 base::Bind(&FullWallet::GetInfo, | 113 base::Bind(&FullWallet::GetInfo, |
114 base::Unretained(full_wallet), | 114 base::Unretained(full_wallet), |
115 g_browser_process->GetApplicationLocale()); | 115 g_browser_process->GetApplicationLocale()); |
116 | 116 |
117 std::vector<ServerFieldType> types = common::TypesFromInputs(inputs); | 117 std::vector<ServerFieldType> types = common::TypesFromInputs(inputs); |
118 form_structure.FillFields( | 118 form_structure.FillFields(types, |
119 types, | 119 compare, |
120 compare, | 120 get_info, |
121 get_info, | 121 g_browser_process->GetApplicationLocale()); |
122 section == SECTION_CC_BILLING | |
123 ? full_wallet->billing_address()->language_code() | |
124 : full_wallet->shipping_address()->language_code(), | |
125 g_browser_process->GetApplicationLocale()); | |
126 } | 122 } |
127 | 123 |
128 void FillOutputForSection( | 124 void FillOutputForSection( |
129 DialogSection section, | 125 DialogSection section, |
130 FormStructure& form_structure, | 126 FormStructure& form_structure, |
131 FullWallet* full_wallet, | 127 FullWallet* full_wallet, |
132 const base::string16& email_address) { | 128 const base::string16& email_address) { |
133 DCHECK(section == SECTION_CC_BILLING || section == SECTION_SHIPPING); | 129 DCHECK(section == SECTION_CC_BILLING || section == SECTION_SHIPPING); |
134 DetailInputs inputs; | 130 DetailInputs inputs; |
135 if (section == SECTION_CC_BILLING) | 131 if (section == SECTION_CC_BILLING) |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 form_structure_); | 338 form_structure_); |
343 | 339 |
344 bool request_shipping_address = false; | 340 bool request_shipping_address = false; |
345 { | 341 { |
346 DetailInputs inputs; | 342 DetailInputs inputs; |
347 BuildShippingInputs(&inputs); | 343 BuildShippingInputs(&inputs); |
348 request_shipping_address = form_structure_.FillFields( | 344 request_shipping_address = form_structure_.FillFields( |
349 common::TypesFromInputs(inputs), | 345 common::TypesFromInputs(inputs), |
350 base::Bind(common::ServerTypeMatchesField, SECTION_SHIPPING), | 346 base::Bind(common::ServerTypeMatchesField, SECTION_SHIPPING), |
351 base::Bind(NullGetInfo), | 347 base::Bind(NullGetInfo), |
352 std::string(), | |
353 g_browser_process->GetApplicationLocale()); | 348 g_browser_process->GetApplicationLocale()); |
354 } | 349 } |
355 | 350 |
356 bool last_used_choice_is_autofill = false; | 351 bool last_used_choice_is_autofill = false; |
357 base::string16 last_used_account_name; | 352 base::string16 last_used_account_name; |
358 std::string last_used_billing; | 353 std::string last_used_billing; |
359 std::string last_used_shipping; | 354 std::string last_used_shipping; |
360 std::string last_used_credit_card; | 355 std::string last_used_credit_card; |
361 { | 356 { |
362 const base::DictionaryValue* defaults = | 357 const base::DictionaryValue* defaults = |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 | 526 |
532 void AutofillDialogControllerAndroid::LogOnCancelMetrics() { | 527 void AutofillDialogControllerAndroid::LogOnCancelMetrics() { |
533 GetMetricLogger().LogDialogUiDuration( | 528 GetMetricLogger().LogDialogUiDuration( |
534 base::Time::Now() - dialog_shown_timestamp_, | 529 base::Time::Now() - dialog_shown_timestamp_, |
535 AutofillMetrics::DIALOG_CANCELED); | 530 AutofillMetrics::DIALOG_CANCELED); |
536 | 531 |
537 GetMetricLogger().LogDialogUiEvent(AutofillMetrics::DIALOG_UI_CANCELED); | 532 GetMetricLogger().LogDialogUiEvent(AutofillMetrics::DIALOG_UI_CANCELED); |
538 } | 533 } |
539 | 534 |
540 } // namespace autofill | 535 } // namespace autofill |
OLD | NEW |