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& active_url = contents_->GetLastCommittedURL(); |
Charlie Reis
2013/11/12 01:09:29
nit: active_url -> current_url
jww
2013/11/12 22:32:50
Done.
| |
196 const GURL& active_url = entry ? entry->GetURL() : contents_->GetURL(); | |
197 invoked_from_same_origin_ = active_url.GetOrigin() == source_url_.GetOrigin(); | 196 invoked_from_same_origin_ = active_url.GetOrigin() == source_url_.GetOrigin(); |
198 | 197 |
199 // Determine what field types should be included in the dialog. | 198 // Determine what field types should be included in the dialog. |
200 bool has_types = false; | 199 bool has_types = false; |
201 bool has_sections = false; | 200 bool has_sections = false; |
202 form_structure_.ParseFieldTypesFromAutocompleteAttributes( | 201 form_structure_.ParseFieldTypesFromAutocompleteAttributes( |
203 &has_types, &has_sections); | 202 &has_types, &has_sections); |
204 | 203 |
205 // Fail if the author didn't specify autocomplete types, or | 204 // Fail if the author didn't specify autocomplete types, or |
206 // if the dialog shouldn't be shown in a given circumstances. | 205 // if the dialog shouldn't be shown in a given circumstances. |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
439 | 438 |
440 void AutofillDialogControllerAndroid::LogOnCancelMetrics() { | 439 void AutofillDialogControllerAndroid::LogOnCancelMetrics() { |
441 GetMetricLogger().LogDialogUiDuration( | 440 GetMetricLogger().LogDialogUiDuration( |
442 base::Time::Now() - dialog_shown_timestamp_, | 441 base::Time::Now() - dialog_shown_timestamp_, |
443 AutofillMetrics::DIALOG_CANCELED); | 442 AutofillMetrics::DIALOG_CANCELED); |
444 | 443 |
445 GetMetricLogger().LogDialogUiEvent(AutofillMetrics::DIALOG_UI_CANCELED); | 444 GetMetricLogger().LogDialogUiEvent(AutofillMetrics::DIALOG_UI_CANCELED); |
446 } | 445 } |
447 | 446 |
448 } // namespace autofill | 447 } // namespace autofill |
OLD | NEW |