Commit 2f35a315 authored by erg@chromium.org's avatar erg@chromium.org

Profiles: Bookmark notifications should listen to only a specific profile.

BUG=87457
TEST=none


Review URL: http://codereview.chromium.org/7558003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96049 0039d316-1c4b-4281-b951-d872f2087c98
parent cf44261b
......@@ -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,
NotificationService::AllSources());
Source<Profile>(profile()));
AddRef(); // Balanced in Observe().
return;
}
......@@ -113,7 +113,8 @@ bool BookmarksFunction::EditBookmarksEnabled() {
void BookmarksFunction::Observe(int type,
const NotificationSource& source,
const NotificationDetails& details) {
DCHECK(type == chrome::NOTIFICATION_BOOKMARK_MODEL_LOADED);
DCHECK_EQ(chrome::NOTIFICATION_BOOKMARK_MODEL_LOADED, type);
DCHECK_EQ(profile(), Source<Profile>(source).ptr());
DCHECK(profile()->GetBookmarkModel()->IsLoaded());
Run();
Release(); // Balanced in Run().
......
......@@ -563,7 +563,7 @@ void MetricsService::SetUpNotifications(NotificationRegistrar* registrar,
registrar->Add(observer, chrome::NOTIFICATION_OMNIBOX_OPENED_URL,
NotificationService::AllSources());
registrar->Add(observer, chrome::NOTIFICATION_BOOKMARK_MODEL_LOADED,
NotificationService::AllSources());
NotificationService::AllBrowserContextsAndSources());
}
void MetricsService::Observe(int type,
......
......@@ -26,10 +26,9 @@ BookmarkTabHelper::BookmarkTabHelper(TabContentsWrapper* tab_contents)
delegate_(NULL),
bookmark_drag_(NULL) {
// Register for notifications about URL starredness changing on any profile.
registrar_.Add(this, chrome::NOTIFICATION_URLS_STARRED,
NotificationService::AllSources());
registrar_.Add(this, chrome::NOTIFICATION_BOOKMARK_MODEL_LOADED,
NotificationService::AllSources());
Source<Profile> source(tab_contents->profile());
registrar_.Add(this, chrome::NOTIFICATION_URLS_STARRED, source);
registrar_.Add(this, chrome::NOTIFICATION_BOOKMARK_MODEL_LOADED, source);
}
BookmarkTabHelper::~BookmarkTabHelper() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment