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

Side by Side Diff: chrome/browser/ui/android/infobars/auto_login_infobar_delegate_android.cc

Issue 258093003: Fix Android not tracking all AutoLogin metrics. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix styling nit Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/auto_login_infobar_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/infobars/auto_login_infobar_delegate_android .h" 5 #include "chrome/browser/ui/android/infobars/auto_login_infobar_delegate_android .h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_helper.h" 8 #include "base/android/jni_helper.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 bool AutoLoginInfoBarDelegateAndroid::Accept() { 62 bool AutoLoginInfoBarDelegateAndroid::Accept() {
63 JNIEnv* env = base::android::AttachCurrentThread(); 63 JNIEnv* env = base::android::AttachCurrentThread();
64 ScopedJavaLocalRef<jobject> delegate = 64 ScopedJavaLocalRef<jobject> delegate =
65 weak_java_auto_login_delegate_.get(env); 65 weak_java_auto_login_delegate_.get(env);
66 DCHECK(delegate.obj()); 66 DCHECK(delegate.obj());
67 Java_AutoLoginDelegate_logIn(env, delegate.obj(), 67 Java_AutoLoginDelegate_logIn(env, delegate.obj(),
68 reinterpret_cast<intptr_t>(this)); 68 reinterpret_cast<intptr_t>(this));
69 // Do not close the infobar on accept, it will be closed as part 69 // Do not close the infobar on accept, it will be closed as part
70 // of the log in callback. 70 // of the log in callback.
71 RecordHistogramAction(ACCEPTED);
71 return false; 72 return false;
72 } 73 }
73 74
74 bool AutoLoginInfoBarDelegateAndroid::Cancel() { 75 bool AutoLoginInfoBarDelegateAndroid::Cancel() {
75 JNIEnv* env = base::android::AttachCurrentThread(); 76 JNIEnv* env = base::android::AttachCurrentThread();
76 ScopedJavaLocalRef<jobject> delegate = 77 ScopedJavaLocalRef<jobject> delegate =
77 weak_java_auto_login_delegate_.get(env); 78 weak_java_auto_login_delegate_.get(env);
78 DCHECK(delegate.obj()); 79 DCHECK(delegate.obj());
79 Java_AutoLoginDelegate_cancelLogIn(env, delegate.obj(), 80 Java_AutoLoginDelegate_cancelLogIn(env, delegate.obj(),
80 reinterpret_cast<intptr_t>(this)); 81 reinterpret_cast<intptr_t>(this));
82 RecordHistogramAction(REJECTED);
81 return true; 83 return true;
82 } 84 }
83 85
84 void AutoLoginInfoBarDelegateAndroid::LoginSuccess(JNIEnv* env, 86 void AutoLoginInfoBarDelegateAndroid::LoginSuccess(JNIEnv* env,
85 jobject obj, 87 jobject obj,
86 jstring result) { 88 jstring result) {
87 if (!infobar()->owner()) 89 if (!infobar()->owner())
88 return; // We're closing; don't call anything, it might access the owner. 90 return; // We're closing; don't call anything, it might access the owner.
89 91
90 // TODO(miguelg): Test whether the Stop() and RemoveInfoBar() calls here are 92 // TODO(miguelg): Test whether the Stop() and RemoveInfoBar() calls here are
(...skipping 25 matching lines...) Expand all
116 infobar()->RemoveSelf(); 118 infobar()->RemoveSelf();
117 } 119 }
118 120
119 void AutoLoginInfoBarDelegateAndroid::LoginDismiss(JNIEnv* env, jobject obj) { 121 void AutoLoginInfoBarDelegateAndroid::LoginDismiss(JNIEnv* env, jobject obj) {
120 infobar()->RemoveSelf(); 122 infobar()->RemoveSelf();
121 } 123 }
122 124
123 bool AutoLoginInfoBarDelegateAndroid::Register(JNIEnv* env) { 125 bool AutoLoginInfoBarDelegateAndroid::Register(JNIEnv* env) {
124 return RegisterNativesImpl(env); 126 return RegisterNativesImpl(env);
125 } 127 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/auto_login_infobar_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698