diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-22 03:18:33 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-22 03:18:33 +0000 |
commit | 6199fe6becd0b6824fe88c96e428c6f776cd968e (patch) | |
tree | 8bd4a5be63f34b112a764adf63a17ce749d954ba /chrome/browser/rlz | |
parent | 4517eb4e75100a8f7ebeae008c7542641ad7bcad (diff) | |
download | chromium_src-6199fe6becd0b6824fe88c96e428c6f776cd968e.zip chromium_src-6199fe6becd0b6824fe88c96e428c6f776cd968e.tar.gz chromium_src-6199fe6becd0b6824fe88c96e428c6f776cd968e.tar.bz2 |
Use a NotificationRegistrar to listen for notifications.
BUG=2381
Review URL: http://codereview.chromium.org/115668
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16715 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/rlz')
-rw-r--r-- | chrome/browser/rlz/rlz.cc | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/chrome/browser/rlz/rlz.cc b/chrome/browser/rlz/rlz.cc index b310d57..96ea0c2 100644 --- a/chrome/browser/rlz/rlz.cc +++ b/chrome/browser/rlz/rlz.cc @@ -22,6 +22,7 @@ #include "chrome/browser/search_engines/template_url_model.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/env_vars.h" +#include "chrome/common/notification_registrar.h" #include "chrome/common/notification_service.h" #include "chrome/installer/util/google_update_settings.h" @@ -123,9 +124,8 @@ bool SendFinancialPing(const wchar_t* brand, const wchar_t* lang, class OmniBoxUsageObserver : public NotificationObserver { public: OmniBoxUsageObserver() { - NotificationService::current()->AddObserver(this, - NotificationType::OMNIBOX_OPENED_URL, - NotificationService::AllSources()); + registrar_.Add(this, NotificationType::OMNIBOX_OPENED_URL, + NotificationService::AllSources()); omnibox_used_ = false; DCHECK(!instance_); instance_ = this; @@ -155,9 +155,6 @@ class OmniBoxUsageObserver : public NotificationObserver { private: // Dtor is private so the object cannot be created on the stack. ~OmniBoxUsageObserver() { - NotificationService::current()->RemoveObserver(this, - NotificationType::OMNIBOX_OPENED_URL, - NotificationService::AllSources()); instance_ = NULL; } @@ -166,8 +163,10 @@ class OmniBoxUsageObserver : public NotificationObserver { // There should only be one instance created at a time, and instance_ points // to that instance. // NOTE: this is only non-null for the amount of time it is needed. Once the - // instance_ is no longer needed (or Chrome is exitting), this is null. + // instance_ is no longer needed (or Chrome is exiting), this is null. static OmniBoxUsageObserver* instance_; + + NotificationRegistrar registrar_; }; bool OmniBoxUsageObserver::omnibox_used_ = false; |