| 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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 invoked_from_same_origin_)) { | 247 invoked_from_same_origin_)) { |
| 248 callback_.Run( | 248 callback_.Run( |
| 249 AutofillClient::AutocompleteResultErrorDisabled, | 249 AutofillClient::AutocompleteResultErrorDisabled, |
| 250 base::ASCIIToUTF16("Cross-origin form invocations are not supported."), | 250 base::ASCIIToUTF16("Cross-origin form invocations are not supported."), |
| 251 NULL); | 251 NULL); |
| 252 delete this; | 252 delete this; |
| 253 return; | 253 return; |
| 254 } | 254 } |
| 255 | 255 |
| 256 // Determine what field types should be included in the dialog. | 256 // Determine what field types should be included in the dialog. |
| 257 bool has_types = false; | 257 form_structure_.ParseFieldTypesFromAutocompleteAttributes(); |
| 258 bool has_sections = false; | |
| 259 form_structure_.ParseFieldTypesFromAutocompleteAttributes( | |
| 260 &has_types, &has_sections); | |
| 261 | 258 |
| 262 // Fail if the author didn't specify autocomplete types, or | 259 // Fail if the author didn't specify autocomplete types, or |
| 263 // if the dialog shouldn't be shown in a given circumstances. | 260 // if the dialog shouldn't be shown in a given circumstances. |
| 264 if (!has_types) { | 261 if (!form_structure_.has_author_specified_types()) { |
| 265 callback_.Run( | 262 callback_.Run( |
| 266 AutofillClient::AutocompleteResultErrorDisabled, | 263 AutofillClient::AutocompleteResultErrorDisabled, |
| 267 base::ASCIIToUTF16("Form is missing autocomplete attributes."), | 264 base::ASCIIToUTF16("Form is missing autocomplete attributes."), |
| 268 NULL); | 265 NULL); |
| 269 delete this; | 266 delete this; |
| 270 return; | 267 return; |
| 271 } | 268 } |
| 272 | 269 |
| 273 // Fail if the author didn't ask for at least some kind of credit card | 270 // Fail if the author didn't ask for at least some kind of credit card |
| 274 // information. | 271 // information. |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 | 525 |
| 529 void AutofillDialogControllerAndroid::LogOnCancelMetrics() { | 526 void AutofillDialogControllerAndroid::LogOnCancelMetrics() { |
| 530 AutofillMetrics::LogDialogUiDuration( | 527 AutofillMetrics::LogDialogUiDuration( |
| 531 base::Time::Now() - dialog_shown_timestamp_, | 528 base::Time::Now() - dialog_shown_timestamp_, |
| 532 AutofillMetrics::DIALOG_CANCELED); | 529 AutofillMetrics::DIALOG_CANCELED); |
| 533 | 530 |
| 534 AutofillMetrics::LogDialogUiEvent(AutofillMetrics::DIALOG_UI_CANCELED); | 531 AutofillMetrics::LogDialogUiEvent(AutofillMetrics::DIALOG_UI_CANCELED); |
| 535 } | 532 } |
| 536 | 533 |
| 537 } // namespace autofill | 534 } // namespace autofill |
| OLD | NEW |