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 "base/android/scoped_java_ref.h" | 8 #include "base/android/scoped_java_ref.h" |
8 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings. h" | |
9 #include "content/public/browser/browser_thread.h" | 11 #include "content/public/browser/browser_thread.h" |
10 #include "jni/AwContentsStatics_jni.h" | 12 #include "jni/AwContentsStatics_jni.h" |
11 #include "net/cert/cert_database.h" | 13 #include "net/cert/cert_database.h" |
12 | 14 |
13 using base::android::AttachCurrentThread; | 15 using base::android::AttachCurrentThread; |
14 using base::android::ScopedJavaGlobalRef; | 16 using base::android::ScopedJavaGlobalRef; |
15 using content::BrowserThread; | 17 using content::BrowserThread; |
18 using data_reduction_proxy::DataReductionProxySettings; | |
16 | 19 |
17 namespace android_webview { | 20 namespace android_webview { |
18 | 21 |
19 namespace { | 22 namespace { |
20 | 23 |
21 void ClientCertificatesCleared(ScopedJavaGlobalRef<jobject>* callback) { | 24 void ClientCertificatesCleared(ScopedJavaGlobalRef<jobject>* callback) { |
22 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 25 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
23 JNIEnv* env = AttachCurrentThread(); | 26 JNIEnv* env = AttachCurrentThread(); |
24 Java_AwContentsStatics_clientCertificatesCleared(env, callback->obj()); | 27 Java_AwContentsStatics_clientCertificatesCleared(env, callback->obj()); |
25 } | 28 } |
(...skipping 10 matching lines...) Expand all Loading... | |
36 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 39 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
37 ScopedJavaGlobalRef<jobject>* j_callback = new ScopedJavaGlobalRef<jobject>(); | 40 ScopedJavaGlobalRef<jobject>* j_callback = new ScopedJavaGlobalRef<jobject>(); |
38 j_callback->Reset(env, callback); | 41 j_callback->Reset(env, callback); |
39 BrowserThread::PostTaskAndReply( | 42 BrowserThread::PostTaskAndReply( |
40 BrowserThread::IO, | 43 BrowserThread::IO, |
41 FROM_HERE, | 44 FROM_HERE, |
42 base::Bind(&NotifyClientCertificatesChanged), | 45 base::Bind(&NotifyClientCertificatesChanged), |
43 base::Bind(&ClientCertificatesCleared, base::Owned(j_callback))); | 46 base::Bind(&ClientCertificatesCleared, base::Owned(j_callback))); |
44 } | 47 } |
45 | 48 |
49 // static | |
50 void SetDataReductionProxyEnabled(JNIEnv* env, jclass, jboolean enabled) { | |
51 AwBrowserContext* context = AwBrowserContext::GetDefault(); | |
52 if (context == NULL) return; | |
boliu
2014/05/06 23:38:04
return on new line (don't need brackets) here and
| |
53 DataReductionProxySettings* proxy_settings = | |
54 context->GetDataReductionProxySettings(); | |
55 if (proxy_settings == NULL) return; | |
56 proxy_settings->SetDataReductionProxyEnabled(enabled); | |
57 } | |
58 | |
46 bool RegisterAwContentsStatics(JNIEnv* env) { | 59 bool RegisterAwContentsStatics(JNIEnv* env) { |
47 return RegisterNativesImpl(env); | 60 return RegisterNativesImpl(env); |
48 } | 61 } |
49 | 62 |
50 } // namespace android_webview | 63 } // namespace android_webview |
OLD | NEW |