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 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1220 // backend has allocated for us. The receiver of the notification will cast | 1220 // backend has allocated for us. The receiver of the notification will cast |
1221 // this to the proper type. | 1221 // this to the proper type. |
1222 content::Details<history::HistoryDetails> det(details.get()); | 1222 content::Details<history::HistoryDetails> det(details.get()); |
1223 | 1223 |
1224 content::NotificationService::current()->Notify(type, source, det); | 1224 content::NotificationService::current()->Notify(type, source, det); |
1225 } | 1225 } |
1226 | 1226 |
1227 void HistoryService::OnDBLoaded() { | 1227 void HistoryService::OnDBLoaded() { |
1228 DCHECK(thread_checker_.CalledOnValidThread()); | 1228 DCHECK(thread_checker_.CalledOnValidThread()); |
1229 backend_loaded_ = true; | 1229 backend_loaded_ = true; |
1230 content::NotificationService::current()->Notify( | 1230 NotifyHistoryServiceLoaded(); |
1231 chrome::NOTIFICATION_HISTORY_LOADED, | |
1232 content::Source<Profile>(profile_), | |
1233 content::Details<HistoryService>(this)); | |
1234 } | 1231 } |
1235 | 1232 |
1236 bool HistoryService::GetRowForURL(const GURL& url, history::URLRow* url_row) { | 1233 bool HistoryService::GetRowForURL(const GURL& url, history::URLRow* url_row) { |
1237 DCHECK(thread_checker_.CalledOnValidThread()); | 1234 DCHECK(thread_checker_.CalledOnValidThread()); |
1238 history::URLDatabase* db = InMemoryDatabase(); | 1235 history::URLDatabase* db = InMemoryDatabase(); |
1239 return db && (db->GetRowForURL(url, url_row) != 0); | 1236 return db && (db->GetRowForURL(url, url_row) != 0); |
1240 } | 1237 } |
1241 | 1238 |
1242 void HistoryService::NotifyAddVisit(const history::BriefVisitInfo& info) { | 1239 void HistoryService::NotifyAddVisit(const history::BriefVisitInfo& info) { |
1243 DCHECK(thread_checker_.CalledOnValidThread()); | 1240 DCHECK(thread_checker_.CalledOnValidThread()); |
(...skipping 16 matching lines...) Expand all Loading... |
1260 const HistoryService::OnFaviconChangedCallback& callback) { | 1257 const HistoryService::OnFaviconChangedCallback& callback) { |
1261 DCHECK(thread_checker_.CalledOnValidThread()); | 1258 DCHECK(thread_checker_.CalledOnValidThread()); |
1262 return favicon_changed_callback_list_.Add(callback); | 1259 return favicon_changed_callback_list_.Add(callback); |
1263 } | 1260 } |
1264 | 1261 |
1265 void HistoryService::NotifyFaviconChanged( | 1262 void HistoryService::NotifyFaviconChanged( |
1266 const std::set<GURL>& changed_favicons) { | 1263 const std::set<GURL>& changed_favicons) { |
1267 DCHECK(thread_checker_.CalledOnValidThread()); | 1264 DCHECK(thread_checker_.CalledOnValidThread()); |
1268 favicon_changed_callback_list_.Notify(changed_favicons); | 1265 favicon_changed_callback_list_.Notify(changed_favicons); |
1269 } | 1266 } |
| 1267 |
| 1268 void HistoryService::NotifyHistoryServiceLoaded() { |
| 1269 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1270 FOR_EACH_OBSERVER(history::HistoryServiceObserver, |
| 1271 observers_, |
| 1272 OnHistoryServiceLoaded(this)); |
| 1273 } |
OLD | NEW |