diff options
-rw-r--r-- | chrome/browser/dom_ui/history_ui.cc | 12 | ||||
-rw-r--r-- | chrome/browser/dom_ui/history_ui.h | 3 | ||||
-rw-r--r-- | chrome/browser/dom_ui/new_tab_ui.cc | 7 | ||||
-rw-r--r-- | chrome/browser/dom_ui/new_tab_ui.h | 4 |
4 files changed, 10 insertions, 16 deletions
diff --git a/chrome/browser/dom_ui/history_ui.cc b/chrome/browser/dom_ui/history_ui.cc index 1c37d12..1fbbb38 100644 --- a/chrome/browser/dom_ui/history_ui.cc +++ b/chrome/browser/dom_ui/history_ui.cc @@ -113,20 +113,12 @@ BrowsingHistoryHandler::BrowsingHistoryHandler(DOMUI* dom_ui) new DOMUIFavIconSource(dom_ui_->GetProfile()))); // Get notifications when history is cleared. - NotificationService* service = NotificationService::current(); - service->AddObserver(this, NotificationType::HISTORY_URLS_DELETED, - Source<Profile>( - dom_ui_->GetProfile()->GetOriginalProfile())); + registrar_.Add(this, NotificationType::HISTORY_URLS_DELETED, + Source<Profile>(dom_ui_->GetProfile()->GetOriginalProfile())); } BrowsingHistoryHandler::~BrowsingHistoryHandler() { cancelable_consumer_.CancelAllRequests(); - - NotificationService* service = NotificationService::current(); - service->RemoveObserver(this, NotificationType::HISTORY_URLS_DELETED, - Source<Profile>( - dom_ui_->GetProfile()->GetOriginalProfile())); - if (remover_.get()) remover_->RemoveObserver(this); } diff --git a/chrome/browser/dom_ui/history_ui.h b/chrome/browser/dom_ui/history_ui.h index a4f201c..f44e033 100644 --- a/chrome/browser/dom_ui/history_ui.h +++ b/chrome/browser/dom_ui/history_ui.h @@ -11,6 +11,7 @@ #include "chrome/browser/dom_ui/dom_ui.h" #include "chrome/browser/cancelable_request.h" #include "chrome/browser/history/history.h" +#include "chrome/common/notification_registrar.h" class GURL; @@ -67,6 +68,8 @@ class BrowsingHistoryHandler : public DOMMessageHandler, // Figure out the query options for a month-wide query. history::QueryOptions CreateMonthQueryOptions(int month); + NotificationRegistrar registrar_; + // Current search text. std::wstring search_text_; diff --git a/chrome/browser/dom_ui/new_tab_ui.cc b/chrome/browser/dom_ui/new_tab_ui.cc index e64f02e..ccef07f 100644 --- a/chrome/browser/dom_ui/new_tab_ui.cc +++ b/chrome/browser/dom_ui/new_tab_ui.cc @@ -1193,14 +1193,11 @@ NewTabUI::NewTabUI(TabContents* contents) } // Listen for theme installation. - NotificationService::current()->AddObserver(this, - NotificationType::THEME_INSTALLED, NotificationService::AllSources()); + registrar_.Add(this, NotificationType::THEME_INSTALLED, + NotificationService::AllSources()); } NewTabUI::~NewTabUI() { - // Remove theme observer. - NotificationService::current()->RemoveObserver(this, - NotificationType::THEME_INSTALLED, NotificationService::AllSources()); } void NewTabUI::Observe(NotificationType type, diff --git a/chrome/browser/dom_ui/new_tab_ui.h b/chrome/browser/dom_ui/new_tab_ui.h index 1efb8dd..6c3a2f1 100644 --- a/chrome/browser/dom_ui/new_tab_ui.h +++ b/chrome/browser/dom_ui/new_tab_ui.h @@ -6,7 +6,7 @@ #define CHROME_BROWSER_DOM_UI_NEW_TAB_UI_H_ #include "chrome/browser/dom_ui/dom_ui.h" -#include "chrome/common/notification_observer.h" +#include "chrome/common/notification_registrar.h" class GURL; class PrefService; @@ -33,6 +33,8 @@ class NewTabUI : public DOMUI, const NotificationSource& source, const NotificationDetails& details); + NotificationRegistrar registrar_; + // The message id that should be displayed in this NewTabUIContents // instance's motd area. int motd_message_id_; |