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 WEBKIT_BROWSER_QUOTA_QUOTA_DATABASE_H_ | 5 #ifndef WEBKIT_BROWSER_QUOTA_QUOTA_DATABASE_H_ |
6 #define WEBKIT_BROWSER_QUOTA_QUOTA_DATABASE_H_ | 6 #define WEBKIT_BROWSER_QUOTA_QUOTA_DATABASE_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/time.h" | 16 #include "base/time.h" |
17 #include "base/timer.h" | 17 #include "base/timer.h" |
18 #include "googleurl/src/gurl.h" | 18 #include "googleurl/src/gurl.h" |
| 19 #include "webkit/browser/webkit_storage_browser_export.h" |
19 #include "webkit/common/quota/quota_types.h" | 20 #include "webkit/common/quota/quota_types.h" |
20 #include "webkit/storage/webkit_storage_export.h" | |
21 | 21 |
22 namespace sql { | 22 namespace sql { |
23 class Connection; | 23 class Connection; |
24 class MetaTable; | 24 class MetaTable; |
25 } | 25 } |
26 | 26 |
27 class GURL; | 27 class GURL; |
28 | 28 |
29 namespace quota { | 29 namespace quota { |
30 | 30 |
31 class SpecialStoragePolicy; | 31 class SpecialStoragePolicy; |
32 | 32 |
33 // All the methods of this class must run on the DB thread. | 33 // All the methods of this class must run on the DB thread. |
34 class WEBKIT_STORAGE_EXPORT_PRIVATE QuotaDatabase { | 34 class WEBKIT_STORAGE_BROWSER_EXPORT_PRIVATE QuotaDatabase { |
35 public: | 35 public: |
36 // Constants for {Get,Set}QuotaConfigValue keys. | 36 // Constants for {Get,Set}QuotaConfigValue keys. |
37 static const char kDesiredAvailableSpaceKey[]; | 37 static const char kDesiredAvailableSpaceKey[]; |
38 static const char kTemporaryQuotaOverrideKey[]; | 38 static const char kTemporaryQuotaOverrideKey[]; |
39 | 39 |
40 // If 'path' is empty, an in memory database will be used. | 40 // If 'path' is empty, an in memory database will be used. |
41 explicit QuotaDatabase(const base::FilePath& path); | 41 explicit QuotaDatabase(const base::FilePath& path); |
42 ~QuotaDatabase(); | 42 ~QuotaDatabase(); |
43 | 43 |
44 void CloseConnection(); | 44 void CloseConnection(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 std::set<GURL>* origins, | 81 std::set<GURL>* origins, |
82 base::Time modified_since); | 82 base::Time modified_since); |
83 | 83 |
84 // Returns false if SetOriginDatabaseBootstrapped has never | 84 // Returns false if SetOriginDatabaseBootstrapped has never |
85 // been called before, which means existing origins may not have been | 85 // been called before, which means existing origins may not have been |
86 // registered. | 86 // registered. |
87 bool IsOriginDatabaseBootstrapped(); | 87 bool IsOriginDatabaseBootstrapped(); |
88 bool SetOriginDatabaseBootstrapped(bool bootstrap_flag); | 88 bool SetOriginDatabaseBootstrapped(bool bootstrap_flag); |
89 | 89 |
90 private: | 90 private: |
91 struct WEBKIT_STORAGE_EXPORT_PRIVATE QuotaTableEntry { | 91 struct WEBKIT_STORAGE_BROWSER_EXPORT_PRIVATE QuotaTableEntry { |
92 QuotaTableEntry(); | 92 QuotaTableEntry(); |
93 QuotaTableEntry( | 93 QuotaTableEntry( |
94 const std::string& host, | 94 const std::string& host, |
95 StorageType type, | 95 StorageType type, |
96 int64 quota); | 96 int64 quota); |
97 std::string host; | 97 std::string host; |
98 StorageType type; | 98 StorageType type; |
99 int64 quota; | 99 int64 quota; |
100 }; | 100 }; |
101 friend WEBKIT_STORAGE_EXPORT_PRIVATE bool operator <( | 101 friend WEBKIT_STORAGE_BROWSER_EXPORT_PRIVATE bool operator <( |
102 const QuotaTableEntry& lhs, const QuotaTableEntry& rhs); | 102 const QuotaTableEntry& lhs, const QuotaTableEntry& rhs); |
103 | 103 |
104 struct WEBKIT_STORAGE_EXPORT_PRIVATE OriginInfoTableEntry { | 104 struct WEBKIT_STORAGE_BROWSER_EXPORT_PRIVATE OriginInfoTableEntry { |
105 OriginInfoTableEntry(); | 105 OriginInfoTableEntry(); |
106 OriginInfoTableEntry( | 106 OriginInfoTableEntry( |
107 const GURL& origin, | 107 const GURL& origin, |
108 StorageType type, | 108 StorageType type, |
109 int used_count, | 109 int used_count, |
110 const base::Time& last_access_time, | 110 const base::Time& last_access_time, |
111 const base::Time& last_modified_time); | 111 const base::Time& last_modified_time); |
112 GURL origin; | 112 GURL origin; |
113 StorageType type; | 113 StorageType type; |
114 int used_count; | 114 int used_count; |
115 base::Time last_access_time; | 115 base::Time last_access_time; |
116 base::Time last_modified_time; | 116 base::Time last_modified_time; |
117 }; | 117 }; |
118 friend WEBKIT_STORAGE_EXPORT_PRIVATE bool operator <( | 118 friend WEBKIT_STORAGE_BROWSER_EXPORT_PRIVATE bool operator <( |
119 const OriginInfoTableEntry& lhs, const OriginInfoTableEntry& rhs); | 119 const OriginInfoTableEntry& lhs, const OriginInfoTableEntry& rhs); |
120 | 120 |
121 // Structures used for CreateSchema. | 121 // Structures used for CreateSchema. |
122 struct TableSchema { | 122 struct TableSchema { |
123 const char* table_name; | 123 const char* table_name; |
124 const char* columns; | 124 const char* columns; |
125 }; | 125 }; |
126 struct IndexSchema { | 126 struct IndexSchema { |
127 const char* index_name; | 127 const char* index_name; |
128 const char* table_name; | 128 const char* table_name; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 | 177 |
178 static const TableSchema kTables[]; | 178 static const TableSchema kTables[]; |
179 static const IndexSchema kIndexes[]; | 179 static const IndexSchema kIndexes[]; |
180 | 180 |
181 DISALLOW_COPY_AND_ASSIGN(QuotaDatabase); | 181 DISALLOW_COPY_AND_ASSIGN(QuotaDatabase); |
182 }; | 182 }; |
183 | 183 |
184 } // namespace quota | 184 } // namespace quota |
185 | 185 |
186 #endif // WEBKIT_BROWSER_QUOTA_QUOTA_DATABASE_H_ | 186 #endif // WEBKIT_BROWSER_QUOTA_QUOTA_DATABASE_H_ |
OLD | NEW |