OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 db->set_exclusive_locking(); | 116 db->set_exclusive_locking(); |
117 | 117 |
118 if (!db->Open(db_name)) | 118 if (!db->Open(db_name)) |
119 return sql::INIT_FAILURE; | 119 return sql::INIT_FAILURE; |
120 | 120 |
121 return sql::INIT_OK; | 121 return sql::INIT_OK; |
122 } | 122 } |
123 | 123 |
124 bool ThumbnailDatabase::InitThumbnailTable() { | 124 bool ThumbnailDatabase::InitThumbnailTable() { |
125 if (!db_.DoesTableExist("thumbnails")) { | 125 if (!db_.DoesTableExist("thumbnails")) { |
126 if (history::TopSites::IsEnabled()) { | 126 use_top_sites_ = true; |
127 use_top_sites_ = true; | |
128 return true; | |
129 } | |
130 if (!db_.Execute("CREATE TABLE thumbnails (" | |
131 "url_id INTEGER PRIMARY KEY," | |
132 "boring_score DOUBLE DEFAULT 1.0," | |
133 "good_clipping INTEGER DEFAULT 0," | |
134 "at_top INTEGER DEFAULT 0," | |
135 "last_updated INTEGER DEFAULT 0," | |
136 "data BLOB)")) | |
137 return false; | |
138 } | 127 } |
139 return true; | 128 return true; |
140 } | 129 } |
141 | 130 |
142 bool ThumbnailDatabase::UpgradeToVersion3() { | 131 bool ThumbnailDatabase::UpgradeToVersion3() { |
143 if (use_top_sites_) { | 132 if (use_top_sites_) { |
144 meta_table_.SetVersionNumber(3); | 133 meta_table_.SetVersionNumber(3); |
145 meta_table_.SetCompatibleVersionNumber( | 134 meta_table_.SetCompatibleVersionNumber( |
146 std::min(3, kCompatibleVersionNumber)); | 135 std::min(3, kCompatibleVersionNumber)); |
147 return true; // Not needed after migration to TopSites. | 136 return true; // Not needed after migration to TopSites. |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 | 532 |
544 InitFavIconsIndex(); | 533 InitFavIconsIndex(); |
545 | 534 |
546 // Reopen the transaction. | 535 // Reopen the transaction. |
547 BeginTransaction(); | 536 BeginTransaction(); |
548 use_top_sites_ = true; | 537 use_top_sites_ = true; |
549 return true; | 538 return true; |
550 } | 539 } |
551 | 540 |
552 } // namespace history | 541 } // namespace history |
OLD | NEW |