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 "android_webview/browser/net/aw_url_request_context_getter.h" |
8 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
9 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
10 #include "base/callback.h" | 11 #include "base/callback.h" |
11 #include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_requ
est_handler.h" | 12 #include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_requ
est_handler.h" |
12 #include "content/public/browser/android/synchronous_compositor.h" | 13 #include "content/public/browser/android/synchronous_compositor.h" |
13 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
14 #include "content/public/common/url_constants.h" | 15 #include "content/public/common/url_constants.h" |
15 #include "jni/AwContentsStatics_jni.h" | 16 #include "jni/AwContentsStatics_jni.h" |
16 #include "net/cert/cert_database.h" | 17 #include "net/cert/cert_database.h" |
17 | 18 |
(...skipping 29 matching lines...) Expand all Loading... |
47 BrowserThread::IO, | 48 BrowserThread::IO, |
48 FROM_HERE, | 49 FROM_HERE, |
49 base::Bind(&NotifyClientCertificatesChanged), | 50 base::Bind(&NotifyClientCertificatesChanged), |
50 base::Bind(&ClientCertificatesCleared, base::Owned(j_callback))); | 51 base::Bind(&ClientCertificatesCleared, base::Owned(j_callback))); |
51 } | 52 } |
52 | 53 |
53 // static | 54 // static |
54 void SetDataReductionProxyKey(JNIEnv* env, jclass, jstring key) { | 55 void SetDataReductionProxyKey(JNIEnv* env, jclass, jstring key) { |
55 AwBrowserContext* browser_context = AwBrowserContext::GetDefault(); | 56 AwBrowserContext* browser_context = AwBrowserContext::GetDefault(); |
56 DCHECK(browser_context); | 57 DCHECK(browser_context); |
57 DataReductionProxyAuthRequestHandler* drp_auth_request_handler = | 58 DCHECK(browser_context->GetRequestContext()); |
58 browser_context->GetDataReductionProxyAuthRequestHandler(); | 59 AwURLRequestContextGetter* aw_url_request_context_getter = |
59 if (drp_auth_request_handler) | 60 static_cast<AwURLRequestContextGetter*>( |
60 drp_auth_request_handler->SetKey( | 61 browser_context->GetRequestContext()); |
| 62 DataReductionProxyAuthRequestHandler* auth_request_handler = |
| 63 aw_url_request_context_getter->GetDataReductionProxyAuthRequestHandler(); |
| 64 if (auth_request_handler) { |
| 65 auth_request_handler->SetKeyOnUI( |
61 ConvertJavaStringToUTF8(env, key)); | 66 ConvertJavaStringToUTF8(env, key)); |
| 67 } else { |
| 68 DLOG(ERROR) << "Data reduction proxy auth request handler does not exist"; |
| 69 } |
62 } | 70 } |
63 | 71 |
64 // static | 72 // static |
65 void SetDataReductionProxyEnabled(JNIEnv* env, jclass, jboolean enabled) { | 73 void SetDataReductionProxyEnabled(JNIEnv* env, jclass, jboolean enabled) { |
66 AwBrowserContext::SetDataReductionProxyEnabled(enabled); | 74 AwBrowserContext::SetDataReductionProxyEnabled(enabled); |
67 } | 75 } |
68 | 76 |
69 // static | 77 // static |
70 jstring GetUnreachableWebDataUrl(JNIEnv* env, jclass) { | 78 jstring GetUnreachableWebDataUrl(JNIEnv* env, jclass) { |
71 return base::android::ConvertUTF8ToJavaString( | 79 return base::android::ConvertUTF8ToJavaString( |
72 env, content::kUnreachableWebDataURL).Release(); | 80 env, content::kUnreachableWebDataURL).Release(); |
73 } | 81 } |
74 | 82 |
75 // static | 83 // static |
76 void SetRecordFullDocument(JNIEnv* env, jclass, jboolean record_full_document) { | 84 void SetRecordFullDocument(JNIEnv* env, jclass, jboolean record_full_document) { |
77 content::SynchronousCompositor::SetRecordFullDocument(record_full_document); | 85 content::SynchronousCompositor::SetRecordFullDocument(record_full_document); |
78 } | 86 } |
79 | 87 |
80 bool RegisterAwContentsStatics(JNIEnv* env) { | 88 bool RegisterAwContentsStatics(JNIEnv* env) { |
81 return RegisterNativesImpl(env); | 89 return RegisterNativesImpl(env); |
82 } | 90 } |
83 | 91 |
84 } // namespace android_webview | 92 } // namespace android_webview |
OLD | NEW |