| 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 // The history system runs on a background thread so that potentially slow | 5 // The history system runs on a background thread so that potentially slow |
| 6 // database operations don't delay the browser. This backend processing is | 6 // database operations don't delay the browser. This backend processing is |
| 7 // represented by HistoryBackend. The HistoryService's job is to dispatch to | 7 // represented by HistoryBackend. The HistoryService's job is to dispatch to |
| 8 // that thread. | 8 // that thread. |
| 9 // | 9 // |
| 10 // Main thread History thread | 10 // Main thread History thread |
| (...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 784 languages = prefs->GetString(prefs::kAcceptLanguages); | 784 languages = prefs->GetString(prefs::kAcceptLanguages); |
| 785 } | 785 } |
| 786 ScheduleAndForget(PRIORITY_UI, &HistoryBackend::Init, languages, no_db_); | 786 ScheduleAndForget(PRIORITY_UI, &HistoryBackend::Init, languages, no_db_); |
| 787 } | 787 } |
| 788 | 788 |
| 789 void HistoryService::OnDBLoaded() { | 789 void HistoryService::OnDBLoaded() { |
| 790 backend_loaded_ = true; | 790 backend_loaded_ = true; |
| 791 NotificationService::current()->Notify(NotificationType::HISTORY_LOADED, | 791 NotificationService::current()->Notify(NotificationType::HISTORY_LOADED, |
| 792 Source<Profile>(profile_), | 792 Source<Profile>(profile_), |
| 793 Details<HistoryService>(this)); | 793 Details<HistoryService>(this)); |
| 794 if (thread_ && profile_ && history::TopSites::IsEnabled()) { | 794 if (thread_ && profile_) { |
| 795 // We don't want to force creation of TopSites. | 795 // We don't want to force creation of TopSites. |
| 796 history::TopSites* ts = profile_->GetTopSitesWithoutCreating(); | 796 history::TopSites* ts = profile_->GetTopSitesWithoutCreating(); |
| 797 if (ts) | 797 if (ts) |
| 798 ts->HistoryLoaded(); | 798 ts->HistoryLoaded(); |
| 799 } | 799 } |
| 800 } | 800 } |
| 801 | 801 |
| 802 void HistoryService::StartTopSitesMigration() { | 802 void HistoryService::StartTopSitesMigration() { |
| 803 needs_top_sites_migration_ = true; | 803 needs_top_sites_migration_ = true; |
| 804 if (thread_ && profile_ && history::TopSites::IsEnabled()) { | 804 if (thread_ && profile_) { |
| 805 // We don't want to force creation of TopSites. | 805 // We don't want to force creation of TopSites. |
| 806 history::TopSites* ts = profile_->GetTopSitesWithoutCreating(); | 806 history::TopSites* ts = profile_->GetTopSitesWithoutCreating(); |
| 807 if (ts) | 807 if (ts) |
| 808 ts->MigrateFromHistory(); | 808 ts->MigrateFromHistory(); |
| 809 } | 809 } |
| 810 } | 810 } |
| 811 | 811 |
| 812 void HistoryService::OnTopSitesReady() { | 812 void HistoryService::OnTopSitesReady() { |
| 813 ScheduleAndForget(PRIORITY_NORMAL, | 813 ScheduleAndForget(PRIORITY_NORMAL, |
| 814 &HistoryBackend::MigrateThumbnailsDatabase); | 814 &HistoryBackend::MigrateThumbnailsDatabase); |
| 815 } | 815 } |
| OLD | NEW |