| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_UI_WEBUI_QUOTA_INTERNALS_QUOTA_INTERNALS_TYPES_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_QUOTA_INTERNALS_QUOTA_INTERNALS_TYPES_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_QUOTA_INTERNALS_QUOTA_INTERNALS_TYPES_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_QUOTA_INTERNALS_QUOTA_INTERNALS_TYPES_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <memory> |
| 11 #include <string> | 12 #include <string> |
| 12 | 13 |
| 13 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 14 #include "storage/common/quota/quota_types.h" | 15 #include "storage/common/quota/quota_types.h" |
| 15 #include "url/gurl.h" | 16 #include "url/gurl.h" |
| 16 | 17 |
| 17 namespace base { | 18 namespace base { |
| 18 class Value; | 19 class Value; |
| 19 } | 20 } |
| 20 | 21 |
| 21 namespace quota_internals { | 22 namespace quota_internals { |
| 22 | 23 |
| 23 // Represends global usage and quota information for specific type of storage. | 24 // Represends global usage and quota information for specific type of storage. |
| 24 class GlobalStorageInfo { | 25 class GlobalStorageInfo { |
| 25 public: | 26 public: |
| 26 explicit GlobalStorageInfo(storage::StorageType type); | 27 explicit GlobalStorageInfo(storage::StorageType type); |
| 27 ~GlobalStorageInfo(); | 28 ~GlobalStorageInfo(); |
| 28 | 29 |
| 29 void set_usage(int64_t usage) { usage_ = usage; } | 30 void set_usage(int64_t usage) { usage_ = usage; } |
| 30 | 31 |
| 31 void set_unlimited_usage(int64_t unlimited_usage) { | 32 void set_unlimited_usage(int64_t unlimited_usage) { |
| 32 unlimited_usage_ = unlimited_usage; | 33 unlimited_usage_ = unlimited_usage; |
| 33 } | 34 } |
| 34 | 35 |
| 35 void set_quota(int64_t quota) { quota_ = quota; } | 36 void set_quota(int64_t quota) { quota_ = quota; } |
| 36 | 37 |
| 37 // Create new Value for passing to WebUI page. Caller is responsible for | 38 // Create new Value for passing to WebUI page. |
| 38 // deleting the returned pointer. | 39 std::unique_ptr<base::Value> NewValue() const; |
| 39 base::Value* NewValue() const; | 40 |
| 40 private: | 41 private: |
| 41 storage::StorageType type_; | 42 storage::StorageType type_; |
| 42 | 43 |
| 43 int64_t usage_; | 44 int64_t usage_; |
| 44 int64_t unlimited_usage_; | 45 int64_t unlimited_usage_; |
| 45 int64_t quota_; | 46 int64_t quota_; |
| 46 }; | 47 }; |
| 47 | 48 |
| 48 // Represents per host usage and quota information for the storage. | 49 // Represents per host usage and quota information for the storage. |
| 49 class PerHostStorageInfo { | 50 class PerHostStorageInfo { |
| 50 public: | 51 public: |
| 51 PerHostStorageInfo(const std::string& host, storage::StorageType type); | 52 PerHostStorageInfo(const std::string& host, storage::StorageType type); |
| 52 ~PerHostStorageInfo(); | 53 ~PerHostStorageInfo(); |
| 53 | 54 |
| 54 void set_usage(int64_t usage) { usage_ = usage; } | 55 void set_usage(int64_t usage) { usage_ = usage; } |
| 55 | 56 |
| 56 void set_quota(int64_t quota) { quota_ = quota; } | 57 void set_quota(int64_t quota) { quota_ = quota; } |
| 57 | 58 |
| 58 // Create new Value for passing to WebUI page. Caller is responsible for | 59 // Create new Value for passing to WebUI page. |
| 59 // deleting the returned pointer. | 60 std::unique_ptr<base::Value> NewValue() const; |
| 60 base::Value* NewValue() const; | 61 |
| 61 private: | 62 private: |
| 62 std::string host_; | 63 std::string host_; |
| 63 storage::StorageType type_; | 64 storage::StorageType type_; |
| 64 | 65 |
| 65 int64_t usage_; | 66 int64_t usage_; |
| 66 int64_t quota_; | 67 int64_t quota_; |
| 67 }; | 68 }; |
| 68 | 69 |
| 69 // Represendts per origin usage and access time information. | 70 // Represendts per origin usage and access time information. |
| 70 class PerOriginStorageInfo { | 71 class PerOriginStorageInfo { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 82 } | 83 } |
| 83 | 84 |
| 84 void set_last_access_time(base::Time last_access_time) { | 85 void set_last_access_time(base::Time last_access_time) { |
| 85 last_access_time_ = last_access_time; | 86 last_access_time_ = last_access_time; |
| 86 } | 87 } |
| 87 | 88 |
| 88 void set_last_modified_time(base::Time last_modified_time) { | 89 void set_last_modified_time(base::Time last_modified_time) { |
| 89 last_modified_time_ = last_modified_time; | 90 last_modified_time_ = last_modified_time; |
| 90 } | 91 } |
| 91 | 92 |
| 92 // Create new Value for passing to WebUI page. Caller is responsible for | 93 // Create new Value for passing to WebUI page. |
| 93 // deleting the returned pointer. | 94 std::unique_ptr<base::Value> NewValue() const; |
| 94 base::Value* NewValue() const; | 95 |
| 95 private: | 96 private: |
| 96 GURL origin_; | 97 GURL origin_; |
| 97 storage::StorageType type_; | 98 storage::StorageType type_; |
| 98 std::string host_; | 99 std::string host_; |
| 99 | 100 |
| 100 int in_use_; | 101 int in_use_; |
| 101 int used_count_; | 102 int used_count_; |
| 102 base::Time last_access_time_; | 103 base::Time last_access_time_; |
| 103 base::Time last_modified_time_; | 104 base::Time last_modified_time_; |
| 104 }; | 105 }; |
| 105 } // namespace quota_internals | 106 } // namespace quota_internals |
| 106 | 107 |
| 107 #endif // CHROME_BROWSER_UI_WEBUI_QUOTA_INTERNALS_QUOTA_INTERNALS_TYPES_H_ | 108 #endif // CHROME_BROWSER_UI_WEBUI_QUOTA_INTERNALS_QUOTA_INTERNALS_TYPES_H_ |
| OLD | NEW |