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 "android_webview/browser/net/aw_url_request_context_getter.h" |
9 #include "android_webview/common/aw_version_info_values.h" | 9 #include "android_webview/common/aw_version_info_values.h" |
10 #include "android_webview/native/aw_contents_io_thread_client_impl.h" | 10 #include "android_webview/native/aw_contents_io_thread_client_impl.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 ScopedJavaGlobalRef<jobject>* j_callback = new ScopedJavaGlobalRef<jobject>(); | 47 ScopedJavaGlobalRef<jobject>* j_callback = new ScopedJavaGlobalRef<jobject>(); |
48 j_callback->Reset(env, callback); | 48 j_callback->Reset(env, callback); |
49 BrowserThread::PostTaskAndReply( | 49 BrowserThread::PostTaskAndReply( |
50 BrowserThread::IO, | 50 BrowserThread::IO, |
51 FROM_HERE, | 51 FROM_HERE, |
52 base::Bind(&NotifyClientCertificatesChanged), | 52 base::Bind(&NotifyClientCertificatesChanged), |
53 base::Bind(&ClientCertificatesCleared, base::Owned(j_callback))); | 53 base::Bind(&ClientCertificatesCleared, base::Owned(j_callback))); |
54 } | 54 } |
55 | 55 |
56 // static | 56 // static |
57 void SetDataReductionProxyKey(JNIEnv* env, | |
58 const JavaParamRef<jclass>&, | |
59 const JavaParamRef<jstring>& key) { | |
60 AwBrowserContext* browser_context = AwBrowserContext::GetDefault(); | |
61 DCHECK(browser_context); | |
62 // The following call to GetRequestContext() could possibly be the first such | |
63 // call, which means AwURLRequestContextGetter::InitializeURLRequestContext | |
64 // will be called on IO thread as a result. | |
65 AwURLRequestContextGetter* aw_url_request_context_getter = | |
66 static_cast<AwURLRequestContextGetter*>( | |
67 content::BrowserContext::GetDefaultStoragePartition(browser_context)-> | |
68 GetURLRequestContext()); | |
69 DCHECK(aw_url_request_context_getter); | |
70 | |
71 // This PostTask has to be called after GetRequestContext, because SetKeyOnIO | |
72 // needs a valid DataReductionProxyRequestOptions object. | |
73 BrowserThread::PostTask(BrowserThread::IO, | |
74 FROM_HERE, | |
75 base::Bind(&AwURLRequestContextGetter::SetKeyOnIO, | |
76 aw_url_request_context_getter, | |
77 ConvertJavaStringToUTF8(env, key))); | |
78 } | |
79 | |
80 // static | |
81 void SetDataReductionProxyEnabled(JNIEnv* env, | |
82 const JavaParamRef<jclass>&, | |
83 jboolean enabled) { | |
84 AwBrowserContext::SetDataReductionProxyEnabled(enabled); | |
85 } | |
86 | |
87 // static | |
88 ScopedJavaLocalRef<jstring> GetUnreachableWebDataUrl( | 57 ScopedJavaLocalRef<jstring> GetUnreachableWebDataUrl( |
89 JNIEnv* env, | 58 JNIEnv* env, |
90 const JavaParamRef<jclass>&) { | 59 const JavaParamRef<jclass>&) { |
91 return base::android::ConvertUTF8ToJavaString( | 60 return base::android::ConvertUTF8ToJavaString( |
92 env, content::kUnreachableWebDataURL); | 61 env, content::kUnreachableWebDataURL); |
93 } | 62 } |
94 | 63 |
95 // static | 64 // static |
96 void SetLegacyCacheRemovalDelayForTest(JNIEnv*, | 65 void SetLegacyCacheRemovalDelayForTest(JNIEnv*, |
97 const JavaParamRef<jclass>&, | 66 const JavaParamRef<jclass>&, |
(...skipping 16 matching lines...) Expand all Loading... |
114 AwContentsIoThreadClientImpl::SetServiceWorkerIoThreadClient( | 83 AwContentsIoThreadClientImpl::SetServiceWorkerIoThreadClient( |
115 io_thread_client, browser_context); | 84 io_thread_client, browser_context); |
116 } | 85 } |
117 | 86 |
118 | 87 |
119 bool RegisterAwContentsStatics(JNIEnv* env) { | 88 bool RegisterAwContentsStatics(JNIEnv* env) { |
120 return RegisterNativesImpl(env); | 89 return RegisterNativesImpl(env); |
121 } | 90 } |
122 | 91 |
123 } // namespace android_webview | 92 } // namespace android_webview |
OLD | NEW |