OLD | NEW |
---|---|
(Empty) | |
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. | |
4 | |
5 #ifndef ANDROID_WEBVIEW_NATIVE_AW_QUOTA_MANAGER_BRIDGE_IMPL_H_ | |
6 #define ANDROID_WEBVIEW_NATIVE_AW_QUOTA_MANAGER_BRIDGE_IMPL_H_ | |
7 | |
8 #include <jni.h> | |
9 #include <string> | |
10 #include <vector> | |
11 | |
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" | |
18 | |
19 class GURL; | |
20 | |
21 namespace quota { | |
22 class QuotaManager; | |
23 } // namespace quota | |
24 | |
25 namespace android_webview { | |
26 | |
27 class AwBrowserContext; | |
28 | |
29 class AwQuotaManagerBridgeImpl : public AwQuotaManagerBridge { | |
30 public: | |
31 explicit AwQuotaManagerBridgeImpl(AwBrowserContext* browser_context); | |
32 | |
33 void Init(JNIEnv* env, jobject object); | |
34 void DeleteAllData(JNIEnv* env, jobject object); | |
35 void DeleteOrigin(JNIEnv* env, jobject object, jstring origin); | |
36 void GetOrigins(JNIEnv* env, jobject object, jint callback_id); | |
37 void GetUsageAndQuotaForOrigin(JNIEnv* env, | |
38 jobject object, | |
39 jstring origin, | |
40 jint callback_id, | |
41 bool is_quota); | |
42 | |
43 typedef base::Callback< | |
44 void(const std::vector<std::string>& /* origin */, | |
45 const std::vector<int64>& /* usage */, | |
46 const std::vector<int64>& /* quota */)> GetOriginsCallback; | |
47 typedef base::Callback<void(int64 /* usage */, | |
48 int64 /* quota */)> QuotaUsageCallback; | |
49 | |
50 private: | |
51 scoped_refptr<quota::QuotaManager> GetQuotaManager() const; | |
boliu
2013/02/20 00:53:51
I'm not sure if base::Bind will take something as
mkosiba (inactive)
2013/02/20 12:21:38
it works correctly for a pointer to anything that
| |
52 | |
53 void GetOriginsCallbackImpl( | |
boliu
2013/02/20 00:53:51
Better name suggestion welcome..
| |
54 int jcallback_id, | |
55 const std::vector<std::string>& origin, | |
56 const std::vector<int64>& usage, | |
57 const std::vector<int64>& quota); | |
58 void QuotaUsageCallbackImpl( | |
59 int jcallback_id, bool is_quota, int64 usage, int64 quota); | |
60 | |
61 base::WeakPtrFactory<AwQuotaManagerBridgeImpl> weak_factory_; | |
62 AwBrowserContext* browser_context_; | |
63 JavaObjectWeakGlobalRef java_ref_; | |
64 DISALLOW_COPY_AND_ASSIGN(AwQuotaManagerBridgeImpl); | |
65 }; | |
66 | |
67 bool RegisterAwQuotaManagerBridge(JNIEnv* env); | |
68 | |
69 } // namespace android_webview | |
70 | |
71 #endif // ANDROID_WEBVIEW_NATIVE_AW_QUOTA_MANAGER_BRIDGE_IMPL_H_ | |
OLD | NEW |