| 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 return; | 188 return; |
| 189 | 189 |
| 190 JNIEnv* env = base::android::AttachCurrentThread(); | 190 JNIEnv* env = base::android::AttachCurrentThread(); |
| 191 Java_AutofillDialogControllerAndroid_onDestroy(env, java_object_.obj()); | 191 Java_AutofillDialogControllerAndroid_onDestroy(env, java_object_.obj()); |
| 192 } | 192 } |
| 193 | 193 |
| 194 void AutofillDialogControllerAndroid::Show() { | 194 void AutofillDialogControllerAndroid::Show() { |
| 195 JNIEnv* env = base::android::AttachCurrentThread(); | 195 JNIEnv* env = base::android::AttachCurrentThread(); |
| 196 dialog_shown_timestamp_ = base::Time::Now(); | 196 dialog_shown_timestamp_ = base::Time::Now(); |
| 197 | 197 |
| 198 content::NavigationEntry* entry = contents_->GetController().GetActiveEntry(); | 198 const GURL& active_url = contents_->GetLastCommittedURL(); |
| 199 const GURL& active_url = entry ? entry->GetURL() : contents_->GetURL(); | |
| 200 invoked_from_same_origin_ = active_url.GetOrigin() == source_url_.GetOrigin(); | 199 invoked_from_same_origin_ = active_url.GetOrigin() == source_url_.GetOrigin(); |
| 201 | 200 |
| 202 // Determine what field types should be included in the dialog. | 201 // Determine what field types should be included in the dialog. |
| 203 bool has_types = false; | 202 bool has_types = false; |
| 204 bool has_sections = false; | 203 bool has_sections = false; |
| 205 form_structure_.ParseFieldTypesFromAutocompleteAttributes( | 204 form_structure_.ParseFieldTypesFromAutocompleteAttributes( |
| 206 &has_types, &has_sections); | 205 &has_types, &has_sections); |
| 207 | 206 |
| 208 // Fail if the author didn't specify autocomplete types, or | 207 // Fail if the author didn't specify autocomplete types, or |
| 209 // if the dialog shouldn't be shown in a given circumstances. | 208 // if the dialog shouldn't be shown in a given circumstances. |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 | 441 |
| 443 void AutofillDialogControllerAndroid::LogOnCancelMetrics() { | 442 void AutofillDialogControllerAndroid::LogOnCancelMetrics() { |
| 444 GetMetricLogger().LogDialogUiDuration( | 443 GetMetricLogger().LogDialogUiDuration( |
| 445 base::Time::Now() - dialog_shown_timestamp_, | 444 base::Time::Now() - dialog_shown_timestamp_, |
| 446 AutofillMetrics::DIALOG_CANCELED); | 445 AutofillMetrics::DIALOG_CANCELED); |
| 447 | 446 |
| 448 GetMetricLogger().LogDialogUiEvent(AutofillMetrics::DIALOG_UI_CANCELED); | 447 GetMetricLogger().LogDialogUiEvent(AutofillMetrics::DIALOG_UI_CANCELED); |
| 449 } | 448 } |
| 450 | 449 |
| 451 } // namespace autofill | 450 } // namespace autofill |
| OLD | NEW |