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

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

Issue 67573003: Android: moves chrome/ to use long for JNI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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
OLDNEW
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/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 28 matching lines...) Expand all
39 ScopedJavaLocalRef<jstring> jargs = ConvertUTF8ToJavaString(env, args()); 39 ScopedJavaLocalRef<jstring> jargs = ConvertUTF8ToJavaString(env, args());
40 DCHECK(!jrealm.is_null()); 40 DCHECK(!jrealm.is_null());
41 DCHECK(!jaccount.is_null()); 41 DCHECK(!jaccount.is_null());
42 DCHECK(!jargs.is_null()); 42 DCHECK(!jargs.is_null());
43 43
44 ScopedJavaLocalRef<jobject> delegate = 44 ScopedJavaLocalRef<jobject> delegate =
45 weak_java_auto_login_delegate_.get(env); 45 weak_java_auto_login_delegate_.get(env);
46 DCHECK(delegate.obj()); 46 DCHECK(delegate.obj());
47 user_ = base::android::ConvertJavaStringToUTF8( 47 user_ = base::android::ConvertJavaStringToUTF8(
48 Java_AutoLoginDelegate_initializeAccount( 48 Java_AutoLoginDelegate_initializeAccount(
49 env, delegate.obj(), reinterpret_cast<jint>(this), jrealm.obj(), 49 env, delegate.obj(), reinterpret_cast<intptr_t>(this), jrealm.obj(),
50 jaccount.obj(), jargs.obj())); 50 jaccount.obj(), jargs.obj()));
51 return !user_.empty(); 51 return !user_.empty();
52 } 52 }
53 53
54 string16 AutoLoginInfoBarDelegateAndroid::GetMessageText() const { 54 string16 AutoLoginInfoBarDelegateAndroid::GetMessageText() const {
55 return l10n_util::GetStringFUTF16(IDS_AUTOLOGIN_INFOBAR_MESSAGE, 55 return l10n_util::GetStringFUTF16(IDS_AUTOLOGIN_INFOBAR_MESSAGE,
56 UTF8ToUTF16(user_)); 56 UTF8ToUTF16(user_));
57 } 57 }
58 58
59 bool AutoLoginInfoBarDelegateAndroid::Accept() { 59 bool AutoLoginInfoBarDelegateAndroid::Accept() {
60 JNIEnv* env = base::android::AttachCurrentThread(); 60 JNIEnv* env = base::android::AttachCurrentThread();
61 ScopedJavaLocalRef<jobject> delegate = 61 ScopedJavaLocalRef<jobject> delegate =
62 weak_java_auto_login_delegate_.get(env); 62 weak_java_auto_login_delegate_.get(env);
63 DCHECK(delegate.obj()); 63 DCHECK(delegate.obj());
64 64
65 Java_AutoLoginDelegate_logIn(env, delegate.obj(), 65 Java_AutoLoginDelegate_logIn(env, delegate.obj(),
66 reinterpret_cast<jint>(this)); 66 reinterpret_cast<intptr_t>(this));
67 67
68 // Do not close the infobar on accept, it will be closed as part 68 // Do not close the infobar on accept, it will be closed as part
69 // of the log in callback. 69 // of the log in callback.
70 return false; 70 return false;
71 } 71 }
72 72
73 bool AutoLoginInfoBarDelegateAndroid::Cancel() { 73 bool AutoLoginInfoBarDelegateAndroid::Cancel() {
74 JNIEnv* env = base::android::AttachCurrentThread(); 74 JNIEnv* env = base::android::AttachCurrentThread();
75 ScopedJavaLocalRef<jobject> delegate = 75 ScopedJavaLocalRef<jobject> delegate =
76 weak_java_auto_login_delegate_.get(env); 76 weak_java_auto_login_delegate_.get(env);
77 DCHECK(delegate.obj()); 77 DCHECK(delegate.obj());
78 Java_AutoLoginDelegate_cancelLogIn(env, delegate.obj(), 78 Java_AutoLoginDelegate_cancelLogIn(env, delegate.obj(),
79 reinterpret_cast<jint>(this)); 79 reinterpret_cast<intptr_t>(this));
80 return true; 80 return true;
81 } 81 }
82 82
83 void AutoLoginInfoBarDelegateAndroid::LoginSuccess(JNIEnv* env, 83 void AutoLoginInfoBarDelegateAndroid::LoginSuccess(JNIEnv* env,
84 jobject obj, 84 jobject obj,
85 jstring result) { 85 jstring result) {
86 if (owner()) { 86 if (owner()) {
87 content::WebContents* web_contents = owner()->web_contents(); 87 content::WebContents* web_contents = owner()->web_contents();
88 if (web_contents) { 88 if (web_contents) {
89 web_contents->Stop(); 89 web_contents->Stop();
(...skipping 19 matching lines...) Expand all
109 } 109 }
110 110
111 void AutoLoginInfoBarDelegateAndroid::LoginDismiss(JNIEnv* env, jobject obj) { 111 void AutoLoginInfoBarDelegateAndroid::LoginDismiss(JNIEnv* env, jobject obj) {
112 if (owner()) 112 if (owner())
113 owner()->RemoveInfoBar(this); 113 owner()->RemoveInfoBar(this);
114 } 114 }
115 115
116 bool AutoLoginInfoBarDelegateAndroid::Register(JNIEnv* env) { 116 bool AutoLoginInfoBarDelegateAndroid::Register(JNIEnv* env) {
117 return RegisterNativesImpl(env); 117 return RegisterNativesImpl(env);
118 } 118 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/android/chrome_http_auth_handler.cc ('k') | chrome/browser/ui/android/infobars/confirm_infobar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698