diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-01 18:16:56 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-01 18:16:56 +0000 |
commit | bfd04a62ce610d7bb61dbb78811dccbed23589b7 (patch) | |
tree | 70bb228c0f00ba1c12c584efd569daccf96b4026 /chrome/browser/bookmarks | |
parent | a814d863440f0a154a7299f2d8b440f405c7700e (diff) | |
download | chromium_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')
-rw-r--r-- | chrome/browser/bookmarks/bookmark_model.cc | 27 | ||||
-rw-r--r-- | chrome/browser/bookmarks/bookmark_model.h | 2 | ||||
-rw-r--r-- | chrome/browser/bookmarks/bookmark_model_unittest.cc | 5 |
3 files changed, 19 insertions, 15 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(); diff --git a/chrome/browser/bookmarks/bookmark_model.h b/chrome/browser/bookmarks/bookmark_model.h index 6f33274..52cbe46 100644 --- a/chrome/browser/bookmarks/bookmark_model.h +++ b/chrome/browser/bookmarks/bookmark_model.h @@ -17,7 +17,7 @@ #include "chrome/browser/cancelable_request.h" #include "chrome/browser/history/history.h" #include "chrome/browser/history/history_types.h" -#include "chrome/common/notification_service.h" +#include "chrome/common/notification_observer.h" #include "chrome/views/tree_node_model.h" #include "googleurl/src/gurl.h" #include "skia/include/SkBitmap.h" diff --git a/chrome/browser/bookmarks/bookmark_model_unittest.cc b/chrome/browser/bookmarks/bookmark_model_unittest.cc index 1ef384c..0264c3a 100644 --- a/chrome/browser/bookmarks/bookmark_model_unittest.cc +++ b/chrome/browser/bookmarks/bookmark_model_unittest.cc @@ -9,6 +9,7 @@ #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/notification_registrar.h" +#include "chrome/common/notification_service.h" #include "chrome/test/testing_profile.h" #include "chrome/views/tree_node_model.h" #include "testing/gtest/include/gtest/gtest.h" @@ -413,13 +414,13 @@ namespace { class StarredListener : public NotificationObserver { public: StarredListener() : notification_count_(0), details_(false) { - registrar_.Add(this, NOTIFY_URLS_STARRED, Source<Profile>(NULL)); + registrar_.Add(this, NotificationType::URLS_STARRED, Source<Profile>(NULL)); } virtual void Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NOTIFY_URLS_STARRED) { + if (type == NotificationType::URLS_STARRED) { notification_count_++; details_ = *(Details<history::URLsStarredDetails>(details).ptr()); } |