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), |
62 data_reduction_proxy::kClientAndroidWebview, | 67 data_reduction_proxy::kClientAndroidWebview, |
63 data_reduction_proxy::kProtocolVersion); | 68 data_reduction_proxy::kProtocolVersion); |
sgurun-gerrit only
2014/08/05 01:26:36
log an error if auth_request_handler does not exis
bengr
2014/08/05 02:35:07
Done.
| |
64 } | 69 } |
65 | 70 |
66 // static | 71 // static |
67 void SetDataReductionProxyEnabled(JNIEnv* env, jclass, jboolean enabled) { | 72 void SetDataReductionProxyEnabled(JNIEnv* env, jclass, jboolean enabled) { |
68 AwBrowserContext::SetDataReductionProxyEnabled(enabled); | 73 AwBrowserContext::SetDataReductionProxyEnabled(enabled); |
69 } | 74 } |
70 | 75 |
71 // static | 76 // static |
72 jstring GetUnreachableWebDataUrl(JNIEnv* env, jclass) { | 77 jstring GetUnreachableWebDataUrl(JNIEnv* env, jclass) { |
73 return base::android::ConvertUTF8ToJavaString( | 78 return base::android::ConvertUTF8ToJavaString( |
74 env, content::kUnreachableWebDataURL).Release(); | 79 env, content::kUnreachableWebDataURL).Release(); |
75 } | 80 } |
76 | 81 |
77 // static | 82 // static |
78 void SetRecordFullDocument(JNIEnv* env, jclass, jboolean record_full_document) { | 83 void SetRecordFullDocument(JNIEnv* env, jclass, jboolean record_full_document) { |
79 content::SynchronousCompositor::SetRecordFullDocument(record_full_document); | 84 content::SynchronousCompositor::SetRecordFullDocument(record_full_document); |
80 } | 85 } |
81 | 86 |
82 bool RegisterAwContentsStatics(JNIEnv* env) { | 87 bool RegisterAwContentsStatics(JNIEnv* env) { |
83 return RegisterNativesImpl(env); | 88 return RegisterNativesImpl(env); |
84 } | 89 } |
85 | 90 |
86 } // namespace android_webview | 91 } // namespace android_webview |
OLD | NEW |