Index: chrome/browser/automation/automation_provider_observers.h |
diff --git a/chrome/browser/automation/automation_provider_observers.h b/chrome/browser/automation/automation_provider_observers.h |
index 65e89a3f94e55d6f85c620d47f91a92dcca73de0..722607bb46a65516c25836a5c0b7bb31acd36a85 100644 |
--- a/chrome/browser/automation/automation_provider_observers.h |
+++ b/chrome/browser/automation/automation_provider_observers.h |
@@ -1034,6 +1034,52 @@ class AutomationProviderGetPasswordsObserver : public PasswordStoreConsumer { |
scoped_ptr<IPC::Message> reply_message_; |
}; |
+// Observes when login entries stored in the password store are changed. The |
+// notifications are sent on BrowserThread::DB, the thread that interacts with |
+// the web database. |
+class PasswordStoreLoginsChangedObserver |
+ : public base::RefCountedThreadSafe< |
+ PasswordStoreLoginsChangedObserver, |
+ BrowserThread::DeleteOnUIThread>, |
+ public NotificationObserver { |
+ public: |
+ PasswordStoreLoginsChangedObserver(AutomationProvider* automation, |
+ IPC::Message* reply_message, |
+ const std::string& result_key); |
+ virtual ~PasswordStoreLoginsChangedObserver(); |
+ |
+ // Schedules a task on the BrowserThread::DB thread to register the |
+ // appropriate observers. |
+ virtual void Init(); |
+ |
+ // NotificationObserver interface. |
+ virtual void Observe(NotificationType type, |
+ const NotificationSource& source, |
+ const NotificationDetails& details); |
+ |
+ private: |
+ friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; |
+ friend class DeleteTask<PasswordStoreLoginsChangedObserver>; |
+ |
+ // Registers the appropriate observers. Called on thread BrowserThread::DB. |
+ void RegisterObserversTask(); |
+ |
+ // Sends the |reply_message_| to |automation_| indicating we're done. Called |
+ // on thread BrowserThread::UI (the main browser UI thread). |
+ void IndicateDone(); |
+ |
+ base::WeakPtr<AutomationProvider> automation_; |
+ scoped_ptr<IPC::Message> reply_message_; |
+ NotificationRegistrar registrar_; |
+ std::string result_key_; |
+ |
+ // Used to ensure that thread BrowserThread::UI waits for thread |
+ // BrowserThread::DB to finish registering observers before proceeding. |
+ base::WaitableEvent done_event_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(PasswordStoreLoginsChangedObserver); |
+}; |
+ |
// Allows the automation provider to wait for clearing browser data to finish. |
class AutomationProviderBrowsingDataObserver |
: public BrowsingDataRemover::Observer { |