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" |
11 #include "base/android/scoped_java_ref.h" | 11 #include "base/android/scoped_java_ref.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
15 #include "chrome/grit/generated_resources.h" | 15 #include "chrome/grit/generated_resources.h" |
16 #include "jni/ChromeHttpAuthHandler_jni.h" | 16 #include "jni/ChromeHttpAuthHandler_jni.h" |
17 #include "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" |
18 | 18 |
19 using base::android::AttachCurrentThread; | 19 using base::android::AttachCurrentThread; |
20 using base::android::CheckException; | 20 using base::android::CheckException; |
21 using base::android::ConvertJavaStringToUTF16; | 21 using base::android::ConvertJavaStringToUTF16; |
22 using base::android::ConvertUTF16ToJavaString; | 22 using base::android::ConvertUTF16ToJavaString; |
| 23 using base::android::JavaParamRef; |
23 using base::android::ScopedJavaLocalRef; | 24 using base::android::ScopedJavaLocalRef; |
24 | 25 |
25 ChromeHttpAuthHandler::ChromeHttpAuthHandler(const base::string16& authority, | 26 ChromeHttpAuthHandler::ChromeHttpAuthHandler(const base::string16& authority, |
26 const base::string16& explanation) | 27 const base::string16& explanation) |
27 : observer_(nullptr), authority_(authority), explanation_(explanation) {} | 28 : observer_(nullptr), authority_(authority), explanation_(explanation) {} |
28 | 29 |
29 ChromeHttpAuthHandler::~ChromeHttpAuthHandler() {} | 30 ChromeHttpAuthHandler::~ChromeHttpAuthHandler() {} |
30 | 31 |
31 void ChromeHttpAuthHandler::Init() { | 32 void ChromeHttpAuthHandler::Init() { |
32 DCHECK(java_chrome_http_auth_handler_.is_null()); | 33 DCHECK(java_chrome_http_auth_handler_.is_null()); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 if (explanation_.empty()) | 85 if (explanation_.empty()) |
85 return ConvertUTF16ToJavaString(env, authority_); | 86 return ConvertUTF16ToJavaString(env, authority_); |
86 return ConvertUTF16ToJavaString( | 87 return ConvertUTF16ToJavaString( |
87 env, authority_ + base::ASCIIToUTF16(" ") + explanation_); | 88 env, authority_ + base::ASCIIToUTF16(" ") + explanation_); |
88 } | 89 } |
89 | 90 |
90 // static | 91 // static |
91 bool ChromeHttpAuthHandler::RegisterChromeHttpAuthHandler(JNIEnv* env) { | 92 bool ChromeHttpAuthHandler::RegisterChromeHttpAuthHandler(JNIEnv* env) { |
92 return RegisterNativesImpl(env); | 93 return RegisterNativesImpl(env); |
93 } | 94 } |
OLD | NEW |