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
3 // found in the LICENSE file.
5 #ifndef ANDROID_WEBVIEW_NATIVE_AW_QUOTA_MANAGER_BRIDGE_IMPL_H_
6 #define ANDROID_WEBVIEW_NATIVE_AW_QUOTA_MANAGER_BRIDGE_IMPL_H_
12 #include "android_webview/browser/aw_quota_manager_bridge.h"
13 #include "base/android/jni_helper.h"
14 #include "base/basictypes.h"
15 #include "base/callback.h"
16 #include "base/memory/ref_counted.h"
17 #include "base/memory/weak_ptr.h"
22 class StoragePartition
;
29 namespace android_webview
{
31 class AwBrowserContext
;
33 class AwQuotaManagerBridgeImpl
: public AwQuotaManagerBridge
{
35 explicit AwQuotaManagerBridgeImpl(AwBrowserContext
* browser_context
);
36 virtual ~AwQuotaManagerBridgeImpl();
39 void Init(JNIEnv
* env
, jobject object
);
40 void DeleteAllData(JNIEnv
* env
, jobject object
);
41 void DeleteOrigin(JNIEnv
* env
, jobject object
, jstring origin
);
42 void GetOrigins(JNIEnv
* env
, jobject object
, jint callback_id
);
43 void GetUsageAndQuotaForOrigin(JNIEnv
* env
,
49 typedef base::Callback
<
50 void(const std::vector
<std::string
>& /* origin */,
51 const std::vector
<int64
>& /* usage */,
52 const std::vector
<int64
>& /* quota */)> GetOriginsCallback
;
53 typedef base::Callback
<void(int64
/* usage */,
54 int64
/* quota */)> QuotaUsageCallback
;
57 content::StoragePartition
* GetStoragePartition() const;
59 quota::QuotaManager
* GetQuotaManager() const;
61 void GetOriginsCallbackImpl(
63 const std::vector
<std::string
>& origin
,
64 const std::vector
<int64
>& usage
,
65 const std::vector
<int64
>& quota
);
66 void QuotaUsageCallbackImpl(
67 int jcallback_id
, bool is_quota
, int64 usage
, int64 quota
);
69 base::WeakPtrFactory
<AwQuotaManagerBridgeImpl
> weak_factory_
;
70 AwBrowserContext
* browser_context_
;
71 JavaObjectWeakGlobalRef java_ref_
;
73 DISALLOW_COPY_AND_ASSIGN(AwQuotaManagerBridgeImpl
);
76 bool RegisterAwQuotaManagerBridge(JNIEnv
* env
);
78 } // namespace android_webview
80 #endif // ANDROID_WEBVIEW_NATIVE_AW_QUOTA_MANAGER_BRIDGE_IMPL_H_