| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/password_manager/account_chooser_dialog_android.h" | 5 #include "chrome/browser/password_manager/account_chooser_dialog_android.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
| 10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
| 11 #include "base/android/scoped_java_ref.h" | 11 #include "base/android/scoped_java_ref.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "chrome/browser/password_manager/chrome_password_manager_client.h" | 13 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
| 14 #include "chrome/browser/password_manager/credential_android.h" | 14 #include "chrome/browser/password_manager/credential_android.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/sync/profile_sync_service_factory.h" | 16 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 17 #include "chrome/browser/ui/passwords/account_avatar_fetcher.h" | 17 #include "chrome/browser/ui/passwords/account_avatar_fetcher.h" |
| 18 #include "chrome/browser/ui/passwords/manage_passwords_view_utils.h" | 18 #include "chrome/browser/ui/passwords/manage_passwords_view_utils.h" |
| 19 #include "chrome/grit/generated_resources.h" | 19 #include "chrome/grit/generated_resources.h" |
| 20 #include "components/browser_sync/browser/profile_sync_service.h" | 20 #include "components/browser_sync/browser/profile_sync_service.h" |
| 21 #include "components/password_manager/core/browser/password_bubble_experiment.h" | 21 #include "components/password_manager/core/browser/password_bubble_experiment.h" |
| 22 #include "components/password_manager/core/browser/password_manager_constants.h" | 22 #include "components/password_manager/core/browser/password_manager_constants.h" |
| 23 #include "components/password_manager/core/browser/password_manager_metrics_util
.h" |
| 23 #include "components/password_manager/core/browser/password_ui_utils.h" | 24 #include "components/password_manager/core/browser/password_ui_utils.h" |
| 24 #include "components/password_manager/core/common/credential_manager_types.h" | 25 #include "components/password_manager/core/common/credential_manager_types.h" |
| 25 #include "jni/AccountChooserDialog_jni.h" | 26 #include "jni/AccountChooserDialog_jni.h" |
| 26 #include "ui/android/window_android.h" | 27 #include "ui/android/window_android.h" |
| 27 #include "ui/gfx/android/java_bitmap.h" | 28 #include "ui/gfx/android/java_bitmap.h" |
| 28 #include "ui/gfx/range/range.h" | 29 #include "ui/gfx/range/range.h" |
| 29 | 30 |
| 30 using base::android::AttachCurrentThread; | 31 using base::android::AttachCurrentThread; |
| 31 using base::android::ConvertUTF16ToJavaString; | 32 using base::android::ConvertUTF16ToJavaString; |
| 32 | 33 |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 AccountChooserDialogAndroid::federated_credentials_forms() const { | 219 AccountChooserDialogAndroid::federated_credentials_forms() const { |
| 219 return passwords_data_.federated_credentials_forms(); | 220 return passwords_data_.federated_credentials_forms(); |
| 220 } | 221 } |
| 221 | 222 |
| 222 void AccountChooserDialogAndroid::ChooseCredential( | 223 void AccountChooserDialogAndroid::ChooseCredential( |
| 223 size_t index, | 224 size_t index, |
| 224 password_manager::CredentialType type) { | 225 password_manager::CredentialType type) { |
| 225 using namespace password_manager; | 226 using namespace password_manager; |
| 226 if (type == CredentialType::CREDENTIAL_TYPE_EMPTY) { | 227 if (type == CredentialType::CREDENTIAL_TYPE_EMPTY) { |
| 227 passwords_data_.ChooseCredential(nullptr); | 228 passwords_data_.ChooseCredential(nullptr); |
| 229 password_manager::metrics_util::LogAccountChooserUserAction( |
| 230 password_manager::metrics_util::ACCOUNT_CHOOSER_DISMISSED); |
| 231 |
| 228 return; | 232 return; |
| 229 } | 233 } |
| 234 password_manager::metrics_util::LogAccountChooserUserAction( |
| 235 password_manager::metrics_util::ACCOUNT_CHOOSER_CREDENTIAL_CHOSEN); |
| 230 const auto& credentials_forms = | 236 const auto& credentials_forms = |
| 231 (type == CredentialType::CREDENTIAL_TYPE_PASSWORD) | 237 (type == CredentialType::CREDENTIAL_TYPE_PASSWORD) |
| 232 ? local_credentials_forms() | 238 ? local_credentials_forms() |
| 233 : federated_credentials_forms(); | 239 : federated_credentials_forms(); |
| 234 if (index < credentials_forms.size()) { | 240 if (index < credentials_forms.size()) { |
| 235 passwords_data_.ChooseCredential(credentials_forms[index]); | 241 passwords_data_.ChooseCredential(credentials_forms[index]); |
| 236 } | 242 } |
| 237 } | 243 } |
| 238 | 244 |
| 239 bool RegisterAccountChooserDialogAndroid(JNIEnv* env) { | 245 bool RegisterAccountChooserDialogAndroid(JNIEnv* env) { |
| 240 return RegisterNativesImpl(env); | 246 return RegisterNativesImpl(env); |
| 241 } | 247 } |
| OLD | NEW |