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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 base::Time visit_time) override { | 174 base::Time visit_time) override { |
175 service_task_runner_->PostTask(FROM_HERE, | 175 service_task_runner_->PostTask(FROM_HERE, |
176 base::Bind(&HistoryService::NotifyURLVisited, | 176 base::Bind(&HistoryService::NotifyURLVisited, |
177 history_service_, | 177 history_service_, |
178 transition, | 178 transition, |
179 row, | 179 row, |
180 redirects, | 180 redirects, |
181 visit_time)); | 181 visit_time)); |
182 } | 182 } |
183 | 183 |
| 184 void NotifyURLsModified(const history::URLRows& changed_urls) override { |
| 185 service_task_runner_->PostTask( |
| 186 FROM_HERE, |
| 187 base::Bind(&HistoryService::NotifyURLsModified, |
| 188 history_service_, |
| 189 changed_urls)); |
| 190 } |
| 191 |
184 void BroadcastNotifications( | 192 void BroadcastNotifications( |
185 int type, | 193 int type, |
186 scoped_ptr<history::HistoryDetails> details) override { | 194 scoped_ptr<history::HistoryDetails> details) override { |
187 // Send the notification on the history thread. | 195 // Send the notification on the history thread. |
188 if (content::NotificationService::current()) { | 196 if (content::NotificationService::current()) { |
189 content::Details<history::HistoryDetails> det(details.get()); | 197 content::Details<history::HistoryDetails> det(details.get()); |
190 content::NotificationService::current()->Notify( | 198 content::NotificationService::current()->Notify( |
191 type, content::Source<Profile>(profile_), det); | 199 type, content::Source<Profile>(profile_), det); |
192 } | 200 } |
193 // Send the notification to the history service on the main thread. | 201 // Send the notification to the history service on the main thread. |
(...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1247 void HistoryService::NotifyURLVisited(ui::PageTransition transition, | 1255 void HistoryService::NotifyURLVisited(ui::PageTransition transition, |
1248 const history::URLRow& row, | 1256 const history::URLRow& row, |
1249 const history::RedirectList& redirects, | 1257 const history::RedirectList& redirects, |
1250 base::Time visit_time) { | 1258 base::Time visit_time) { |
1251 DCHECK(thread_checker_.CalledOnValidThread()); | 1259 DCHECK(thread_checker_.CalledOnValidThread()); |
1252 FOR_EACH_OBSERVER(history::HistoryServiceObserver, | 1260 FOR_EACH_OBSERVER(history::HistoryServiceObserver, |
1253 observers_, | 1261 observers_, |
1254 OnURLVisited(this, transition, row, redirects, visit_time)); | 1262 OnURLVisited(this, transition, row, redirects, visit_time)); |
1255 } | 1263 } |
1256 | 1264 |
| 1265 void HistoryService::NotifyURLsModified(const history::URLRows& changed_urls) { |
| 1266 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1267 FOR_EACH_OBSERVER(history::HistoryServiceObserver, |
| 1268 observers_, |
| 1269 OnURLsModified(this, changed_urls)); |
| 1270 } |
| 1271 |
1257 scoped_ptr<base::CallbackList<void(const std::set<GURL>&)>::Subscription> | 1272 scoped_ptr<base::CallbackList<void(const std::set<GURL>&)>::Subscription> |
1258 HistoryService::AddFaviconChangedCallback( | 1273 HistoryService::AddFaviconChangedCallback( |
1259 const HistoryService::OnFaviconChangedCallback& callback) { | 1274 const HistoryService::OnFaviconChangedCallback& callback) { |
1260 DCHECK(thread_checker_.CalledOnValidThread()); | 1275 DCHECK(thread_checker_.CalledOnValidThread()); |
1261 return favicon_changed_callback_list_.Add(callback); | 1276 return favicon_changed_callback_list_.Add(callback); |
1262 } | 1277 } |
1263 | 1278 |
1264 void HistoryService::NotifyFaviconChanged( | 1279 void HistoryService::NotifyFaviconChanged( |
1265 const std::set<GURL>& changed_favicons) { | 1280 const std::set<GURL>& changed_favicons) { |
1266 DCHECK(thread_checker_.CalledOnValidThread()); | 1281 DCHECK(thread_checker_.CalledOnValidThread()); |
1267 favicon_changed_callback_list_.Notify(changed_favicons); | 1282 favicon_changed_callback_list_.Notify(changed_favicons); |
1268 } | 1283 } |
OLD | NEW |