| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_HISTORY_THUMBNAIL_DATABASE_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_THUMBNAIL_DATABASE_H_ |
| 6 #define CHROME_BROWSER_HISTORY_THUMBNAIL_DATABASE_H_ | 6 #define CHROME_BROWSER_HISTORY_THUMBNAIL_DATABASE_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 // Renames the database file and drops the Thumbnails table. | 250 // Renames the database file and drops the Thumbnails table. |
| 251 bool RenameAndDropThumbnails(const FilePath& old_db_file, | 251 bool RenameAndDropThumbnails(const FilePath& old_db_file, |
| 252 const FilePath& new_db_file); | 252 const FilePath& new_db_file); |
| 253 | 253 |
| 254 private: | 254 private: |
| 255 friend class ExpireHistoryBackend; | 255 friend class ExpireHistoryBackend; |
| 256 FRIEND_TEST_ALL_PREFIXES(ThumbnailDatabaseTest, | 256 FRIEND_TEST_ALL_PREFIXES(ThumbnailDatabaseTest, |
| 257 GetFaviconAfterMigrationToTopSites); | 257 GetFaviconAfterMigrationToTopSites); |
| 258 FRIEND_TEST_ALL_PREFIXES(ThumbnailDatabaseTest, UpgradeToVersion4); | 258 FRIEND_TEST_ALL_PREFIXES(ThumbnailDatabaseTest, UpgradeToVersion4); |
| 259 FRIEND_TEST_ALL_PREFIXES(ThumbnailDatabaseTest, UpgradeToVersion5); | 259 FRIEND_TEST_ALL_PREFIXES(ThumbnailDatabaseTest, UpgradeToVersion5); |
| 260 FRIEND_TEST_ALL_PREFIXES(ThumbnailDatabaseTest, UpgradeToVersion6); |
| 260 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MigrationIconMapping); | 261 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MigrationIconMapping); |
| 261 | 262 |
| 262 // Creates the thumbnail table, returning true if the table already exists | 263 // Creates the thumbnail table, returning true if the table already exists |
| 263 // or was successfully created. | 264 // or was successfully created. |
| 264 bool InitThumbnailTable(); | 265 bool InitThumbnailTable(); |
| 265 | 266 |
| 266 // Creates the favicon table, returning true if the table already exists, | 267 // Creates the favicon table, returning true if the table already exists, |
| 267 // or was successfully created. |is_temporary| will be false when generating | 268 // or was successfully created. |is_temporary| will be false when generating |
| 268 // the "regular" favicons table. The expirer sets this to true to generate the | 269 // the "regular" favicons table. The expirer sets this to true to generate the |
| 269 // temporary table, which will have a different name but the same schema. | 270 // temporary table, which will have a different name but the same schema. |
| 270 // |db| is the connection to use for initializing the table. | 271 // |db| is the connection to use for initializing the table. |
| 271 // A different connection is used in RenameAndDropThumbnails, when we | 272 // A different connection is used in RenameAndDropThumbnails, when we |
| 272 // need to copy the favicons between two database files. | 273 // need to copy the favicons between two database files. |
| 273 bool InitFaviconsTable(sql::Connection* db, bool is_temporary); | 274 bool InitFaviconsTable(sql::Connection* db, bool is_temporary); |
| 274 | 275 |
| 275 // Helper function to handle cleanup on upgrade failures. | 276 // Helper function to handle cleanup on upgrade failures. |
| 276 sql::InitStatus CantUpgradeToVersion(int cur_version); | 277 sql::InitStatus CantUpgradeToVersion(int cur_version); |
| 277 | 278 |
| 278 // Adds support for the new metadata on web page thumbnails. | 279 // Adds support for the new metadata on web page thumbnails. |
| 279 bool UpgradeToVersion3(); | 280 bool UpgradeToVersion3(); |
| 280 | 281 |
| 281 // Adds support for the icon_type in favicon table. | 282 // Adds support for the icon_type in favicon table. |
| 282 bool UpgradeToVersion4(); | 283 bool UpgradeToVersion4(); |
| 283 | 284 |
| 284 // Adds support for sizes in favicon table. | 285 // Adds support for sizes in favicon table. |
| 285 bool UpgradeToVersion5(); | 286 bool UpgradeToVersion5(); |
| 286 | 287 |
| 288 // Adds support for size in favicons table and removes sizes column. |
| 289 bool UpgradeToVersion6(); |
| 290 |
| 287 // Migrates the icon mapping data from URL database to Thumbnail database. | 291 // Migrates the icon mapping data from URL database to Thumbnail database. |
| 288 // Return whether the migration succeeds. | 292 // Return whether the migration succeeds. |
| 289 bool MigrateIconMappingData(URLDatabase* url_db); | 293 bool MigrateIconMappingData(URLDatabase* url_db); |
| 290 | 294 |
| 291 // Creates the index over the favicon table. This will be called during | 295 // Creates the index over the favicon table. This will be called during |
| 292 // initialization after the table is created. This is a separate function | 296 // initialization after the table is created. This is a separate function |
| 293 // because it is used by SwapFaviconTables to create an index over the | 297 // because it is used by SwapFaviconTables to create an index over the |
| 294 // newly-renamed favicons table (formerly the temporary table with no index). | 298 // newly-renamed favicons table (formerly the temporary table with no index). |
| 295 bool InitFaviconsIndex(); | 299 bool InitFaviconsIndex(); |
| 296 | 300 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 325 const HistoryPublisher* history_publisher_; | 329 const HistoryPublisher* history_publisher_; |
| 326 | 330 |
| 327 // True if migration to TopSites has been done and the thumbnails | 331 // True if migration to TopSites has been done and the thumbnails |
| 328 // table should not be used. | 332 // table should not be used. |
| 329 bool use_top_sites_; | 333 bool use_top_sites_; |
| 330 }; | 334 }; |
| 331 | 335 |
| 332 } // namespace history | 336 } // namespace history |
| 333 | 337 |
| 334 #endif // CHROME_BROWSER_HISTORY_THUMBNAIL_DATABASE_H_ | 338 #endif // CHROME_BROWSER_HISTORY_THUMBNAIL_DATABASE_H_ |
| OLD | NEW |