Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Side by Side Diff: android_webview/browser/aw_quota_manager_bridge.h

Issue 2888173003: [WebView] Remove jni_dependency_factory.h (Closed)
Patch Set: add explicit Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #ifndef ANDROID_WEBVIEW_BROWSER_AW_QUOTA_MANAGER_BRIDGE_H_ 5 #ifndef ANDROID_WEBVIEW_BROWSER_AW_QUOTA_MANAGER_BRIDGE_H_
6 #define ANDROID_WEBVIEW_BROWSER_AW_QUOTA_MANAGER_BRIDGE_H_ 6 #define ANDROID_WEBVIEW_BROWSER_AW_QUOTA_MANAGER_BRIDGE_H_
7 7
8 #include <jni.h>
9 #include <stdint.h>
10
11 #include <string>
12 #include <vector>
13
14 #include "base/android/jni_weak_ref.h"
15 #include "base/callback.h"
16 #include "base/macros.h"
8 #include "base/memory/ref_counted.h" 17 #include "base/memory/ref_counted.h"
18 #include "base/memory/weak_ptr.h"
19 #include "base/strings/string16.h"
20
21 namespace content {
22 class StoragePartition;
23 }
24
25 namespace storage {
26 class QuotaManager;
27 } // namespace storage
9 28
10 namespace android_webview { 29 namespace android_webview {
11 30
12 // Empty base class so this can be refcounted by AwBrowserContext. 31 class AwBrowserContext;
13 class AwQuotaManagerBridge : 32
14 public base::RefCountedThreadSafe<AwQuotaManagerBridge> { 33 class AwQuotaManagerBridge
15 protected: 34 : public base::RefCountedThreadSafe<AwQuotaManagerBridge> {
35 public:
36 static scoped_refptr<AwQuotaManagerBridge> Create(
37 AwBrowserContext* browser_context);
38
39 // Called by Java.
40 void Init(JNIEnv* env, const base::android::JavaParamRef<jobject>& object);
41 void DeleteAllData(JNIEnv* env,
42 const base::android::JavaParamRef<jobject>& object);
43 void DeleteOrigin(JNIEnv* env,
44 const base::android::JavaParamRef<jobject>& object,
45 const base::android::JavaParamRef<jstring>& origin);
46 void GetOrigins(JNIEnv* env,
47 const base::android::JavaParamRef<jobject>& object,
48 jint callback_id);
49 void GetUsageAndQuotaForOrigin(
50 JNIEnv* env,
51 const base::android::JavaParamRef<jobject>& object,
52 const base::android::JavaParamRef<jstring>& origin,
53 jint callback_id,
54 bool is_quota);
55
56 typedef base::Callback<void(const std::vector<std::string>& /* origin */,
57 const std::vector<int64_t>& /* usaoge */,
58 const std::vector<int64_t>& /* quota */)>
59 GetOriginsCallback;
60 typedef base::Callback<void(int64_t /* usage */, int64_t /* quota */)>
61 QuotaUsageCallback;
62
63 private:
16 friend class base::RefCountedThreadSafe<AwQuotaManagerBridge>; 64 friend class base::RefCountedThreadSafe<AwQuotaManagerBridge>;
17 AwQuotaManagerBridge(); 65 explicit AwQuotaManagerBridge(AwBrowserContext* browser_context);
18 virtual ~AwQuotaManagerBridge(); 66 ~AwQuotaManagerBridge();
67
68 content::StoragePartition* GetStoragePartition() const;
69
70 storage::QuotaManager* GetQuotaManager() const;
71
72 void DeleteAllDataOnUiThread();
73 void DeleteOriginOnUiThread(const base::string16& origin);
74 void GetOriginsOnUiThread(jint callback_id);
75 void GetUsageAndQuotaForOriginOnUiThread(const base::string16& origin,
76 jint callback_id,
77 bool is_quota);
78
79 void GetOriginsCallbackImpl(int jcallback_id,
80 const std::vector<std::string>& origin,
81 const std::vector<int64_t>& usage,
82 const std::vector<int64_t>& quota);
83 void QuotaUsageCallbackImpl(int jcallback_id,
84 bool is_quota,
85 int64_t usage,
86 int64_t quota);
87
88 AwBrowserContext* browser_context_;
89 JavaObjectWeakGlobalRef java_ref_;
90
91 base::WeakPtrFactory<AwQuotaManagerBridge> weak_factory_;
92
93 DISALLOW_COPY_AND_ASSIGN(AwQuotaManagerBridge);
19 }; 94 };
20 95
96 bool RegisterAwQuotaManagerBridge(JNIEnv* env);
97
21 } // namespace android_webview 98 } // namespace android_webview
22 99
23 #endif // ANDROID_WEBVIEW_BROWSER_AW_QUOTA_MANAGER_BRIDGE_H_ 100 #endif // ANDROID_WEBVIEW_BROWSER_AW_QUOTA_MANAGER_BRIDGE_H_
OLDNEW
« no previous file with comments | « android_webview/browser/aw_content_browser_client.cc ('k') | android_webview/browser/aw_quota_manager_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698