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