| 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 26 matching lines...) Expand all Loading... |
| 37 #include "public/platform/WebStorageQuotaCallbacks.h" | 37 #include "public/platform/WebStorageQuotaCallbacks.h" |
| 38 #include "wtf/OwnPtr.h" | 38 #include "wtf/OwnPtr.h" |
| 39 #include "wtf/PassRefPtr.h" | 39 #include "wtf/PassRefPtr.h" |
| 40 #include "wtf/RefPtr.h" | 40 #include "wtf/RefPtr.h" |
| 41 | 41 |
| 42 namespace WebCore { | 42 namespace WebCore { |
| 43 | 43 |
| 44 class WebStorageQuotaCallbacksImpl : public blink::WebStorageQuotaCallbacks { | 44 class WebStorageQuotaCallbacksImpl : public blink::WebStorageQuotaCallbacks { |
| 45 public: | 45 public: |
| 46 // The class is self-destructed and thus we have leakedPtr constructors. | 46 // The class is self-destructed and thus we have leakedPtr constructors. |
| 47 static WebStorageQuotaCallbacksImpl* createLeakedPtr(PassRefPtr<StorageUsage
Callback> success, PassRefPtr<StorageErrorCallback> error) | 47 static WebStorageQuotaCallbacksImpl* createLeakedPtr(PassOwnPtr<StorageUsage
Callback> success, PassOwnPtr<StorageErrorCallback> error) |
| 48 { | 48 { |
| 49 OwnPtr<WebStorageQuotaCallbacksImpl> callbacks = adoptPtr(new WebStorage
QuotaCallbacksImpl(success, error)); | 49 OwnPtr<WebStorageQuotaCallbacksImpl> callbacks = adoptPtr(new WebStorage
QuotaCallbacksImpl(success, error)); |
| 50 return callbacks.leakPtr(); | 50 return callbacks.leakPtr(); |
| 51 } | 51 } |
| 52 | 52 |
| 53 static WebStorageQuotaCallbacksImpl* createLeakedPtr(PassRefPtr<StorageQuota
Callback> success, PassRefPtr<StorageErrorCallback> error) | 53 static WebStorageQuotaCallbacksImpl* createLeakedPtr(PassOwnPtr<StorageQuota
Callback> success, PassOwnPtr<StorageErrorCallback> error) |
| 54 { | 54 { |
| 55 OwnPtr<WebStorageQuotaCallbacksImpl> callbacks = adoptPtr(new WebStorage
QuotaCallbacksImpl(success, error)); | 55 OwnPtr<WebStorageQuotaCallbacksImpl> callbacks = adoptPtr(new WebStorage
QuotaCallbacksImpl(success, error)); |
| 56 return callbacks.leakPtr(); | 56 return callbacks.leakPtr(); |
| 57 } | 57 } |
| 58 | 58 |
| 59 virtual ~WebStorageQuotaCallbacksImpl(); | 59 virtual ~WebStorageQuotaCallbacksImpl(); |
| 60 | 60 |
| 61 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); |
| 62 virtual void didGrantStorageQuota(unsigned long long grantedQuotaInBytes); | 62 virtual void didGrantStorageQuota(unsigned long long grantedQuotaInBytes); |
| 63 virtual void didFail(blink::WebStorageQuotaError); | 63 virtual void didFail(blink::WebStorageQuotaError); |
| 64 | 64 |
| 65 private: | 65 private: |
| 66 WebStorageQuotaCallbacksImpl(PassRefPtr<StorageUsageCallback>, PassRefPtr<St
orageErrorCallback>); | 66 WebStorageQuotaCallbacksImpl(PassOwnPtr<StorageUsageCallback>, PassOwnPtr<St
orageErrorCallback>); |
| 67 WebStorageQuotaCallbacksImpl(PassRefPtr<StorageQuotaCallback>, PassRefPtr<St
orageErrorCallback>); | 67 WebStorageQuotaCallbacksImpl(PassOwnPtr<StorageQuotaCallback>, PassOwnPtr<St
orageErrorCallback>); |
| 68 | 68 |
| 69 RefPtr<StorageUsageCallback> m_usageCallback; | 69 OwnPtr<StorageUsageCallback> m_usageCallback; |
| 70 RefPtr<StorageQuotaCallback> m_quotaCallback; | 70 OwnPtr<StorageQuotaCallback> m_quotaCallback; |
| 71 RefPtr<StorageErrorCallback> m_errorCallback; | 71 OwnPtr<StorageErrorCallback> m_errorCallback; |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 } // namespace | 74 } // namespace |
| 75 | 75 |
| 76 #endif // WebStorageQuotaCallbacksImpl_h | 76 #endif // WebStorageQuotaCallbacksImpl_h |
| OLD | NEW |