summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorerg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-02 22:12:45 +0000
committererg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-02 22:12:45 +0000
commitb5c8ff9cf03f15980a86fba0e06fd34682876234 (patch)
tree18a4a5ced2029fc789a6550cd59f42776bd0ee45
parentfab6d2a21f10417ba5a9ba73969e32df82c29253 (diff)
downloadchromium_src-b5c8ff9cf03f15980a86fba0e06fd34682876234.zip
chromium_src-b5c8ff9cf03f15980a86fba0e06fd34682876234.tar.gz
chromium_src-b5c8ff9cf03f15980a86fba0e06fd34682876234.tar.bz2
Profiles: Fix AllSources usage with NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED.
BUG=87457 TEST=none Review URL: http://codereview.chromium.org/7518040 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95169 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc19
-rw-r--r--chrome/browser/ui/webui/options/content_settings_handler.cc2
-rw-r--r--chrome/browser/ui/webui/options/handler_options_handler.cc2
-rw-r--r--chrome/common/chrome_notification_types.h2
4 files changed, 10 insertions, 15 deletions
diff --git a/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc b/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc
index 38f938e..c8b8170 100644
--- a/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc
+++ b/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc
@@ -142,18 +142,12 @@ ShellIntegration::DefaultProtocolClientWorker* FakeDelegate::CreateShellWorker(
class NotificationCounter : public NotificationObserver {
public:
- NotificationCounter()
+ explicit NotificationCounter(Profile* profile)
: events_(0),
notification_registrar_() {
notification_registrar_.Add(this,
chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED,
- NotificationService::AllSources());
- }
-
- ~NotificationCounter() {
- notification_registrar_.Remove(this,
- chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED,
- NotificationService::AllSources());
+ Source<Profile>(profile));
}
int events() { return events_; }
@@ -171,13 +165,14 @@ class NotificationCounter : public NotificationObserver {
class QueryProtocolHandlerOnChange : public NotificationObserver {
public:
- explicit QueryProtocolHandlerOnChange(ProtocolHandlerRegistry* registry)
+ QueryProtocolHandlerOnChange(Profile* profile,
+ ProtocolHandlerRegistry* registry)
: registry_(registry),
called_(false),
notification_registrar_() {
notification_registrar_.Add(this,
chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED,
- NotificationService::AllSources());
+ Source<Profile>(profile));
}
virtual void Observe(int type,
@@ -490,7 +485,7 @@ TEST_F(ProtocolHandlerRegistryTest, TestIsHandledProtocol) {
TEST_F(ProtocolHandlerRegistryTest, TestNotifications) {
ProtocolHandler ph1 = CreateProtocolHandler("test", "test1");
- NotificationCounter counter;
+ NotificationCounter counter(profile());
registry()->OnAcceptRegisterProtocolHandler(ph1);
ASSERT_TRUE(counter.notified());
@@ -510,7 +505,7 @@ TEST_F(ProtocolHandlerRegistryTest, TestNotifications) {
}
TEST_F(ProtocolHandlerRegistryTest, TestReentrantNotifications) {
- QueryProtocolHandlerOnChange queryer(registry());
+ QueryProtocolHandlerOnChange queryer(profile(), registry());
ProtocolHandler ph1 = CreateProtocolHandler("test", "test1");
registry()->OnAcceptRegisterProtocolHandler(ph1);
ASSERT_TRUE(queryer.called_);
diff --git a/chrome/browser/ui/webui/options/content_settings_handler.cc b/chrome/browser/ui/webui/options/content_settings_handler.cc
index d0d5b1b..a645f40 100644
--- a/chrome/browser/ui/webui/options/content_settings_handler.cc
+++ b/chrome/browser/ui/webui/options/content_settings_handler.cc
@@ -285,7 +285,7 @@ void ContentSettingsHandler::Initialize() {
NotificationService::AllSources());
notification_registrar_.Add(
this, chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED,
- NotificationService::AllSources());
+ Source<Profile>(web_ui_->GetProfile()));
PrefService* prefs = web_ui_->GetProfile()->GetPrefs();
pref_change_registrar_.Init(prefs);
diff --git a/chrome/browser/ui/webui/options/handler_options_handler.cc b/chrome/browser/ui/webui/options/handler_options_handler.cc
index af8c668..7219689 100644
--- a/chrome/browser/ui/webui/options/handler_options_handler.cc
+++ b/chrome/browser/ui/webui/options/handler_options_handler.cc
@@ -45,7 +45,7 @@ void HandlerOptionsHandler::Initialize() {
UpdateHandlerList();
notification_registrar_.Add(
this, chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED,
- NotificationService::AllSources());
+ Source<Profile>(web_ui_->GetProfile()));
}
void HandlerOptionsHandler::RegisterMessages() {
diff --git a/chrome/common/chrome_notification_types.h b/chrome/common/chrome_notification_types.h
index 1edb852..0bb6c83 100644
--- a/chrome/common/chrome_notification_types.h
+++ b/chrome/common/chrome_notification_types.h
@@ -889,7 +889,7 @@ enum {
#endif
// Protocol Handler Registry -----------------------------------------------
- // Sent when a ProtocolHandlerRegistry is changed.
+ // Sent when a ProtocolHandlerRegistry is changed. The source is the profile.
NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED,
// Sent when the cached profile info has changed.