| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_io_thread_client_impl.h" | 5 #include "android_webview/native/aw_contents_io_thread_client_impl.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "android_webview/native/intercepted_request_data_impl.h" | 10 #include "android_webview/native/intercepted_request_data_impl.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 169 |
| 170 AwContentsIoThreadClientImpl::AwContentsIoThreadClientImpl( | 170 AwContentsIoThreadClientImpl::AwContentsIoThreadClientImpl( |
| 171 const JavaRef<jobject>& obj) | 171 const JavaRef<jobject>& obj) |
| 172 : java_object_(obj) { | 172 : java_object_(obj) { |
| 173 } | 173 } |
| 174 | 174 |
| 175 AwContentsIoThreadClientImpl::~AwContentsIoThreadClientImpl() { | 175 AwContentsIoThreadClientImpl::~AwContentsIoThreadClientImpl() { |
| 176 // explict, out-of-line destructor. | 176 // explict, out-of-line destructor. |
| 177 } | 177 } |
| 178 | 178 |
| 179 AwContentsIoThreadClient::CacheMode |
| 180 AwContentsIoThreadClientImpl::GetCacheMode() const { |
| 181 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 182 if (java_object_.is_null()) |
| 183 return AwContentsIoThreadClient::LOAD_DEFAULT; |
| 184 |
| 185 JNIEnv* env = AttachCurrentThread(); |
| 186 return static_cast<AwContentsIoThreadClient::CacheMode>( |
| 187 Java_AwContentsIoThreadClient_getCacheMode( |
| 188 env, java_object_.obj())); |
| 189 } |
| 190 |
| 179 scoped_ptr<InterceptedRequestData> | 191 scoped_ptr<InterceptedRequestData> |
| 180 AwContentsIoThreadClientImpl::ShouldInterceptRequest( | 192 AwContentsIoThreadClientImpl::ShouldInterceptRequest( |
| 181 const GURL& location, | 193 const GURL& location, |
| 182 const net::URLRequest* request) { | 194 const net::URLRequest* request) { |
| 183 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 195 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 184 if (java_object_.is_null()) | 196 if (java_object_.is_null()) |
| 185 return scoped_ptr<InterceptedRequestData>(); | 197 return scoped_ptr<InterceptedRequestData>(); |
| 186 | 198 |
| 187 JNIEnv* env = AttachCurrentThread(); | 199 JNIEnv* env = AttachCurrentThread(); |
| 188 ScopedJavaLocalRef<jstring> jstring_url = | 200 ScopedJavaLocalRef<jstring> jstring_url = |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 JNIEnv* env = AttachCurrentThread(); | 236 JNIEnv* env = AttachCurrentThread(); |
| 225 return Java_AwContentsIoThreadClient_shouldBlockNetworkLoads( | 237 return Java_AwContentsIoThreadClient_shouldBlockNetworkLoads( |
| 226 env, java_object_.obj()); | 238 env, java_object_.obj()); |
| 227 } | 239 } |
| 228 | 240 |
| 229 bool RegisterAwContentsIoThreadClientImpl(JNIEnv* env) { | 241 bool RegisterAwContentsIoThreadClientImpl(JNIEnv* env) { |
| 230 return RegisterNativesImpl(env); | 242 return RegisterNativesImpl(env); |
| 231 } | 243 } |
| 232 | 244 |
| 233 } // namespace android_webview | 245 } // namespace android_webview |
| OLD | NEW |