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" |
11 #include "base/android/jni_string.h" | 11 #include "base/android/jni_string.h" |
12 #include "base/android/scoped_java_ref.h" | 12 #include "base/android/scoped_java_ref.h" |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
15 #include "content/public/browser/storage_partition.h" | |
16 #include "content/public/common/url_constants.h" | 15 #include "content/public/common/url_constants.h" |
17 #include "jni/AwContentsStatics_jni.h" | 16 #include "jni/AwContentsStatics_jni.h" |
18 #include "net/cert/cert_database.h" | 17 #include "net/cert/cert_database.h" |
19 | 18 |
20 using base::android::AttachCurrentThread; | 19 using base::android::AttachCurrentThread; |
21 using base::android::ConvertJavaStringToUTF8; | 20 using base::android::ConvertJavaStringToUTF8; |
22 using base::android::ScopedJavaGlobalRef; | 21 using base::android::ScopedJavaGlobalRef; |
23 using content::BrowserThread; | 22 using content::BrowserThread; |
24 | 23 |
25 namespace android_webview { | 24 namespace android_webview { |
(...skipping 26 matching lines...) Expand all Loading... |
52 base::Bind(&NotifyClientCertificatesChanged), | 51 base::Bind(&NotifyClientCertificatesChanged), |
53 base::Bind(&ClientCertificatesCleared, base::Owned(j_callback))); | 52 base::Bind(&ClientCertificatesCleared, base::Owned(j_callback))); |
54 } | 53 } |
55 | 54 |
56 // static | 55 // static |
57 void SetDataReductionProxyKey(JNIEnv* env, | 56 void SetDataReductionProxyKey(JNIEnv* env, |
58 const JavaParamRef<jclass>&, | 57 const JavaParamRef<jclass>&, |
59 const JavaParamRef<jstring>& key) { | 58 const JavaParamRef<jstring>& key) { |
60 AwBrowserContext* browser_context = AwBrowserContext::GetDefault(); | 59 AwBrowserContext* browser_context = AwBrowserContext::GetDefault(); |
61 DCHECK(browser_context); | 60 DCHECK(browser_context); |
| 61 DCHECK(browser_context->GetRequestContext()); |
62 // The following call to GetRequestContext() could possibly be the first such | 62 // The following call to GetRequestContext() could possibly be the first such |
63 // call, which means AwURLRequestContextGetter::InitializeURLRequestContext | 63 // call, which means AwURLRequestContextGetter::InitializeURLRequestContext |
64 // will be called on IO thread as a result. | 64 // will be called on IO thread as a result. |
65 AwURLRequestContextGetter* aw_url_request_context_getter = | 65 AwURLRequestContextGetter* aw_url_request_context_getter = |
66 static_cast<AwURLRequestContextGetter*>( | 66 static_cast<AwURLRequestContextGetter*>( |
67 content::BrowserContext::GetDefaultStoragePartition(browser_context)-> | 67 browser_context->GetRequestContext()); |
68 GetURLRequestContext()); | |
69 DCHECK(aw_url_request_context_getter); | |
70 | 68 |
71 // This PostTask has to be called after GetRequestContext, because SetKeyOnIO | 69 // This PostTask has to be called after GetRequestContext, because SetKeyOnIO |
72 // needs a valid DataReductionProxyRequestOptions object. | 70 // needs a valid DataReductionProxyRequestOptions object. |
73 BrowserThread::PostTask(BrowserThread::IO, | 71 BrowserThread::PostTask(BrowserThread::IO, |
74 FROM_HERE, | 72 FROM_HERE, |
75 base::Bind(&AwURLRequestContextGetter::SetKeyOnIO, | 73 base::Bind(&AwURLRequestContextGetter::SetKeyOnIO, |
76 aw_url_request_context_getter, | 74 aw_url_request_context_getter, |
77 ConvertJavaStringToUTF8(env, key))); | 75 ConvertJavaStringToUTF8(env, key))); |
78 } | 76 } |
79 | 77 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 AwContentsIoThreadClientImpl::SetServiceWorkerIoThreadClient( | 112 AwContentsIoThreadClientImpl::SetServiceWorkerIoThreadClient( |
115 io_thread_client, browser_context); | 113 io_thread_client, browser_context); |
116 } | 114 } |
117 | 115 |
118 | 116 |
119 bool RegisterAwContentsStatics(JNIEnv* env) { | 117 bool RegisterAwContentsStatics(JNIEnv* env) { |
120 return RegisterNativesImpl(env); | 118 return RegisterNativesImpl(env); |
121 } | 119 } |
122 | 120 |
123 } // namespace android_webview | 121 } // namespace android_webview |
OLD | NEW |