OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_quota_manager_bridge_impl.h" | 5 #include "android_webview/native/aw_quota_manager_bridge_impl.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "android_webview/browser/aw_browser_context.h" | 9 #include "android_webview/browser/aw_browser_context.h" |
10 #include "android_webview/browser/aw_content_browser_client.h" | 10 #include "android_webview/browser/aw_content_browser_client.h" |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 const std::vector<std::string>& origin, | 277 const std::vector<std::string>& origin, |
278 const std::vector<int64_t>& usage, | 278 const std::vector<int64_t>& usage, |
279 const std::vector<int64_t>& quota) { | 279 const std::vector<int64_t>& quota) { |
280 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 280 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
281 JNIEnv* env = AttachCurrentThread(); | 281 JNIEnv* env = AttachCurrentThread(); |
282 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 282 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
283 if (obj.is_null()) | 283 if (obj.is_null()) |
284 return; | 284 return; |
285 | 285 |
286 Java_AwQuotaManagerBridge_onGetOriginsCallback( | 286 Java_AwQuotaManagerBridge_onGetOriginsCallback( |
287 env, | 287 env, obj, jcallback_id, base::android::ToJavaArrayOfStrings(env, origin), |
288 obj.obj(), | 288 base::android::ToJavaLongArray(env, usage), |
289 jcallback_id, | 289 base::android::ToJavaLongArray(env, quota)); |
290 base::android::ToJavaArrayOfStrings(env, origin).obj(), | |
291 base::android::ToJavaLongArray(env, usage).obj(), | |
292 base::android::ToJavaLongArray(env, quota).obj()); | |
293 } | 290 } |
294 | 291 |
295 namespace { | 292 namespace { |
296 | 293 |
297 void OnUsageAndQuotaObtained( | 294 void OnUsageAndQuotaObtained( |
298 const AwQuotaManagerBridgeImpl::QuotaUsageCallback& ui_callback, | 295 const AwQuotaManagerBridgeImpl::QuotaUsageCallback& ui_callback, |
299 storage::QuotaStatusCode status_code, | 296 storage::QuotaStatusCode status_code, |
300 int64_t usage, | 297 int64_t usage, |
301 int64_t quota) { | 298 int64_t quota) { |
302 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 299 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 bool is_quota, | 350 bool is_quota, |
354 int64_t usage, | 351 int64_t usage, |
355 int64_t quota) { | 352 int64_t quota) { |
356 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 353 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
357 JNIEnv* env = AttachCurrentThread(); | 354 JNIEnv* env = AttachCurrentThread(); |
358 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 355 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
359 if (obj.is_null()) | 356 if (obj.is_null()) |
360 return; | 357 return; |
361 | 358 |
362 Java_AwQuotaManagerBridge_onGetUsageAndQuotaForOriginCallback( | 359 Java_AwQuotaManagerBridge_onGetUsageAndQuotaForOriginCallback( |
363 env, obj.obj(), jcallback_id, is_quota, usage, quota); | 360 env, obj, jcallback_id, is_quota, usage, quota); |
364 } | 361 } |
365 | 362 |
366 bool RegisterAwQuotaManagerBridge(JNIEnv* env) { | 363 bool RegisterAwQuotaManagerBridge(JNIEnv* env) { |
367 return RegisterNativesImpl(env); | 364 return RegisterNativesImpl(env); |
368 } | 365 } |
369 | 366 |
370 } // namespace android_webview | 367 } // namespace android_webview |
OLD | NEW |