| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef WebStorageQuotaCallbacksImpl_h | 31 #ifndef WebStorageQuotaCallbacksImpl_h |
| 32 #define WebStorageQuotaCallbacksImpl_h | 32 #define WebStorageQuotaCallbacksImpl_h |
| 33 | 33 |
| 34 #include "WebStorageQuotaCallbacks.h" | 34 #include "modules/quota/StorageErrorCallback.h" |
| 35 #include "wtf/PassOwnPtr.h" | 35 #include "modules/quota/StorageQuotaCallback.h" |
| 36 #include "modules/quota/StorageUsageCallback.h" |
| 37 #include "public/platform/WebStorageQuotaCallbacks.h" |
| 38 #include "wtf/OwnPtr.h" |
| 36 #include "wtf/PassRefPtr.h" | 39 #include "wtf/PassRefPtr.h" |
| 37 #include "wtf/RefPtr.h" | 40 #include "wtf/RefPtr.h" |
| 38 | 41 |
| 39 namespace WebCore { | 42 namespace WebCore { |
| 40 class StorageErrorCallback; | |
| 41 class StorageQuotaCallback; | |
| 42 class StorageUsageCallback; | |
| 43 } | |
| 44 | 43 |
| 45 namespace WebKit { | 44 class WebStorageQuotaCallbacksImpl : public WebKit::WebStorageQuotaCallbacks { |
| 45 public: |
| 46 // The class is self-destructed and thus we have leakedPtr constructors. |
| 47 static WebStorageQuotaCallbacksImpl* createLeakedPtr(PassRefPtr<StorageUsage
Callback> success, PassRefPtr<StorageErrorCallback> error) |
| 48 { |
| 49 OwnPtr<WebStorageQuotaCallbacksImpl> callbacks = adoptPtr(new WebStorage
QuotaCallbacksImpl(success, error)); |
| 50 return callbacks.leakPtr(); |
| 51 } |
| 46 | 52 |
| 47 class WebStorageQuotaCallbacksImpl : public WebStorageQuotaCallbacks { | 53 static WebStorageQuotaCallbacksImpl* createLeakedPtr(PassRefPtr<StorageQuota
Callback> success, PassRefPtr<StorageErrorCallback> error) |
| 48 public: | 54 { |
| 49 // The class is self-destructed and thus we have bare constructors. | 55 OwnPtr<WebStorageQuotaCallbacksImpl> callbacks = adoptPtr(new WebStorage
QuotaCallbacksImpl(success, error)); |
| 50 WebStorageQuotaCallbacksImpl(PassRefPtr<WebCore::StorageUsageCallback>, Pass
RefPtr<WebCore::StorageErrorCallback>); | 56 return callbacks.leakPtr(); |
| 51 WebStorageQuotaCallbacksImpl(PassRefPtr<WebCore::StorageQuotaCallback>, Pass
RefPtr<WebCore::StorageErrorCallback>); | 57 } |
| 52 | 58 |
| 53 virtual ~WebStorageQuotaCallbacksImpl(); | 59 virtual ~WebStorageQuotaCallbacksImpl(); |
| 54 | 60 |
| 55 virtual void didQueryStorageUsageAndQuota(unsigned long long usageInBytes, u
nsigned long long quotaInBytes); | 61 virtual void didQueryStorageUsageAndQuota(unsigned long long usageInBytes, u
nsigned long long quotaInBytes); |
| 56 virtual void didGrantStorageQuota(unsigned long long grantedQuotaInBytes); | 62 virtual void didGrantStorageQuota(unsigned long long grantedQuotaInBytes); |
| 57 virtual void didFail(WebStorageQuotaError); | 63 virtual void didFail(WebKit::WebStorageQuotaError); |
| 58 | 64 |
| 59 private: | 65 private: |
| 60 RefPtr<WebCore::StorageUsageCallback> m_usageCallback; | 66 WebStorageQuotaCallbacksImpl(PassRefPtr<StorageUsageCallback>, PassRefPtr<St
orageErrorCallback>); |
| 61 RefPtr<WebCore::StorageQuotaCallback> m_quotaCallback; | 67 WebStorageQuotaCallbacksImpl(PassRefPtr<StorageQuotaCallback>, PassRefPtr<St
orageErrorCallback>); |
| 62 RefPtr<WebCore::StorageErrorCallback> m_errorCallback; | 68 |
| 69 RefPtr<StorageUsageCallback> m_usageCallback; |
| 70 RefPtr<StorageQuotaCallback> m_quotaCallback; |
| 71 RefPtr<StorageErrorCallback> m_errorCallback; |
| 63 }; | 72 }; |
| 64 | 73 |
| 65 } // namespace WebKit | 74 } // namespace |
| 66 | 75 |
| 67 #endif // WebStorageQuotaCallbacksImpl_h | 76 #endif // WebStorageQuotaCallbacksImpl_h |
| OLD | NEW |