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 WEBKIT_QUOTA_QUOTA_DATABASE_H_ | 5 #ifndef WEBKIT_QUOTA_QUOTA_DATABASE_H_ |
6 #define WEBKIT_QUOTA_QUOTA_DATABASE_H_ | 6 #define WEBKIT_QUOTA_QUOTA_DATABASE_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
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_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 FilePath& path); | 41 explicit QuotaDatabase(const base::FilePath& path); |
42 ~QuotaDatabase(); | 42 ~QuotaDatabase(); |
43 | 43 |
44 void CloseConnection(); | 44 void CloseConnection(); |
45 | 45 |
46 bool GetHostQuota(const std::string& host, StorageType type, int64* quota); | 46 bool GetHostQuota(const std::string& host, StorageType type, int64* quota); |
47 bool SetHostQuota(const std::string& host, StorageType type, int64 quota); | 47 bool SetHostQuota(const std::string& host, StorageType type, int64 quota); |
48 bool DeleteHostQuota(const std::string& host, StorageType type); | 48 bool DeleteHostQuota(const std::string& host, StorageType type); |
49 | 49 |
50 bool SetOriginLastAccessTime(const GURL& origin, | 50 bool SetOriginLastAccessTime(const GURL& origin, |
51 StorageType type, | 51 StorageType type, |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 sql::Connection* database, | 156 sql::Connection* database, |
157 sql::MetaTable* meta_table, | 157 sql::MetaTable* meta_table, |
158 int schema_version, int compatible_version, | 158 int schema_version, int compatible_version, |
159 const TableSchema* tables, size_t tables_size, | 159 const TableSchema* tables, size_t tables_size, |
160 const IndexSchema* indexes, size_t indexes_size); | 160 const IndexSchema* indexes, size_t indexes_size); |
161 | 161 |
162 // |callback| may return false to stop reading data. | 162 // |callback| may return false to stop reading data. |
163 bool DumpQuotaTable(QuotaTableCallback* callback); | 163 bool DumpQuotaTable(QuotaTableCallback* callback); |
164 bool DumpOriginInfoTable(OriginInfoTableCallback* callback); | 164 bool DumpOriginInfoTable(OriginInfoTableCallback* callback); |
165 | 165 |
166 FilePath db_file_path_; | 166 base::FilePath db_file_path_; |
167 | 167 |
168 scoped_ptr<sql::Connection> db_; | 168 scoped_ptr<sql::Connection> db_; |
169 scoped_ptr<sql::MetaTable> meta_table_; | 169 scoped_ptr<sql::MetaTable> meta_table_; |
170 bool is_recreating_; | 170 bool is_recreating_; |
171 bool is_disabled_; | 171 bool is_disabled_; |
172 | 172 |
173 base::OneShotTimer<QuotaDatabase> timer_; | 173 base::OneShotTimer<QuotaDatabase> timer_; |
174 | 174 |
175 friend class QuotaDatabaseTest; | 175 friend class QuotaDatabaseTest; |
176 friend class QuotaManager; | 176 friend class QuotaManager; |
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_QUOTA_QUOTA_DATABASE_H_ | 186 #endif // WEBKIT_QUOTA_QUOTA_DATABASE_H_ |
OLD | NEW |