summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-14 18:17:22 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-14 18:17:22 +0000
commit60dc931194a31434462332b74dfad1f4fd308a6f (patch)
treeecf4ec6c85f29da69bfbd4b1fce0482eaa7783f3
parentd76adec235c3351bfb4e70097d8bf6239183971b (diff)
downloadchromium_src-60dc931194a31434462332b74dfad1f4fd308a6f.zip
chromium_src-60dc931194a31434462332b74dfad1f4fd308a6f.tar.gz
chromium_src-60dc931194a31434462332b74dfad1f4fd308a6f.tar.bz2
Hide the process of instantiating NotificationServiceImpl from embedders.
Make NotificationService handle the process of instantiating NotificationServiceImpl instead. BUG=98716 R=jam@chromium.org TBR=akalin@chromium.org Review URL: http://codereview.chromium.org/8913009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114454 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/password_manager/password_store_mac.cc4
-rw-r--r--chrome/browser/sync/glue/typed_url_change_processor.cc4
-rw-r--r--chrome/browser/sync/profile_sync_test_util.cc2
-rw-r--r--chrome/browser/sync/profile_sync_test_util.h4
-rw-r--r--chrome/browser/sync/util/extensions_activity_monitor_unittest.cc4
-rw-r--r--chrome/browser/ui/views/location_bar/page_action_image_view.cc1
-rw-r--r--chrome/browser/webdata/web_database.cc4
-rw-r--r--content/browser/notification_service_impl.cc5
-rw-r--r--content/public/browser/notification_service.h2
9 files changed, 18 insertions, 12 deletions
diff --git a/chrome/browser/password_manager/password_store_mac.cc b/chrome/browser/password_manager/password_store_mac.cc
index 9580f9d..ef4e421 100644
--- a/chrome/browser/password_manager/password_store_mac.cc
+++ b/chrome/browser/password_manager/password_store_mac.cc
@@ -21,7 +21,7 @@
#include "chrome/browser/password_manager/login_database.h"
#include "chrome/browser/password_manager/password_store_change.h"
#include "chrome/common/chrome_notification_types.h"
-#include "content/browser/notification_service_impl.h"
+#include "content/public/browser/notification_service.h"
using webkit_glue::PasswordForm;
@@ -1016,5 +1016,5 @@ void PasswordStoreMac::RemoveKeychainForms(
}
void PasswordStoreMac::CreateNotificationService() {
- notification_service_.reset(new NotificationServiceImpl);
+ notification_service_.reset(content::NotificationService::Create());
}
diff --git a/chrome/browser/sync/glue/typed_url_change_processor.cc b/chrome/browser/sync/glue/typed_url_change_processor.cc
index 95e4573..68e00d9 100644
--- a/chrome/browser/sync/glue/typed_url_change_processor.cc
+++ b/chrome/browser/sync/glue/typed_url_change_processor.cc
@@ -18,7 +18,7 @@
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/sync/protocol/typed_url_specifics.pb.h"
#include "chrome/common/chrome_notification_types.h"
-#include "content/browser/notification_service_impl.h"
+#include "content/public/browser/notification_service.h"
using content::BrowserThread;
@@ -50,7 +50,7 @@ TypedUrlChangeProcessor::TypedUrlChangeProcessor(
// When running in unit tests, there is already a NotificationService object.
// Since only one can exist at a time per thread, check first.
if (!content::NotificationService::current())
- notification_service_.reset(new NotificationServiceImpl);
+ notification_service_.reset(content::NotificationService::Create());
StartObserving();
}
diff --git a/chrome/browser/sync/profile_sync_test_util.cc b/chrome/browser/sync/profile_sync_test_util.cc
index 7a18bb0..d36f908 100644
--- a/chrome/browser/sync/profile_sync_test_util.cc
+++ b/chrome/browser/sync/profile_sync_test_util.cc
@@ -38,7 +38,7 @@ void ThreadNotificationService::TearDown() {
ThreadNotificationService::~ThreadNotificationService() {}
void ThreadNotificationService::InitTask() {
- service_.reset(new NotificationServiceImpl());
+ service_.reset(content::NotificationService::Create());
done_event_.Signal();
}
diff --git a/chrome/browser/sync/profile_sync_test_util.h b/chrome/browser/sync/profile_sync_test_util.h
index e2572635..c99134e 100644
--- a/chrome/browser/sync/profile_sync_test_util.h
+++ b/chrome/browser/sync/profile_sync_test_util.h
@@ -13,8 +13,8 @@
#include "base/message_loop.h"
#include "base/synchronization/waitable_event.h"
#include "chrome/browser/sync/profile_sync_service_observer.h"
-#include "content/browser/notification_service_impl.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_source.h"
#include "content/public/browser/notification_types.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -60,7 +60,7 @@ class ThreadNotificationService
base::WaitableEvent done_event_;
base::Thread* notification_thread_;
- scoped_ptr<NotificationServiceImpl> service_;
+ scoped_ptr<content::NotificationService> service_;
};
class ThreadNotifier : // NOLINT
diff --git a/chrome/browser/sync/util/extensions_activity_monitor_unittest.cc b/chrome/browser/sync/util/extensions_activity_monitor_unittest.cc
index 4340031..346c0d9 100644
--- a/chrome/browser/sync/util/extensions_activity_monitor_unittest.cc
+++ b/chrome/browser/sync/util/extensions_activity_monitor_unittest.cc
@@ -13,7 +13,7 @@
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_constants.h"
-#include "content/browser/notification_service_impl.h"
+#include "content/public/browser/notification_service.h"
#include "content/test/test_browser_thread.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -85,7 +85,7 @@ class BookmarkAPIEventGenerator {
void DoUIThreadSetupCallback(content::NotificationService** service,
base::WaitableEvent* done) {
- *service = new NotificationServiceImpl();
+ *service = content::NotificationService::Create();
done->Signal();
}
diff --git a/chrome/browser/ui/views/location_bar/page_action_image_view.cc b/chrome/browser/ui/views/location_bar/page_action_image_view.cc
index 9ef628e..219b658 100644
--- a/chrome/browser/ui/views/location_bar/page_action_image_view.cc
+++ b/chrome/browser/ui/views/location_bar/page_action_image_view.cc
@@ -17,7 +17,6 @@
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_action.h"
#include "chrome/common/extensions/extension_resource.h"
-#include "content/browser/notification_service_impl.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_source.h"
#include "ui/base/accessibility/accessible_view_state.h"
diff --git a/chrome/browser/webdata/web_database.cc b/chrome/browser/webdata/web_database.cc
index 99362f7..0d0883f 100644
--- a/chrome/browser/webdata/web_database.cc
+++ b/chrome/browser/webdata/web_database.cc
@@ -13,7 +13,7 @@
#include "chrome/browser/webdata/token_service_table.h"
#include "chrome/browser/webdata/web_apps_table.h"
#include "chrome/browser/webdata/web_intents_table.h"
-#include "content/browser/notification_service_impl.h"
+#include "content/public/browser/notification_service.h"
#include "sql/statement.h"
#include "sql/transaction.h"
@@ -92,7 +92,7 @@ sql::InitStatus WebDatabase::Init(const FilePath& db_name) {
// When running in unit tests, there is already a NotificationService object.
// Since only one can exist at a time per thread, check first.
if (!content::NotificationService::current())
- notification_service_.reset(new NotificationServiceImpl);
+ notification_service_.reset(content::NotificationService::Create());
// Set the exceptional sqlite error handler.
db_.set_error_delegate(GetErrorHandlerForWebDb());
diff --git a/content/browser/notification_service_impl.cc b/content/browser/notification_service_impl.cc
index 221a883..327e28f 100644
--- a/content/browser/notification_service_impl.cc
+++ b/content/browser/notification_service_impl.cc
@@ -23,6 +23,11 @@ content::NotificationService* content::NotificationService::current() {
}
// static
+content::NotificationService* content::NotificationService::Create() {
+ return new NotificationServiceImpl;
+}
+
+// static
bool NotificationServiceImpl::HasKey(const NotificationSourceMap& map,
const content::NotificationSource& source) {
return map.find(source.map_key()) != map.end();
diff --git a/content/public/browser/notification_service.h b/content/public/browser/notification_service.h
index 006373b..4a6c6c6 100644
--- a/content/public/browser/notification_service.h
+++ b/content/public/browser/notification_service.h
@@ -22,6 +22,8 @@ class CONTENT_EXPORT NotificationService {
// none.
static NotificationService* current();
+ static NotificationService* Create();
+
virtual ~NotificationService() {}
// Synchronously posts a notification to all interested observers.