Chromium Code Reviews| Index: chrome/browser/extensions/extension_bookmarks_module.cc |
| diff --git a/chrome/browser/extensions/extension_bookmarks_module.cc b/chrome/browser/extensions/extension_bookmarks_module.cc |
| index 2b6a154adc158bd7f715f2005c1ddd74e4ed2a4e..82993f34601ed0621487a095bb8f50ef6ad62c76 100644 |
| --- a/chrome/browser/extensions/extension_bookmarks_module.cc |
| +++ b/chrome/browser/extensions/extension_bookmarks_module.cc |
| @@ -79,7 +79,7 @@ void BookmarksFunction::Run() { |
| if (!model->IsLoaded()) { |
| // Bookmarks are not ready yet. We'll wait. |
| registrar_.Add(this, chrome::NOTIFICATION_BOOKMARK_MODEL_LOADED, |
| - Source<Profile>(profile())); |
| + NotificationService::AllSources()); |
|
Miranda Callahan
2011/08/12 19:37:03
should be AllBrowserContextsAndSources here too, r
|
| AddRef(); // Balanced in Observe(). |
| return; |
| } |
| @@ -113,8 +113,11 @@ bool BookmarksFunction::EditBookmarksEnabled() { |
| void BookmarksFunction::Observe(int type, |
| const NotificationSource& source, |
| const NotificationDetails& details) { |
| - DCHECK_EQ(chrome::NOTIFICATION_BOOKMARK_MODEL_LOADED, type); |
| - DCHECK_EQ(profile(), Source<Profile>(source).ptr()); |
| + DCHECK(type == chrome::NOTIFICATION_BOOKMARK_MODEL_LOADED); |
| + Profile* source_profile = Source<Profile>(source).ptr(); |
| + if (!source_profile || !source_profile->IsSameProfile(profile())) |
| + return; |
| + |
| DCHECK(profile()->GetBookmarkModel()->IsLoaded()); |
| Run(); |
| Release(); // Balanced in Run(). |