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

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: Modified PYAUTO_TESTS. 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 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 {
« no previous file with comments | « no previous file | chrome/browser/automation/automation_provider_observers.cc » ('j') | chrome/test/functional/passwords.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698