| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 STORAGE_BROWSER_QUOTA_QUOTA_CALLBACKS_H_ | 5 #ifndef STORAGE_BROWSER_QUOTA_QUOTA_CALLBACKS_H_ |
| 6 #define STORAGE_BROWSER_QUOTA_QUOTA_CALLBACKS_H_ | 6 #define STORAGE_BROWSER_QUOTA_QUOTA_CALLBACKS_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // Common callback types that are used throughout in the quota module. | 24 // Common callback types that are used throughout in the quota module. |
| 25 typedef base::Callback<void(int64 usage, | 25 typedef base::Callback<void(int64 usage, |
| 26 int64 unlimited_usage)> GlobalUsageCallback; | 26 int64 unlimited_usage)> GlobalUsageCallback; |
| 27 typedef base::Callback<void(QuotaStatusCode status, int64 quota)> QuotaCallback; | 27 typedef base::Callback<void(QuotaStatusCode status, int64 quota)> QuotaCallback; |
| 28 typedef base::Callback<void(int64 usage)> UsageCallback; | 28 typedef base::Callback<void(int64 usage)> UsageCallback; |
| 29 typedef base::Callback<void(QuotaStatusCode, int64)> AvailableSpaceCallback; | 29 typedef base::Callback<void(QuotaStatusCode, int64)> AvailableSpaceCallback; |
| 30 typedef base::Callback<void(QuotaStatusCode)> StatusCallback; | 30 typedef base::Callback<void(QuotaStatusCode)> StatusCallback; |
| 31 typedef base::Callback<void(const std::set<GURL>& origins, | 31 typedef base::Callback<void(const std::set<GURL>& origins, |
| 32 StorageType type)> GetOriginsCallback; | 32 StorageType type)> GetOriginsCallback; |
| 33 typedef base::Callback<void(const UsageInfoEntries&)> GetUsageInfoCallback; | 33 typedef base::Callback<void(const UsageInfoEntries&)> GetUsageInfoCallback; |
| 34 typedef base::Callback<void(QuotaStatusCode, bool)> GetDurabilityCallback; |
| 34 | 35 |
| 35 // Simple template wrapper for a callback queue. | 36 // Simple template wrapper for a callback queue. |
| 36 template <typename CallbackType, typename... Args> | 37 template <typename CallbackType, typename... Args> |
| 37 class CallbackQueue { | 38 class CallbackQueue { |
| 38 public: | 39 public: |
| 39 // Returns true if the given |callback| is the first one added to the queue. | 40 // Returns true if the given |callback| is the first one added to the queue. |
| 40 bool Add(const CallbackType& callback) { | 41 bool Add(const CallbackType& callback) { |
| 41 callbacks_.push_back(callback); | 42 callbacks_.push_back(callback); |
| 42 return (callbacks_.size() == 1); | 43 return (callbacks_.size() == 1); |
| 43 } | 44 } |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 queue.Run(base::internal::CallbackForward(args)...); | 101 queue.Run(base::internal::CallbackForward(args)...); |
| 101 } | 102 } |
| 102 | 103 |
| 103 private: | 104 private: |
| 104 CallbackMap callback_map_; | 105 CallbackMap callback_map_; |
| 105 }; | 106 }; |
| 106 | 107 |
| 107 } // namespace storage | 108 } // namespace storage |
| 108 | 109 |
| 109 #endif // STORAGE_QUOTA_QUOTA_TYPES_H_ | 110 #endif // STORAGE_QUOTA_QUOTA_TYPES_H_ |
| OLD | NEW |