summaryrefslogtreecommitdiffstats
path: root/chrome/browser/webdata
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-19 23:17:07 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-19 23:17:07 +0000
commitad50def5e1165d0cc74b98f988bbd5962587d9f4 (patch)
tree3a751abaed2cc056ca60b8b1e3ff54532a6f4d3f /chrome/browser/webdata
parent75c920505ddfb2d49c194c76bde64edd6b3f91f2 (diff)
downloadchromium_src-ad50def5e1165d0cc74b98f988bbd5962587d9f4.zip
chromium_src-ad50def5e1165d0cc74b98f988bbd5962587d9f4.tar.gz
chromium_src-ad50def5e1165d0cc74b98f988bbd5962587d9f4.tar.bz2
Make NotificationService an interface in the content namespace, and switch callers to use it. Move the implementation to content/browser. Stop creating it in all child processes since it's only used in the browser.
BUG=98716 Review URL: http://codereview.chromium.org/8342048 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106403 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/webdata')
-rw-r--r--chrome/browser/webdata/autofill_profile_syncable_service.cc3
-rw-r--r--chrome/browser/webdata/web_data_service.cc36
-rw-r--r--chrome/browser/webdata/web_data_service_unittest.cc8
-rw-r--r--chrome/browser/webdata/web_database.cc6
-rw-r--r--chrome/browser/webdata/web_database.h10
5 files changed, 33 insertions, 30 deletions
diff --git a/chrome/browser/webdata/autofill_profile_syncable_service.cc b/chrome/browser/webdata/autofill_profile_syncable_service.cc
index fe1d922..50eaba3 100644
--- a/chrome/browser/webdata/autofill_profile_syncable_service.cc
+++ b/chrome/browser/webdata/autofill_profile_syncable_service.cc
@@ -17,7 +17,8 @@
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/guid.h"
#include "content/browser/browser_thread.h"
-#include "content/common/notification_service.h"
+#include "content/public/browser/notification_details.h"
+#include "content/public/browser/notification_source.h"
namespace {
diff --git a/chrome/browser/webdata/web_data_service.cc b/chrome/browser/webdata/web_data_service.cc
index 893c8d2..5d4a09c 100644
--- a/chrome/browser/webdata/web_data_service.cc
+++ b/chrome/browser/webdata/web_data_service.cc
@@ -25,7 +25,7 @@
#include "chrome/browser/webdata/web_database.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_notification_types.h"
-#include "content/common/notification_service.h"
+#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_source.h"
#include "grit/chromium_strings.h"
@@ -53,10 +53,10 @@ void NotifyOfMultipleAutofillChangesTask(
const scoped_refptr<WebDataService>& web_data_service) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- NotificationService::current()->Notify(
+ content::NotificationService::current()->Notify(
chrome::NOTIFICATION_AUTOFILL_MULTIPLE_CHANGED,
content::Source<WebDataService>(web_data_service.get()),
- NotificationService::NoDetails());
+ content::NotificationService::NoDetails());
}
} // namespace
@@ -641,10 +641,10 @@ void WebDataService::InitializeSyncableServices() {
void WebDataService::NotifyDatabaseLoadedOnUIThread() {
// Notify that the database has been initialized.
- NotificationService::current()->Notify(
+ content::NotificationService::current()->Notify(
chrome::NOTIFICATION_WEB_DATABASE_LOADED,
content::Source<WebDataService>(this),
- NotificationService::NoDetails());
+ content::NotificationService::NoDetails());
}
void WebDataService::ShutdownDatabase() {
@@ -1031,7 +1031,7 @@ void WebDataService::AddFormElementsImpl(
// Post the notifications including the list of affected keys.
// This is sent here so that work resulting from this notification will be
// done on the DB thread, and not the UI thread.
- NotificationService::current()->Notify(
+ content::NotificationService::current()->Notify(
chrome::NOTIFICATION_AUTOFILL_ENTRIES_CHANGED,
content::Source<WebDataService>(this),
content::Details<AutofillChangeList>(&changes));
@@ -1067,7 +1067,7 @@ void WebDataService::RemoveFormElementsAddedBetweenImpl(
// Post the notifications including the list of affected keys.
// This is sent here so that work resulting from this notification
// will be done on the DB thread, and not the UI thread.
- NotificationService::current()->Notify(
+ content::NotificationService::current()->Notify(
chrome::NOTIFICATION_AUTOFILL_ENTRIES_CHANGED,
content::Source<WebDataService>(this),
content::Details<AutofillChangeList>(&changes));
@@ -1094,7 +1094,7 @@ void WebDataService::RemoveFormValueForElementNameImpl(
ScheduleCommit();
// Post the notifications including the list of affected keys.
- NotificationService::current()->Notify(
+ content::NotificationService::current()->Notify(
chrome::NOTIFICATION_AUTOFILL_ENTRIES_CHANGED,
content::Source<WebDataService>(this),
content::Details<AutofillChangeList>(&changes));
@@ -1117,7 +1117,7 @@ void WebDataService::AddAutofillProfileImpl(
// Send GUID-based notification.
AutofillProfileChange change(AutofillProfileChange::ADD,
profile.guid(), &profile);
- NotificationService::current()->Notify(
+ content::NotificationService::current()->Notify(
chrome::NOTIFICATION_AUTOFILL_PROFILE_CHANGED,
content::Source<WebDataService>(this),
content::Details<AutofillProfileChange>(&change));
@@ -1151,7 +1151,7 @@ void WebDataService::UpdateAutofillProfileImpl(
// Send GUID-based notification.
AutofillProfileChange change(AutofillProfileChange::UPDATE,
profile.guid(), &profile);
- NotificationService::current()->Notify(
+ content::NotificationService::current()->Notify(
chrome::NOTIFICATION_AUTOFILL_PROFILE_CHANGED,
content::Source<WebDataService>(this),
content::Details<AutofillProfileChange>(&change));
@@ -1180,7 +1180,7 @@ void WebDataService::RemoveAutofillProfileImpl(
// Send GUID-based notification.
AutofillProfileChange change(AutofillProfileChange::REMOVE, guid, NULL);
- NotificationService::current()->Notify(
+ content::NotificationService::current()->Notify(
chrome::NOTIFICATION_AUTOFILL_PROFILE_CHANGED,
content::Source<WebDataService>(this),
content::Details<AutofillProfileChange>(&change));
@@ -1217,7 +1217,7 @@ void WebDataService::EmptyMigrationTrashImpl(
// Send GUID-based notification.
AutofillProfileChange change(AutofillProfileChange::REMOVE,
*iter, NULL);
- NotificationService::current()->Notify(
+ content::NotificationService::current()->Notify(
chrome::NOTIFICATION_AUTOFILL_PROFILE_CHANGED,
content::Source<WebDataService>(this),
content::Details<AutofillProfileChange>(&change));
@@ -1233,7 +1233,7 @@ void WebDataService::EmptyMigrationTrashImpl(
iter != profiles.end(); ++iter) {
AutofillProfileChange change(AutofillProfileChange::UPDATE,
(*iter)->guid(), *iter);
- NotificationService::current()->Notify(
+ content::NotificationService::current()->Notify(
chrome::NOTIFICATION_AUTOFILL_PROFILE_CHANGED,
content::Source<WebDataService>(this),
content::Details<AutofillProfileChange>(&change));
@@ -1265,7 +1265,7 @@ void WebDataService::AddCreditCardImpl(
// Send GUID-based notification.
AutofillCreditCardChange change(AutofillCreditCardChange::ADD,
credit_card.guid(), &credit_card);
- NotificationService::current()->Notify(
+ content::NotificationService::current()->Notify(
chrome::NOTIFICATION_AUTOFILL_CREDIT_CARD_CHANGED,
content::Source<WebDataService>(this),
content::Details<AutofillCreditCardChange>(&change));
@@ -1298,7 +1298,7 @@ void WebDataService::UpdateCreditCardImpl(
// Send GUID-based notification.
AutofillCreditCardChange change(AutofillCreditCardChange::UPDATE,
credit_card.guid(), &credit_card);
- NotificationService::current()->Notify(
+ content::NotificationService::current()->Notify(
chrome::NOTIFICATION_AUTOFILL_CREDIT_CARD_CHANGED,
content::Source<WebDataService>(this),
content::Details<AutofillCreditCardChange>(&change));
@@ -1320,7 +1320,7 @@ void WebDataService::RemoveCreditCardImpl(
// Send GUID-based notification.
AutofillCreditCardChange change(AutofillCreditCardChange::REMOVE, guid,
NULL);
- NotificationService::current()->Notify(
+ content::NotificationService::current()->Notify(
chrome::NOTIFICATION_AUTOFILL_CREDIT_CARD_CHANGED,
content::Source<WebDataService>(this),
content::Details<AutofillCreditCardChange>(&change));
@@ -1356,7 +1356,7 @@ void WebDataService::RemoveAutofillProfilesAndCreditCardsModifiedBetweenImpl(
iter != profile_guids.end(); ++iter) {
AutofillProfileChange change(AutofillProfileChange::REMOVE, *iter,
NULL);
- NotificationService::current()->Notify(
+ content::NotificationService::current()->Notify(
chrome::NOTIFICATION_AUTOFILL_PROFILE_CHANGED,
content::Source<WebDataService>(this),
content::Details<AutofillProfileChange>(&change));
@@ -1366,7 +1366,7 @@ void WebDataService::RemoveAutofillProfilesAndCreditCardsModifiedBetweenImpl(
iter != credit_card_guids.end(); ++iter) {
AutofillCreditCardChange change(AutofillCreditCardChange::REMOVE,
*iter, NULL);
- NotificationService::current()->Notify(
+ content::NotificationService::current()->Notify(
chrome::NOTIFICATION_AUTOFILL_CREDIT_CARD_CHANGED,
content::Source<WebDataService>(this),
content::Details<AutofillCreditCardChange>(&change));
diff --git a/chrome/browser/webdata/web_data_service_unittest.cc b/chrome/browser/webdata/web_data_service_unittest.cc
index 581b39f..4f3ecac 100644
--- a/chrome/browser/webdata/web_data_service_unittest.cc
+++ b/chrome/browser/webdata/web_data_service_unittest.cc
@@ -29,7 +29,7 @@
#include "chrome/common/guid.h"
#include "chrome/test/base/thread_observer_helper.h"
#include "content/browser/browser_thread.h"
-#include "content/common/notification_service.h"
+#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_details.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -57,13 +57,13 @@ class AutofillDBThreadObserverHelper : public DBThreadObserverHelper {
virtual void RegisterObservers() {
registrar_.Add(&observer_,
chrome::NOTIFICATION_AUTOFILL_ENTRIES_CHANGED,
- NotificationService::AllSources());
+ content::NotificationService::AllSources());
registrar_.Add(&observer_,
chrome::NOTIFICATION_AUTOFILL_PROFILE_CHANGED,
- NotificationService::AllSources());
+ content::NotificationService::AllSources());
registrar_.Add(&observer_,
chrome::NOTIFICATION_AUTOFILL_CREDIT_CARD_CHANGED,
- NotificationService::AllSources());
+ content::NotificationService::AllSources());
}
};
diff --git a/chrome/browser/webdata/web_database.cc b/chrome/browser/webdata/web_database.cc
index 04df4c1..bc21cf1 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/common/notification_service.h"
+#include "content/browser/notification_service_impl.h"
#include "sql/statement.h"
#include "sql/transaction.h"
@@ -91,8 +91,8 @@ sql::Connection* WebDatabase::GetSQLConnection() {
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 (!NotificationService::current())
- notification_service_.reset(new NotificationService);
+ if (!content::NotificationService::current())
+ notification_service_.reset(new NotificationServiceImpl);
// Set the exceptional sqlite error handler.
db_.set_error_delegate(GetErrorHandlerForWebDb());
diff --git a/chrome/browser/webdata/web_database.h b/chrome/browser/webdata/web_database.h
index 5a4f4672..428ad63 100644
--- a/chrome/browser/webdata/web_database.h
+++ b/chrome/browser/webdata/web_database.h
@@ -11,16 +11,18 @@
#include "sql/init_status.h"
#include "sql/meta_table.h"
-class FilePath;
-class NotificationService;
-
class AutofillTable;
+class FilePath;
class KeywordTable;
class LoginsTable;
class TokenServiceTable;
class WebAppsTable;
class WebIntentsTable;
+namespace content {
+class NotificationService;
+}
+
// This class manages a SQLite database that stores various web page meta data.
class WebDatabase {
public:
@@ -60,7 +62,7 @@ class WebDatabase {
scoped_ptr<WebAppsTable> web_apps_table_;
scoped_ptr<WebIntentsTable> web_intents_table_;
- scoped_ptr<NotificationService> notification_service_;
+ scoped_ptr<content::NotificationService> notification_service_;
DISALLOW_COPY_AND_ASSIGN(WebDatabase);
};