summaryrefslogtreecommitdiffstats
path: root/chrome/browser/password_manager
diff options
context:
space:
mode:
authoralbertb@chromium.org <albertb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-11 17:32:03 +0000
committeralbertb@chromium.org <albertb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-11 17:32:03 +0000
commit45062a2b130b7b3cf89397f8439441ec3f3b7637 (patch)
tree17782f32550d0d38bcf44f94b41d6bc71a043b9f /chrome/browser/password_manager
parent618a4ac762817cdd51bf0d30b36cfeffd41b0507 (diff)
downloadchromium_src-45062a2b130b7b3cf89397f8439441ec3f3b7637.zip
chromium_src-45062a2b130b7b3cf89397f8439441ec3f3b7637.tar.gz
chromium_src-45062a2b130b7b3cf89397f8439441ec3f3b7637.tar.bz2
Set the source of the password store notifications to the PasswordStore
sending out the notification. This is needed for the password integration tests. BUG=none TEST=unit tests Review URL: http://codereview.chromium.org/3529027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62156 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/password_manager')
-rw-r--r--chrome/browser/password_manager/password_store_default.cc8
-rw-r--r--chrome/browser/password_manager/password_store_default_unittest.cc18
-rw-r--r--chrome/browser/password_manager/password_store_mac.cc8
-rw-r--r--chrome/browser/password_manager/password_store_x.cc14
4 files changed, 25 insertions, 23 deletions
diff --git a/chrome/browser/password_manager/password_store_default.cc b/chrome/browser/password_manager/password_store_default.cc
index 3aa1323..c0753b4 100644
--- a/chrome/browser/password_manager/password_store_default.cc
+++ b/chrome/browser/password_manager/password_store_default.cc
@@ -44,7 +44,7 @@ void PasswordStoreDefault::AddLoginImpl(const PasswordForm& form) {
changes.push_back(PasswordStoreChange(PasswordStoreChange::ADD, form));
NotificationService::current()->Notify(
NotificationType::LOGINS_CHANGED,
- NotificationService::AllSources(),
+ Source<PasswordStore>(this),
Details<PasswordStoreChangeList>(&changes));
}
}
@@ -55,7 +55,7 @@ void PasswordStoreDefault::UpdateLoginImpl(const PasswordForm& form) {
changes.push_back(PasswordStoreChange(PasswordStoreChange::UPDATE, form));
NotificationService::current()->Notify(
NotificationType::LOGINS_CHANGED,
- NotificationService::AllSources(),
+ Source<PasswordStore>(this),
Details<PasswordStoreChangeList>(&changes));
}
}
@@ -66,7 +66,7 @@ void PasswordStoreDefault::RemoveLoginImpl(const PasswordForm& form) {
changes.push_back(PasswordStoreChange(PasswordStoreChange::REMOVE, form));
NotificationService::current()->Notify(
NotificationType::LOGINS_CHANGED,
- NotificationService::AllSources(),
+ Source<PasswordStore>(this),
Details<PasswordStoreChangeList>(&changes));
}
}
@@ -84,7 +84,7 @@ void PasswordStoreDefault::RemoveLoginsCreatedBetweenImpl(
}
NotificationService::current()->Notify(
NotificationType::LOGINS_CHANGED,
- NotificationService::AllSources(),
+ Source<PasswordStore>(this),
Details<PasswordStoreChangeList>(&changes));
}
}
diff --git a/chrome/browser/password_manager/password_store_default_unittest.cc b/chrome/browser/password_manager/password_store_default_unittest.cc
index 31200d5..d657582 100644
--- a/chrome/browser/password_manager/password_store_default_unittest.cc
+++ b/chrome/browser/password_manager/password_store_default_unittest.cc
@@ -59,12 +59,14 @@ class DBThreadObserverHelper :
public:
DBThreadObserverHelper() : done_event_(true, false) {}
- void Init() {
+ void Init(PasswordStore* password_store) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
BrowserThread::PostTask(
BrowserThread::DB,
FROM_HERE,
- NewRunnableMethod(this, &DBThreadObserverHelper::AddObserverTask));
+ NewRunnableMethod(this,
+ &DBThreadObserverHelper::AddObserverTask,
+ password_store));
done_event_.Wait();
}
@@ -80,11 +82,11 @@ class DBThreadObserverHelper :
protected:
friend class base::RefCountedThreadSafe<DBThreadObserverHelper>;
- void AddObserverTask() {
+ void AddObserverTask(PasswordStore* password_store) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
registrar_.Add(&observer_,
NotificationType::LOGINS_CHANGED,
- NotificationService::AllSources());
+ Source<PasswordStore>(password_store));
done_event_.Signal();
}
@@ -448,7 +450,7 @@ TEST_F(PasswordStoreDefaultTest, Notifications) {
scoped_ptr<PasswordForm> form(CreatePasswordFormFromData(form_data));
scoped_refptr<DBThreadObserverHelper> helper = new DBThreadObserverHelper;
- helper->Init();
+ helper->Init(store);
const PasswordStoreChange expected_add_changes[] = {
PasswordStoreChange(PasswordStoreChange::ADD, *form),
@@ -456,7 +458,7 @@ TEST_F(PasswordStoreDefaultTest, Notifications) {
EXPECT_CALL(helper->observer(),
Observe(NotificationType(NotificationType::LOGINS_CHANGED),
- NotificationService::AllSources(),
+ Source<PasswordStore>(store),
Property(&Details<const PasswordStoreChangeList>::ptr,
Pointee(ElementsAreArray(
expected_add_changes)))));
@@ -480,7 +482,7 @@ TEST_F(PasswordStoreDefaultTest, Notifications) {
EXPECT_CALL(helper->observer(),
Observe(NotificationType(NotificationType::LOGINS_CHANGED),
- NotificationService::AllSources(),
+ Source<PasswordStore>(store),
Property(&Details<const PasswordStoreChangeList>::ptr,
Pointee(ElementsAreArray(
expected_update_changes)))));
@@ -499,7 +501,7 @@ TEST_F(PasswordStoreDefaultTest, Notifications) {
EXPECT_CALL(helper->observer(),
Observe(NotificationType(NotificationType::LOGINS_CHANGED),
- NotificationService::AllSources(),
+ Source<PasswordStore>(store),
Property(&Details<const PasswordStoreChangeList>::ptr,
Pointee(ElementsAreArray(
expected_delete_changes)))));
diff --git a/chrome/browser/password_manager/password_store_mac.cc b/chrome/browser/password_manager/password_store_mac.cc
index 2b26c5a..0a0a88b 100644
--- a/chrome/browser/password_manager/password_store_mac.cc
+++ b/chrome/browser/password_manager/password_store_mac.cc
@@ -769,7 +769,7 @@ void PasswordStoreMac::AddLoginImpl(const PasswordForm& form) {
changes.push_back(PasswordStoreChange(PasswordStoreChange::ADD, form));
NotificationService::current()->Notify(
NotificationType::LOGINS_CHANGED,
- NotificationService::AllSources(),
+ Source<PasswordStore>(this),
Details<PasswordStoreChangeList>(&changes));
}
}
@@ -804,7 +804,7 @@ void PasswordStoreMac::UpdateLoginImpl(const PasswordForm& form) {
if (!changes.empty()) {
NotificationService::current()->Notify(
NotificationType::LOGINS_CHANGED,
- NotificationService::AllSources(),
+ Source<PasswordStore>(this),
Details<PasswordStoreChangeList>(&changes));
}
}
@@ -835,7 +835,7 @@ void PasswordStoreMac::RemoveLoginImpl(const PasswordForm& form) {
changes.push_back(PasswordStoreChange(PasswordStoreChange::REMOVE, form));
NotificationService::current()->Notify(
NotificationType::LOGINS_CHANGED,
- NotificationService::AllSources(),
+ Source<PasswordStore>(this),
Details<PasswordStoreChangeList>(&changes));
}
}
@@ -869,7 +869,7 @@ void PasswordStoreMac::RemoveLoginsCreatedBetweenImpl(
}
NotificationService::current()->Notify(
NotificationType::LOGINS_CHANGED,
- NotificationService::AllSources(),
+ Source<PasswordStore>(this),
Details<PasswordStoreChangeList>(&changes));
}
}
diff --git a/chrome/browser/password_manager/password_store_x.cc b/chrome/browser/password_manager/password_store_x.cc
index 9132da5..39418d8 100644
--- a/chrome/browser/password_manager/password_store_x.cc
+++ b/chrome/browser/password_manager/password_store_x.cc
@@ -17,9 +17,9 @@ using std::vector;
using webkit_glue::PasswordForm;
PasswordStoreX::PasswordStoreX(LoginDatabase* login_db,
- Profile* profile,
- WebDataService* web_data_service,
- NativeBackend* backend)
+ Profile* profile,
+ WebDataService* web_data_service,
+ NativeBackend* backend)
: PasswordStoreDefault(login_db, profile, web_data_service),
backend_(backend), migration_checked_(!backend), allow_fallback_(false) {
}
@@ -34,7 +34,7 @@ void PasswordStoreX::AddLoginImpl(const PasswordForm& form) {
changes.push_back(PasswordStoreChange(PasswordStoreChange::ADD, form));
NotificationService::current()->Notify(
NotificationType::LOGINS_CHANGED,
- NotificationService::AllSources(),
+ Source<PasswordStore>(this),
Details<PasswordStoreChangeList>(&changes));
allow_fallback_ = false;
} else if (allow_default_store()) {
@@ -49,7 +49,7 @@ void PasswordStoreX::UpdateLoginImpl(const PasswordForm& form) {
changes.push_back(PasswordStoreChange(PasswordStoreChange::UPDATE, form));
NotificationService::current()->Notify(
NotificationType::LOGINS_CHANGED,
- NotificationService::AllSources(),
+ Source<PasswordStore>(this),
Details<PasswordStoreChangeList>(&changes));
allow_fallback_ = false;
} else if (allow_default_store()) {
@@ -64,7 +64,7 @@ void PasswordStoreX::RemoveLoginImpl(const PasswordForm& form) {
changes.push_back(PasswordStoreChange(PasswordStoreChange::REMOVE, form));
NotificationService::current()->Notify(
NotificationType::LOGINS_CHANGED,
- NotificationService::AllSources(),
+ Source<PasswordStore>(this),
Details<PasswordStoreChangeList>(&changes));
allow_fallback_ = false;
} else if (allow_default_store()) {
@@ -88,7 +88,7 @@ void PasswordStoreX::RemoveLoginsCreatedBetweenImpl(
}
NotificationService::current()->Notify(
NotificationType::LOGINS_CHANGED,
- NotificationService::AllSources(),
+ Source<PasswordStore>(this),
Details<PasswordStoreChangeList>(&changes));
allow_fallback_ = false;
} else if (allow_default_store()) {