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 "chrome/browser/history/history_backend.h" | 5 #include "chrome/browser/history/history_backend.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 if (db_->needs_version_17_migration()) { | 576 if (db_->needs_version_17_migration()) { |
577 // See needs_version_17_migration() decl for more. In this case, we want | 577 // See needs_version_17_migration() decl for more. In this case, we want |
578 // to erase all the text database files. This must be done after the text | 578 // to erase all the text database files. This must be done after the text |
579 // database manager has been initialized, since it knows about all the | 579 // database manager has been initialized, since it knows about all the |
580 // files it manages. | 580 // files it manages. |
581 text_database_->DeleteAll(); | 581 text_database_->DeleteAll(); |
582 } | 582 } |
583 | 583 |
584 // Thumbnail database. | 584 // Thumbnail database. |
585 thumbnail_db_.reset(new ThumbnailDatabase()); | 585 thumbnail_db_.reset(new ThumbnailDatabase()); |
586 if (history::TopSites::IsEnabled() && !db_->GetNeedsThumbnailMigration()) { | 586 if (!db_->GetNeedsThumbnailMigration()) { |
587 // No convertion needed - use new filename right away. | 587 // No convertion needed - use new filename right away. |
588 thumbnail_name = GetFaviconsFileName(); | 588 thumbnail_name = GetFaviconsFileName(); |
589 } | 589 } |
590 if (thumbnail_db_->Init(thumbnail_name, | 590 if (thumbnail_db_->Init(thumbnail_name, |
591 history_publisher_.get()) != sql::INIT_OK) { | 591 history_publisher_.get()) != sql::INIT_OK) { |
592 // Unlike the main database, we don't error out when the database is too | 592 // Unlike the main database, we don't error out when the database is too |
593 // new because this error is much less severe. Generally, this shouldn't | 593 // new because this error is much less severe. Generally, this shouldn't |
594 // happen since the thumbnail and main datbase versions should be in sync. | 594 // happen since the thumbnail and main datbase versions should be in sync. |
595 // We'll just continue without thumbnails & favicons in this case or any | 595 // We'll just continue without thumbnails & favicons in this case or any |
596 // other error. | 596 // other error. |
597 LOG(WARNING) << "Could not initialize the thumbnail database."; | 597 LOG(WARNING) << "Could not initialize the thumbnail database."; |
598 thumbnail_db_.reset(); | 598 thumbnail_db_.reset(); |
599 } | 599 } |
600 | 600 |
601 if (history::TopSites::IsEnabled() && db_->GetNeedsThumbnailMigration()) { | 601 if (db_->GetNeedsThumbnailMigration()) { |
602 VLOG(1) << "Starting TopSites migration"; | 602 VLOG(1) << "Starting TopSites migration"; |
603 delegate_->StartTopSitesMigration(); | 603 delegate_->StartTopSitesMigration(); |
604 } | 604 } |
605 | 605 |
606 // Archived database. | 606 // Archived database. |
607 if (db_->needs_version_17_migration()) { | 607 if (db_->needs_version_17_migration()) { |
608 // See needs_version_17_migration() decl for more. In this case, we want | 608 // See needs_version_17_migration() decl for more. In this case, we want |
609 // to delete the archived database and need to do so before we try to | 609 // to delete the archived database and need to do so before we try to |
610 // open the file. We can ignore any error (maybe the file doesn't exist). | 610 // open the file. We can ignore any error (maybe the file doesn't exist). |
611 file_util::Delete(archived_name, false); | 611 file_util::Delete(archived_name, false); |
(...skipping 1572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2184 return true; | 2184 return true; |
2185 } | 2185 } |
2186 | 2186 |
2187 BookmarkService* HistoryBackend::GetBookmarkService() { | 2187 BookmarkService* HistoryBackend::GetBookmarkService() { |
2188 if (bookmark_service_) | 2188 if (bookmark_service_) |
2189 bookmark_service_->BlockTillLoaded(); | 2189 bookmark_service_->BlockTillLoaded(); |
2190 return bookmark_service_; | 2190 return bookmark_service_; |
2191 } | 2191 } |
2192 | 2192 |
2193 } // namespace history | 2193 } // namespace history |
OLD | NEW |