| 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/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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 DCHECK(delegate.obj()); | 48 DCHECK(delegate.obj()); |
| 49 user_ = base::android::ConvertJavaStringToUTF8( | 49 user_ = base::android::ConvertJavaStringToUTF8( |
| 50 Java_AutoLoginDelegate_initializeAccount( | 50 Java_AutoLoginDelegate_initializeAccount( |
| 51 env, delegate.obj(), reinterpret_cast<intptr_t>(this), jrealm.obj(), | 51 env, delegate.obj(), reinterpret_cast<intptr_t>(this), jrealm.obj(), |
| 52 jaccount.obj(), jargs.obj())); | 52 jaccount.obj(), jargs.obj())); |
| 53 return !user_.empty(); | 53 return !user_.empty(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 base::string16 AutoLoginInfoBarDelegateAndroid::GetMessageText() const { | 56 base::string16 AutoLoginInfoBarDelegateAndroid::GetMessageText() const { |
| 57 return l10n_util::GetStringFUTF16(IDS_AUTOLOGIN_INFOBAR_MESSAGE, | 57 return l10n_util::GetStringFUTF16(IDS_AUTOLOGIN_INFOBAR_MESSAGE, |
| 58 UTF8ToUTF16(user_)); | 58 base::UTF8ToUTF16(user_)); |
| 59 } | 59 } |
| 60 | 60 |
| 61 bool AutoLoginInfoBarDelegateAndroid::Accept() { | 61 bool AutoLoginInfoBarDelegateAndroid::Accept() { |
| 62 JNIEnv* env = base::android::AttachCurrentThread(); | 62 JNIEnv* env = base::android::AttachCurrentThread(); |
| 63 ScopedJavaLocalRef<jobject> delegate = | 63 ScopedJavaLocalRef<jobject> delegate = |
| 64 weak_java_auto_login_delegate_.get(env); | 64 weak_java_auto_login_delegate_.get(env); |
| 65 DCHECK(delegate.obj()); | 65 DCHECK(delegate.obj()); |
| 66 Java_AutoLoginDelegate_logIn(env, delegate.obj(), | 66 Java_AutoLoginDelegate_logIn(env, delegate.obj(), |
| 67 reinterpret_cast<intptr_t>(this)); | 67 reinterpret_cast<intptr_t>(this)); |
| 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 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 infobar()->RemoveSelf(); | 111 infobar()->RemoveSelf(); |
| 112 } | 112 } |
| 113 | 113 |
| 114 void AutoLoginInfoBarDelegateAndroid::LoginDismiss(JNIEnv* env, jobject obj) { | 114 void AutoLoginInfoBarDelegateAndroid::LoginDismiss(JNIEnv* env, jobject obj) { |
| 115 infobar()->RemoveSelf(); | 115 infobar()->RemoveSelf(); |
| 116 } | 116 } |
| 117 | 117 |
| 118 bool AutoLoginInfoBarDelegateAndroid::Register(JNIEnv* env) { | 118 bool AutoLoginInfoBarDelegateAndroid::Register(JNIEnv* env) { |
| 119 return RegisterNativesImpl(env); | 119 return RegisterNativesImpl(env); |
| 120 } | 120 } |
| OLD | NEW |