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 // 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 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
860 bookmark_service_)); | 860 bookmark_service_)); |
861 history_backend_.swap(backend); | 861 history_backend_.swap(backend); |
862 | 862 |
863 // There may not be a profile when unit testing. | 863 // There may not be a profile when unit testing. |
864 std::string languages; | 864 std::string languages; |
865 if (profile_) { | 865 if (profile_) { |
866 PrefService* prefs = profile_->GetPrefs(); | 866 PrefService* prefs = profile_->GetPrefs(); |
867 languages = prefs->GetString(prefs::kAcceptLanguages); | 867 languages = prefs->GetString(prefs::kAcceptLanguages); |
868 } | 868 } |
869 ScheduleAndForget(PRIORITY_UI, &HistoryBackend::Init, languages, no_db_); | 869 ScheduleAndForget(PRIORITY_UI, &HistoryBackend::Init, languages, no_db_); |
| 870 |
| 871 // Create a WebHistoryService instance for this profile. This is used to |
| 872 // fetch visits from other devices from Google Web History. |
| 873 history::WebHistoryService::GetForProfile(profile_); |
870 } | 874 } |
871 | 875 |
872 void HistoryService::OnDBLoaded(int backend_id) { | 876 void HistoryService::OnDBLoaded(int backend_id) { |
873 if (!history_backend_ || current_backend_id_ != backend_id) { | 877 if (!history_backend_ || current_backend_id_ != backend_id) { |
874 VLOG(1) << "Message from obsolete backend"; | 878 VLOG(1) << "Message from obsolete backend"; |
875 return; | 879 return; |
876 } | 880 } |
877 backend_loaded_ = true; | 881 backend_loaded_ = true; |
878 content::NotificationService::current()->Notify( | 882 content::NotificationService::current()->Notify( |
879 chrome::NOTIFICATION_HISTORY_LOADED, | 883 chrome::NOTIFICATION_HISTORY_LOADED, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
914 void HistoryService::RemoveVisitDatabaseObserver( | 918 void HistoryService::RemoveVisitDatabaseObserver( |
915 history::VisitDatabaseObserver* observer) { | 919 history::VisitDatabaseObserver* observer) { |
916 visit_database_observers_->RemoveObserver(observer); | 920 visit_database_observers_->RemoveObserver(observer); |
917 } | 921 } |
918 | 922 |
919 void HistoryService::NotifyVisitDBObserversOnAddVisit( | 923 void HistoryService::NotifyVisitDBObserversOnAddVisit( |
920 const history::BriefVisitInfo& info) { | 924 const history::BriefVisitInfo& info) { |
921 visit_database_observers_->Notify( | 925 visit_database_observers_->Notify( |
922 &history::VisitDatabaseObserver::OnAddVisit, info); | 926 &history::VisitDatabaseObserver::OnAddVisit, info); |
923 } | 927 } |
OLD | NEW |