OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "webkit/database/database_tracker.h" | 5 #include "webkit/database/database_tracker.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "app/sql/connection.h" | 9 #include "app/sql/connection.h" |
10 #include "app/sql/meta_table.h" | 10 #include "app/sql/meta_table.h" |
11 #include "app/sql/statement.h" | 11 #include "app/sql/statement.h" |
12 #include "app/sql/transaction.h" | 12 #include "app/sql/transaction.h" |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/file_path.h" | 14 #include "base/file_path.h" |
15 #include "base/file_util.h" | 15 #include "base/file_util.h" |
16 #include "base/string_util.h" | 16 #include "base/string_util.h" |
17 #include "net/base/net_errors.h" | 17 #include "net/base/net_errors.h" |
18 #include "webkit/database/databases_table.h" | 18 #include "webkit/database/databases_table.h" |
19 #include "webkit/database/quota_table.h" | 19 #include "webkit/database/quota_table.h" |
20 #include "webkit/glue/webkit_glue.h" | 20 #include "webkit/glue/webkit_glue.h" |
21 | 21 |
22 namespace webkit_database { | 22 namespace webkit_database { |
23 | 23 |
24 const FilePath::CharType kDatabaseDirectoryName[] = | 24 const FilePath::CharType kDatabaseDirectoryName[] = |
25 FILE_PATH_LITERAL("databases"); | 25 FILE_PATH_LITERAL("databases"); |
26 const FilePath::CharType kTrackerDatabaseFileName[] = | 26 const FilePath::CharType kTrackerDatabaseFileName[] = |
27 FILE_PATH_LITERAL("Databases.db"); | 27 FILE_PATH_LITERAL("Databases.db"); |
28 const int kCurrentVersion = 2; | 28 const int kCurrentVersion = 2; |
29 const int kCompatibleVersion = 1; | 29 const int kCompatibleVersion = 1; |
30 const int64 kDefaultExtensionQuota = 50 * 1024 * 1024; | 30 const int64 kDefaultExtensionQuota = 1024 * 1024 * 1024; |
31 const char* kExtensionOriginIdentifierPrefix = "chrome-extension_"; | 31 const char* kExtensionOriginIdentifierPrefix = "chrome-extension_"; |
32 | 32 |
33 DatabaseTracker::DatabaseTracker(const FilePath& profile_path) | 33 DatabaseTracker::DatabaseTracker(const FilePath& profile_path) |
34 : initialized_(false), | 34 : initialized_(false), |
35 db_dir_(profile_path.Append(FilePath(kDatabaseDirectoryName))), | 35 db_dir_(profile_path.Append(FilePath(kDatabaseDirectoryName))), |
36 db_(new sql::Connection()), | 36 db_(new sql::Connection()), |
37 databases_table_(NULL), | 37 databases_table_(NULL), |
38 meta_table_(NULL), | 38 meta_table_(NULL), |
39 default_quota_(5 * 1024 * 1024) { | 39 default_quota_(5 * 1024 * 1024) { |
40 } | 40 } |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 file_path = file_enumerator.Next()) { | 510 file_path = file_enumerator.Next()) { |
511 if (file_path.BaseName() != FilePath(kTrackerDatabaseFileName)) { | 511 if (file_path.BaseName() != FilePath(kTrackerDatabaseFileName)) { |
512 if (!StartsWith(file_path.BaseName().ToWStringHack(), | 512 if (!StartsWith(file_path.BaseName().ToWStringHack(), |
513 ASCIIToWide(kExtensionOriginIdentifierPrefix), true)) | 513 ASCIIToWide(kExtensionOriginIdentifierPrefix), true)) |
514 file_util::Delete(file_path, true); | 514 file_util::Delete(file_path, true); |
515 } | 515 } |
516 } | 516 } |
517 } | 517 } |
518 | 518 |
519 } // namespace webkit_database | 519 } // namespace webkit_database |
OLD | NEW |