summaryrefslogtreecommitdiffstats
path: root/chrome/browser/bookmarks/bookmark_model.cc
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-01 18:16:56 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-01 18:16:56 +0000
commitbfd04a62ce610d7bb61dbb78811dccbed23589b7 (patch)
tree70bb228c0f00ba1c12c584efd569daccf96b4026 /chrome/browser/bookmarks/bookmark_model.cc
parenta814d863440f0a154a7299f2d8b440f405c7700e (diff)
downloadchromium_src-bfd04a62ce610d7bb61dbb78811dccbed23589b7.zip
chromium_src-bfd04a62ce610d7bb61dbb78811dccbed23589b7.tar.gz
chromium_src-bfd04a62ce610d7bb61dbb78811dccbed23589b7.tar.bz2
Remove most header file dependencies on the notification type list. It is
really painful to add more types, since lots of headers include the notification service to derive from the notification observer. This splits that out, so much less of the project should end up including notification_types.h ---Paths modified but not in any changelist: Review URL: http://codereview.chromium.org/19744 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9020 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/bookmarks/bookmark_model.cc')
-rw-r--r--chrome/browser/bookmarks/bookmark_model.cc27
1 files changed, 15 insertions, 12 deletions
diff --git a/chrome/browser/bookmarks/bookmark_model.cc b/chrome/browser/bookmarks/bookmark_model.cc
index afb42df..4280808 100644
--- a/chrome/browser/bookmarks/bookmark_model.cc
+++ b/chrome/browser/bookmarks/bookmark_model.cc
@@ -9,6 +9,7 @@
#include "chrome/browser/bookmarks/bookmark_storage.h"
#include "chrome/browser/profile.h"
#include "chrome/common/l10n_util.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/scoped_vector.h"
#include "generated_resources.h"
@@ -87,12 +88,12 @@ BookmarkModel::BookmarkModel(Profile* profile)
BookmarkModel::~BookmarkModel() {
if (profile_ && store_.get()) {
NotificationService::current()->RemoveObserver(
- this, NOTIFY_FAVICON_CHANGED, Source<Profile>(profile_));
+ this, NotificationType::FAVICON_CHANGED, Source<Profile>(profile_));
}
if (waiting_for_history_load_) {
NotificationService::current()->RemoveObserver(
- this, NOTIFY_HISTORY_LOADED, Source<Profile>(profile_));
+ this, NotificationType::HISTORY_LOADED, Source<Profile>(profile_));
}
FOR_EACH_OBSERVER(BookmarkModelObserver, observers_,
@@ -118,7 +119,7 @@ void BookmarkModel::Load() {
// Listen for changes to favicons so that we can update the favicon of the
// node appropriately.
NotificationService::current()->AddObserver(
- this, NOTIFY_FAVICON_CHANGED, Source<Profile>(profile_));
+ this,NotificationType::FAVICON_CHANGED, Source<Profile>(profile_));
// Load the bookmarks. BookmarkStorage notifies us when done.
store_ = new BookmarkStorage(profile_, this);
@@ -324,7 +325,7 @@ void BookmarkModel::ResetDateGroupModified(BookmarkNode* node) {
void BookmarkModel::ClearStore() {
if (profile_ && store_.get()) {
NotificationService::current()->RemoveObserver(
- this, NOTIFY_FAVICON_CHANGED, Source<Profile>(profile_));
+ this, NotificationType::FAVICON_CHANGED, Source<Profile>(profile_));
}
store_ = NULL;
}
@@ -408,7 +409,7 @@ void BookmarkModel::OnBookmarkStorageLoadedBookmarks(
waiting_for_history_load_ = true;
NotificationService::current()->AddObserver(
- this, NOTIFY_HISTORY_LOADED, Source<Profile>(profile_));
+ this, NotificationType::HISTORY_LOADED, Source<Profile>(profile_));
} else {
OnHistoryDone();
}
@@ -445,7 +446,7 @@ void BookmarkModel::DoneLoading() {
// And generic notification.
NotificationService::current()->Notify(
- NOTIFY_BOOKMARK_MODEL_LOADED,
+ NotificationType::BOOKMARK_MODEL_LOADED,
Source<Profile>(profile_),
NotificationService::NoDetails());
}
@@ -491,7 +492,8 @@ void BookmarkModel::RemoveAndDeleteNode(BookmarkNode* delete_me) {
history->URLsNoLongerBookmarked(details.changed_urls);
}
- NotificationService::current()->Notify(NOTIFY_URLS_STARRED,
+ NotificationService::current()->Notify(
+ NotificationType::URLS_STARRED,
Source<Profile>(profile_),
Details<history::URLsStarredDetails>(&details));
}
@@ -511,7 +513,8 @@ BookmarkNode* BookmarkModel::AddNode(BookmarkNode* parent,
if (node->GetType() == history::StarredEntry::URL && !was_bookmarked) {
history::URLsStarredDetails details(true);
details.changed_urls.insert(node->GetURL());
- NotificationService::current()->Notify(NOTIFY_URLS_STARRED,
+ NotificationService::current()->Notify(
+ NotificationType::URLS_STARRED,
Source<Profile>(profile_),
Details<history::URLsStarredDetails>(&details));
}
@@ -626,8 +629,8 @@ void BookmarkModel::CancelPendingFavIconLoadRequests(BookmarkNode* node) {
void BookmarkModel::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- switch (type) {
- case NOTIFY_FAVICON_CHANGED: {
+ switch (type.value) {
+ case NotificationType::FAVICON_CHANGED: {
// Prevent the observers from getting confused for multiple favicon loads.
Details<history::FavIconChangeDetails> favicon_details(details);
for (std::set<GURL>::const_iterator i = favicon_details->urls.begin();
@@ -646,11 +649,11 @@ void BookmarkModel::Observe(NotificationType type,
break;
}
- case NOTIFY_HISTORY_LOADED: {
+ case NotificationType::HISTORY_LOADED: {
if (waiting_for_history_load_) {
waiting_for_history_load_ = false;
NotificationService::current()->RemoveObserver(
- this, NOTIFY_HISTORY_LOADED, Source<Profile>(profile_));
+ this,NotificationType::HISTORY_LOADED, Source<Profile>(profile_));
OnHistoryDone();
} else {
NOTREACHED();