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 #ifndef ANDROID_WEBVIEW_NATIVE_AW_QUOTA_MANAGER_BRIDGE_IMPL_H_ | 5 #ifndef ANDROID_WEBVIEW_NATIVE_AW_QUOTA_MANAGER_BRIDGE_IMPL_H_ |
6 #define ANDROID_WEBVIEW_NATIVE_AW_QUOTA_MANAGER_BRIDGE_IMPL_H_ | 6 #define ANDROID_WEBVIEW_NATIVE_AW_QUOTA_MANAGER_BRIDGE_IMPL_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "android_webview/browser/aw_quota_manager_bridge.h" | 12 #include "android_webview/browser/aw_quota_manager_bridge.h" |
13 #include "base/android/jni_helper.h" | 13 #include "base/android/jni_helper.h" |
14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
15 #include "base/callback.h" | 15 #include "base/callback.h" |
16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
18 | 18 |
19 class GURL; | 19 class GURL; |
20 | 20 |
| 21 namespace content { |
| 22 class StoragePartition; |
| 23 } |
| 24 |
21 namespace quota { | 25 namespace quota { |
22 class QuotaManager; | 26 class QuotaManager; |
23 } // namespace quota | 27 } // namespace quota |
24 | 28 |
25 namespace android_webview { | 29 namespace android_webview { |
26 | 30 |
27 class AwBrowserContext; | 31 class AwBrowserContext; |
28 | 32 |
29 class AwQuotaManagerBridgeImpl : public AwQuotaManagerBridge { | 33 class AwQuotaManagerBridgeImpl : public AwQuotaManagerBridge { |
30 public: | 34 public: |
(...skipping 12 matching lines...) Expand all Loading... |
43 bool is_quota); | 47 bool is_quota); |
44 | 48 |
45 typedef base::Callback< | 49 typedef base::Callback< |
46 void(const std::vector<std::string>& /* origin */, | 50 void(const std::vector<std::string>& /* origin */, |
47 const std::vector<int64>& /* usage */, | 51 const std::vector<int64>& /* usage */, |
48 const std::vector<int64>& /* quota */)> GetOriginsCallback; | 52 const std::vector<int64>& /* quota */)> GetOriginsCallback; |
49 typedef base::Callback<void(int64 /* usage */, | 53 typedef base::Callback<void(int64 /* usage */, |
50 int64 /* quota */)> QuotaUsageCallback; | 54 int64 /* quota */)> QuotaUsageCallback; |
51 | 55 |
52 private: | 56 private: |
| 57 content::StoragePartition* GetStoragePartition() const; |
| 58 |
53 quota::QuotaManager* GetQuotaManager() const; | 59 quota::QuotaManager* GetQuotaManager() const; |
54 | 60 |
55 void GetOriginsCallbackImpl( | 61 void GetOriginsCallbackImpl( |
56 int jcallback_id, | 62 int jcallback_id, |
57 const std::vector<std::string>& origin, | 63 const std::vector<std::string>& origin, |
58 const std::vector<int64>& usage, | 64 const std::vector<int64>& usage, |
59 const std::vector<int64>& quota); | 65 const std::vector<int64>& quota); |
60 void QuotaUsageCallbackImpl( | 66 void QuotaUsageCallbackImpl( |
61 int jcallback_id, bool is_quota, int64 usage, int64 quota); | 67 int jcallback_id, bool is_quota, int64 usage, int64 quota); |
62 | 68 |
63 base::WeakPtrFactory<AwQuotaManagerBridgeImpl> weak_factory_; | 69 base::WeakPtrFactory<AwQuotaManagerBridgeImpl> weak_factory_; |
64 AwBrowserContext* browser_context_; | 70 AwBrowserContext* browser_context_; |
65 JavaObjectWeakGlobalRef java_ref_; | 71 JavaObjectWeakGlobalRef java_ref_; |
66 | 72 |
67 DISALLOW_COPY_AND_ASSIGN(AwQuotaManagerBridgeImpl); | 73 DISALLOW_COPY_AND_ASSIGN(AwQuotaManagerBridgeImpl); |
68 }; | 74 }; |
69 | 75 |
70 bool RegisterAwQuotaManagerBridge(JNIEnv* env); | 76 bool RegisterAwQuotaManagerBridge(JNIEnv* env); |
71 | 77 |
72 } // namespace android_webview | 78 } // namespace android_webview |
73 | 79 |
74 #endif // ANDROID_WEBVIEW_NATIVE_AW_QUOTA_MANAGER_BRIDGE_IMPL_H_ | 80 #endif // ANDROID_WEBVIEW_NATIVE_AW_QUOTA_MANAGER_BRIDGE_IMPL_H_ |
OLD | NEW |