Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "android_webview/native/aw_contents_statics.h" | 5 #include "android_webview/native/aw_contents_statics.h" |
| 6 | 6 |
| 7 #include "android_webview/browser/aw_browser_context.h" | 7 #include "android_webview/browser/aw_browser_context.h" |
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 9 #include "base/android/scoped_java_ref.h" | 9 #include "base/android/scoped_java_ref.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings. h" | 11 #include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_requ est_handler.h" |
| 12 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
| 13 #include "content/public/common/url_constants.h" | 13 #include "content/public/common/url_constants.h" |
| 14 #include "jni/AwContentsStatics_jni.h" | 14 #include "jni/AwContentsStatics_jni.h" |
| 15 #include "net/cert/cert_database.h" | 15 #include "net/cert/cert_database.h" |
| 16 | 16 |
| 17 using base::android::AttachCurrentThread; | 17 using base::android::AttachCurrentThread; |
| 18 using base::android::ConvertJavaStringToUTF8; | 18 using base::android::ConvertJavaStringToUTF8; |
| 19 using base::android::ScopedJavaGlobalRef; | 19 using base::android::ScopedJavaGlobalRef; |
| 20 using content::BrowserThread; | 20 using content::BrowserThread; |
| 21 using data_reduction_proxy::DataReductionProxySettings; | 21 using data_reduction_proxy::DataReductionProxyAuthRequestHandler; |
| 22 | 22 |
| 23 namespace android_webview { | 23 namespace android_webview { |
| 24 | 24 |
| 25 namespace { | 25 namespace { |
| 26 | 26 |
| 27 void ClientCertificatesCleared(ScopedJavaGlobalRef<jobject>* callback) { | 27 void ClientCertificatesCleared(ScopedJavaGlobalRef<jobject>* callback) { |
| 28 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 28 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 29 JNIEnv* env = AttachCurrentThread(); | 29 JNIEnv* env = AttachCurrentThread(); |
| 30 Java_AwContentsStatics_clientCertificatesCleared(env, callback->obj()); | 30 Java_AwContentsStatics_clientCertificatesCleared(env, callback->obj()); |
| 31 } | 31 } |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 46 BrowserThread::IO, | 46 BrowserThread::IO, |
| 47 FROM_HERE, | 47 FROM_HERE, |
| 48 base::Bind(&NotifyClientCertificatesChanged), | 48 base::Bind(&NotifyClientCertificatesChanged), |
| 49 base::Bind(&ClientCertificatesCleared, base::Owned(j_callback))); | 49 base::Bind(&ClientCertificatesCleared, base::Owned(j_callback))); |
| 50 } | 50 } |
| 51 | 51 |
| 52 // static | 52 // static |
| 53 void SetDataReductionProxyKey(JNIEnv* env, jclass, jstring key) { | 53 void SetDataReductionProxyKey(JNIEnv* env, jclass, jstring key) { |
| 54 AwBrowserContext* browser_context = AwBrowserContext::GetDefault(); | 54 AwBrowserContext* browser_context = AwBrowserContext::GetDefault(); |
| 55 DCHECK(browser_context); | 55 DCHECK(browser_context); |
| 56 DataReductionProxySettings* drp_settings = | 56 DataReductionProxyAuthRequestHandler* drp_auth_request_handler = |
| 57 browser_context->GetDataReductionProxySettings(); | 57 browser_context->GetDataReductionProxyAuthRequestHandler(); |
| 58 if (drp_settings) | 58 if (drp_auth_request_handler) |
| 59 drp_settings->params()->set_key(ConvertJavaStringToUTF8(env, key)); | 59 drp_auth_request_handler->SetKey( |
| 60 ConvertJavaStringToUTF8(env, key), "webview", "0"); | |
|
sgurun-gerrit only
2014/06/24 16:43:33
are you keeping the keys as name/value pairs in so
bengr
2014/06/24 16:59:40
This name and proxy is transmitted to the proxy, s
bengr
2014/06/24 17:00:07
I mean this name and version...
On 2014/06/24 16:
| |
| 60 } | 61 } |
| 61 | 62 |
| 62 // static | 63 // static |
| 63 void SetDataReductionProxyEnabled(JNIEnv* env, jclass, jboolean enabled) { | 64 void SetDataReductionProxyEnabled(JNIEnv* env, jclass, jboolean enabled) { |
| 64 AwBrowserContext::SetDataReductionProxyEnabled(enabled); | 65 AwBrowserContext::SetDataReductionProxyEnabled(enabled); |
| 65 } | 66 } |
| 66 | 67 |
| 67 // static | 68 // static |
| 68 jstring GetUnreachableWebDataUrl(JNIEnv* env, jclass) { | 69 jstring GetUnreachableWebDataUrl(JNIEnv* env, jclass) { |
| 69 return base::android::ConvertUTF8ToJavaString( | 70 return base::android::ConvertUTF8ToJavaString( |
| 70 env, content::kUnreachableWebDataURL).Release(); | 71 env, content::kUnreachableWebDataURL).Release(); |
| 71 } | 72 } |
| 72 | 73 |
| 73 bool RegisterAwContentsStatics(JNIEnv* env) { | 74 bool RegisterAwContentsStatics(JNIEnv* env) { |
| 74 return RegisterNativesImpl(env); | 75 return RegisterNativesImpl(env); |
| 75 } | 76 } |
| 76 | 77 |
| 77 } // namespace android_webview | 78 } // namespace android_webview |
| OLD | NEW |