Index: chrome/browser/history/history_service.cc |
diff --git a/chrome/browser/history/history_service.cc b/chrome/browser/history/history_service.cc |
index ccb0b991daedd1bee2031986c8ca29dec0bd2d3c..2c1d5507959117131b55ef6926c04991244fdb60 100644 |
--- a/chrome/browser/history/history_service.cc |
+++ b/chrome/browser/history/history_service.cc |
@@ -40,6 +40,7 @@ |
#include "chrome/browser/bookmarks/bookmark_model.h" |
#include "chrome/browser/bookmarks/bookmark_model_factory.h" |
#include "chrome/browser/browser_process.h" |
+#include "chrome/browser/favicon/favicon_changed_details.h" |
#include "chrome/browser/favicon/imported_favicon_usage.h" |
#include "chrome/browser/history/download_row.h" |
#include "chrome/browser/history/history_backend.h" |
@@ -161,6 +162,22 @@ class HistoryService::BackendDelegate : public HistoryBackend::Delegate { |
backend_id, backend)); |
} |
+ virtual void SendFaviconChangedNotification( |
+ chrome::FaviconChangedDetails* details) OVERRIDE { |
+ // Send the notification on the history thread. |
+ if (content::NotificationService::current()) { |
+ content::NotificationService::current()->Notify( |
+ chrome::NOTIFICATION_FAVICON_CHANGED, |
+ content::Source<Profile>(profile_), |
+ content::Details<chrome::FaviconChangedDetails>(details)); |
+ } |
+ // Send the notification to the history service on the main thread. |
+ service_task_runner_->PostTask( |
+ FROM_HERE, |
+ base::Bind(&HistoryService::SendFaviconChangedNotificationHelper, |
+ history_service_, base::Owned(details))); |
+ } |
+ |
virtual void BroadcastNotifications( |
int type, |
history::HistoryDetails* details) OVERRIDE { |
@@ -1164,6 +1181,31 @@ void HistoryService::ExpireLocalAndRemoteHistoryBetween( |
ExpireHistoryBetween(restrict_urls, begin_time, end_time, callback, tracker); |
} |
+void HistoryService::SendFaviconChangedNotificationHelper( |
+ chrome::FaviconChangedDetails* details) { |
+ DCHECK(thread_checker_.CalledOnValidThread()); |
+ // TODO(evanm): this is currently necessitated by generate_profile, which |
+ // runs without a browser process. generate_profile should really create |
+ // a browser process, at which point this check can then be nuked. |
+ if (!g_browser_process) |
+ return; |
+ |
+ if (!thread_) |
+ return; |
+ |
+ // The source of all of our notifications is the profile. Note that this |
+ // pointer is NULL in unit tests. |
+ content::Source<Profile> source(profile_); |
+ |
+ // The details object just contains the pointer to the object that the |
+ // backend has allocated for us. The receiver of the notification will cast |
+ // this to the proper type. |
+ content::Details<chrome::FaviconChangedDetails> det(details); |
+ |
+ content::NotificationService::current()->Notify( |
+ chrome::NOTIFICATION_FAVICON_CHANGED, source, det); |
+} |
+ |
void HistoryService::BroadcastNotificationsHelper( |
int type, |
history::HistoryDetails* details) { |