Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: chrome/browser/password_manager/account_chooser_dialog_android.cc

Issue 1973293002: [Smart Lock] Adds UMA Metrics for actions on Account Chooser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 void AccountChooserDialogAndroid::WasHidden() { 201 void AccountChooserDialogAndroid::WasHidden() {
201 // TODO(https://crbug.com/610700): once bug is fixed, this code should be 202 // TODO(https://crbug.com/610700): once bug is fixed, this code should be
202 // gone. 203 // gone.
203 OnDialogCancel(); 204 OnDialogCancel();
204 JNIEnv* env = AttachCurrentThread(); 205 JNIEnv* env = AttachCurrentThread();
205 Java_AccountChooserDialog_dismissDialog(env, dialog_jobject_.obj()); 206 Java_AccountChooserDialog_dismissDialog(env, dialog_jobject_.obj());
206 } 207 }
207 208
208 void AccountChooserDialogAndroid::OnDialogCancel() { 209 void AccountChooserDialogAndroid::OnDialogCancel() {
209 ChooseCredential(-1, password_manager::CredentialType::CREDENTIAL_TYPE_EMPTY); 210 ChooseCredential(-1, password_manager::CredentialType::CREDENTIAL_TYPE_EMPTY);
210 } 211 }
vasilii 2016/05/17 09:45:15 no space
211 212
212 const std::vector<const autofill::PasswordForm*>& 213 const std::vector<const autofill::PasswordForm*>&
213 AccountChooserDialogAndroid::local_credentials_forms() const { 214 AccountChooserDialogAndroid::local_credentials_forms() const {
214 return passwords_data_.GetCurrentForms(); 215 return passwords_data_.GetCurrentForms();
215 } 216 }
216 217
217 const std::vector<const autofill::PasswordForm*>& 218 const std::vector<const autofill::PasswordForm*>&
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(
vasilii 2016/05/17 09:45:15 indent properly
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 DCHECK_EQ(CredentialType::CREDENTIAL_TYPE_PASSWORD, type); 236 DCHECK_EQ(CredentialType::CREDENTIAL_TYPE_PASSWORD, type);
231 const auto& credentials_forms = 237 const auto& credentials_forms =
232 (type == CredentialType::CREDENTIAL_TYPE_PASSWORD) 238 (type == CredentialType::CREDENTIAL_TYPE_PASSWORD)
233 ? local_credentials_forms() 239 ? local_credentials_forms()
234 : federated_credentials_forms(); 240 : federated_credentials_forms();
235 if (index < credentials_forms.size()) { 241 if (index < credentials_forms.size()) {
236 passwords_data_.ChooseCredential(credentials_forms[index]); 242 passwords_data_.ChooseCredential(credentials_forms[index]);
237 } 243 }
238 } 244 }
239 245
240 bool RegisterAccountChooserDialogAndroid(JNIEnv* env) { 246 bool RegisterAccountChooserDialogAndroid(JNIEnv* env) {
241 return RegisterNativesImpl(env); 247 return RegisterNativesImpl(env);
242 } 248 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698