| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chrome_http_auth_handler.h" | 5 #include "chrome/browser/ui/android/chrome_http_auth_handler.h" |
| 6 | 6 |
| 7 #include <jni.h> | 7 #include <jni.h> |
| 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" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 DCHECK(java_chrome_http_auth_handler_.is_null()); | 32 DCHECK(java_chrome_http_auth_handler_.is_null()); |
| 33 JNIEnv* env = AttachCurrentThread(); | 33 JNIEnv* env = AttachCurrentThread(); |
| 34 java_chrome_http_auth_handler_.Reset( | 34 java_chrome_http_auth_handler_.Reset( |
| 35 Java_ChromeHttpAuthHandler_create(env, reinterpret_cast<intptr_t>(this))); | 35 Java_ChromeHttpAuthHandler_create(env, reinterpret_cast<intptr_t>(this))); |
| 36 } | 36 } |
| 37 | 37 |
| 38 void ChromeHttpAuthHandler::SetObserver(LoginHandler* observer) { | 38 void ChromeHttpAuthHandler::SetObserver(LoginHandler* observer) { |
| 39 observer_ = observer; | 39 observer_ = observer; |
| 40 } | 40 } |
| 41 | 41 |
| 42 jobject ChromeHttpAuthHandler::GetJavaObject() { | 42 void ChromeHttpAuthHandler::ShowDialog(jobject window_android) { |
| 43 return java_chrome_http_auth_handler_.obj(); | 43 JNIEnv* env = AttachCurrentThread(); |
| 44 Java_ChromeHttpAuthHandler_showDialog( |
| 45 env, |
| 46 java_chrome_http_auth_handler_.obj(), |
| 47 window_android); |
| 44 } | 48 } |
| 45 | 49 |
| 46 void ChromeHttpAuthHandler::OnAutofillDataAvailable( | 50 void ChromeHttpAuthHandler::OnAutofillDataAvailable( |
| 47 const base::string16& username, | 51 const base::string16& username, |
| 48 const base::string16& password) { | 52 const base::string16& password) { |
| 49 DCHECK(java_chrome_http_auth_handler_.obj() != NULL); | 53 DCHECK(java_chrome_http_auth_handler_.obj() != NULL); |
| 50 JNIEnv* env = base::android::AttachCurrentThread(); | 54 JNIEnv* env = base::android::AttachCurrentThread(); |
| 51 ScopedJavaLocalRef<jstring> j_username = | 55 ScopedJavaLocalRef<jstring> j_username = |
| 52 ConvertUTF16ToJavaString(env, username); | 56 ConvertUTF16ToJavaString(env, username); |
| 53 ScopedJavaLocalRef<jstring> j_password = | 57 ScopedJavaLocalRef<jstring> j_password = |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 108 |
| 105 ScopedJavaLocalRef<jstring> ChromeHttpAuthHandler::GetCancelButtonText( | 109 ScopedJavaLocalRef<jstring> ChromeHttpAuthHandler::GetCancelButtonText( |
| 106 JNIEnv* env, jobject) { | 110 JNIEnv* env, jobject) { |
| 107 return ConvertUTF16ToJavaString(env, l10n_util::GetStringUTF16(IDS_CANCEL)); | 111 return ConvertUTF16ToJavaString(env, l10n_util::GetStringUTF16(IDS_CANCEL)); |
| 108 } | 112 } |
| 109 | 113 |
| 110 // static | 114 // static |
| 111 bool ChromeHttpAuthHandler::RegisterChromeHttpAuthHandler(JNIEnv* env) { | 115 bool ChromeHttpAuthHandler::RegisterChromeHttpAuthHandler(JNIEnv* env) { |
| 112 return RegisterNativesImpl(env); | 116 return RegisterNativesImpl(env); |
| 113 } | 117 } |
| OLD | NEW |