Index: chrome/browser/win/jumplist.cc |
diff --git a/chrome/browser/win/jumplist.cc b/chrome/browser/win/jumplist.cc |
index 753c8e55fa6202c0f830a1a7b52b8a008e80b520..37790c4abcc7eb4b5c04a8223587187d3918b288 100644 |
--- a/chrome/browser/win/jumplist.cc |
+++ b/chrome/browser/win/jumplist.cc |
@@ -261,7 +261,9 @@ JumpList::JumpListData::JumpListData() {} |
JumpList::JumpListData::~JumpListData() {} |
JumpList::JumpList(Profile* profile) |
- : profile_(profile), |
+ : RefcountedKeyedService(content::BrowserThread::GetTaskRunnerForThread( |
+ content::BrowserThread::UI)), |
+ profile_(profile), |
jumplist_data_(new base::RefCountedData<JumpListData>), |
task_id_(base::CancelableTaskTracker::kBadTaskId), |
weak_ptr_factory_(this) { |
@@ -287,14 +289,9 @@ JumpList::JumpList(Profile* profile) |
// your profile is empty. Ask TopSites to update itself when jumplist is |
// initialized. |
top_sites->SyncWithHistory(); |
- registrar_.reset(new content::NotificationRegistrar); |
// Register as TopSitesObserver so that we can update ourselves when the |
// TopSites changes. |
top_sites->AddObserver(this); |
- // Register for notification when profile is destroyed to ensure that all |
- // observers are detatched at that time. |
- registrar_->Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, |
- content::Source<Profile>(profile_)); |
} |
tab_restore_service->AddObserver(this); |
pref_change_registrar_.reset(new PrefChangeRegistrar); |
@@ -314,15 +311,6 @@ bool JumpList::Enabled() { |
return JumpListUpdater::IsEnabled(); |
} |
-void JumpList::Observe(int type, |
- const content::NotificationSource& source, |
- const content::NotificationDetails& details) { |
- DCHECK(CalledOnValidThread()); |
- DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type); |
- // Profile was destroyed, do clean-up. |
- Terminate(); |
-} |
- |
void JumpList::CancelPendingUpdate() { |
DCHECK(CalledOnValidThread()); |
if (task_id_ != base::CancelableTaskTracker::kBadTaskId) { |
@@ -343,12 +331,16 @@ void JumpList::Terminate() { |
TopSitesFactory::GetForProfile(profile_); |
if (top_sites) |
top_sites->RemoveObserver(this); |
- registrar_.reset(); |
pref_change_registrar_.reset(); |
} |
profile_ = NULL; |
} |
+void JumpList::ShutdownOnUIThread() { |
+ DCHECK(CalledOnValidThread()); |
+ Terminate(); |
+} |
+ |
void JumpList::OnMostVisitedURLsAvailable( |
const history::MostVisitedURLList& urls) { |
DCHECK(CalledOnValidThread()); |