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 #include "chrome/browser/history/thumbnail_database.h" | 5 #include "chrome/browser/history/thumbnail_database.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "app/sql/statement.h" | 10 #include "app/sql/statement.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 history_publisher_ = history_publisher; | 59 history_publisher_ = history_publisher; |
60 sql::InitStatus status = OpenDatabase(&db_, db_name); | 60 sql::InitStatus status = OpenDatabase(&db_, db_name); |
61 if (status != sql::INIT_OK) | 61 if (status != sql::INIT_OK) |
62 return status; | 62 return status; |
63 | 63 |
64 // Scope initialization in a transaction so we can't be partially initialized. | 64 // Scope initialization in a transaction so we can't be partially initialized. |
65 sql::Transaction transaction(&db_); | 65 sql::Transaction transaction(&db_); |
66 transaction.Begin(); | 66 transaction.Begin(); |
67 | 67 |
68 #if defined(OS_MACOSX) | 68 #if defined(OS_MACOSX) |
69 // Exclude the thumbnails file and its journal from backups. | 69 // Exclude the thumbnails file from backups. |
70 base::mac::SetFileBackupExclusion(db_name, true); | 70 base::mac::SetFileBackupExclusion(db_name); |
71 FilePath::StringType db_name_string(db_name.value()); | |
72 db_name_string += "-journal"; | |
73 FilePath db_journal_name(db_name_string); | |
74 base::mac::SetFileBackupExclusion(db_journal_name, true); | |
75 #endif | 71 #endif |
76 | 72 |
77 // Create the tables. | 73 // Create the tables. |
78 if (!meta_table_.Init(&db_, kCurrentVersionNumber, | 74 if (!meta_table_.Init(&db_, kCurrentVersionNumber, |
79 kCompatibleVersionNumber) || | 75 kCompatibleVersionNumber) || |
80 !InitThumbnailTable() || | 76 !InitThumbnailTable() || |
81 !InitFaviconsTable(&db_, false) || | 77 !InitFaviconsTable(&db_, false) || |
82 !InitIconMappingTable(&db_, false)) { | 78 !InitIconMappingTable(&db_, false)) { |
83 db_.Close(); | 79 db_.Close(); |
84 return sql::INIT_FAILURE; | 80 return sql::INIT_FAILURE; |
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 if (!db_.Execute("ALTER TABLE favicons ADD icon_type INTEGER DEFAULT 1")) { | 748 if (!db_.Execute("ALTER TABLE favicons ADD icon_type INTEGER DEFAULT 1")) { |
753 NOTREACHED(); | 749 NOTREACHED(); |
754 return false; | 750 return false; |
755 } | 751 } |
756 meta_table_.SetVersionNumber(4); | 752 meta_table_.SetVersionNumber(4); |
757 meta_table_.SetCompatibleVersionNumber(std::min(4, kCompatibleVersionNumber)); | 753 meta_table_.SetCompatibleVersionNumber(std::min(4, kCompatibleVersionNumber)); |
758 return true; | 754 return true; |
759 } | 755 } |
760 | 756 |
761 } // namespace history | 757 } // namespace history |
OLD | NEW |