Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(292)

Unified Diff: chrome/browser/automation/automation_provider_observers.h

Issue 6994005: Fix password automation hooks to get pyauto test testSavePassword working. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Disabling a single pyauto passwords test. Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 653a092079ceff863b6e9a35ad0169e13900a9b2..31edcddc56b5464aeab911568380701dc6d27e3f 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_;
+ const 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 {

Powered by Google App Engine
This is Rietveld 408576698