OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_ | 5 #ifndef CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_ |
6 #define CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_ | 6 #define CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <deque> | 9 #include <deque> |
10 #include <map> | 10 #include <map> |
(...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1027 | 1027 |
1028 virtual void OnPasswordStoreRequestDone( | 1028 virtual void OnPasswordStoreRequestDone( |
1029 CancelableRequestProvider::Handle handle, | 1029 CancelableRequestProvider::Handle handle, |
1030 const std::vector<webkit_glue::PasswordForm*>& result); | 1030 const std::vector<webkit_glue::PasswordForm*>& result); |
1031 | 1031 |
1032 private: | 1032 private: |
1033 base::WeakPtr<AutomationProvider> provider_; | 1033 base::WeakPtr<AutomationProvider> provider_; |
1034 scoped_ptr<IPC::Message> reply_message_; | 1034 scoped_ptr<IPC::Message> reply_message_; |
1035 }; | 1035 }; |
1036 | 1036 |
| 1037 // Observes when login entries stored in the password store are changed. The |
| 1038 // notifications are sent on BrowserThread::DB, the thread that interacts with |
| 1039 // the web database. |
| 1040 class PasswordStoreLoginsChangedObserver |
| 1041 : public base::RefCountedThreadSafe< |
| 1042 PasswordStoreLoginsChangedObserver, |
| 1043 BrowserThread::DeleteOnUIThread>, |
| 1044 public NotificationObserver { |
| 1045 public: |
| 1046 PasswordStoreLoginsChangedObserver(AutomationProvider* automation, |
| 1047 IPC::Message* reply_message, |
| 1048 const std::string& result_key); |
| 1049 virtual ~PasswordStoreLoginsChangedObserver(); |
| 1050 |
| 1051 // Schedules a task on the BrowserThread::DB thread to register the |
| 1052 // appropriate observers. |
| 1053 virtual void Init(); |
| 1054 |
| 1055 // NotificationObserver interface. |
| 1056 virtual void Observe(NotificationType type, |
| 1057 const NotificationSource& source, |
| 1058 const NotificationDetails& details); |
| 1059 |
| 1060 private: |
| 1061 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; |
| 1062 friend class DeleteTask<PasswordStoreLoginsChangedObserver>; |
| 1063 |
| 1064 // Registers the appropriate observers. Called on thread BrowserThread::DB. |
| 1065 void RegisterObserversTask(); |
| 1066 |
| 1067 // Sends the |reply_message_| to |automation_| indicating we're done. Called |
| 1068 // on thread BrowserThread::UI (the main browser UI thread). |
| 1069 void IndicateDone(); |
| 1070 |
| 1071 base::WeakPtr<AutomationProvider> automation_; |
| 1072 scoped_ptr<IPC::Message> reply_message_; |
| 1073 NotificationRegistrar registrar_; |
| 1074 std::string result_key_; |
| 1075 |
| 1076 // Used to ensure that thread BrowserThread::UI waits for thread |
| 1077 // BrowserThread::DB to finish registering observers before proceeding. |
| 1078 base::WaitableEvent done_event_; |
| 1079 |
| 1080 DISALLOW_COPY_AND_ASSIGN(PasswordStoreLoginsChangedObserver); |
| 1081 }; |
| 1082 |
1037 // Allows the automation provider to wait for clearing browser data to finish. | 1083 // Allows the automation provider to wait for clearing browser data to finish. |
1038 class AutomationProviderBrowsingDataObserver | 1084 class AutomationProviderBrowsingDataObserver |
1039 : public BrowsingDataRemover::Observer { | 1085 : public BrowsingDataRemover::Observer { |
1040 public: | 1086 public: |
1041 AutomationProviderBrowsingDataObserver( | 1087 AutomationProviderBrowsingDataObserver( |
1042 AutomationProvider* provider, | 1088 AutomationProvider* provider, |
1043 IPC::Message* reply_message); | 1089 IPC::Message* reply_message); |
1044 virtual ~AutomationProviderBrowsingDataObserver(); | 1090 virtual ~AutomationProviderBrowsingDataObserver(); |
1045 | 1091 |
1046 virtual void OnBrowsingDataRemoverDone(); | 1092 virtual void OnBrowsingDataRemoverDone(); |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1451 // Sends the |reply_message_| to |automation_| indicating we're done. | 1497 // Sends the |reply_message_| to |automation_| indicating we're done. |
1452 void RunOnUIThread(); | 1498 void RunOnUIThread(); |
1453 | 1499 |
1454 base::WeakPtr<AutomationProvider> automation_; | 1500 base::WeakPtr<AutomationProvider> automation_; |
1455 scoped_ptr<IPC::Message> reply_message_; | 1501 scoped_ptr<IPC::Message> reply_message_; |
1456 | 1502 |
1457 DISALLOW_COPY_AND_ASSIGN(WaitForProcessLauncherThreadToGoIdleObserver); | 1503 DISALLOW_COPY_AND_ASSIGN(WaitForProcessLauncherThreadToGoIdleObserver); |
1458 }; | 1504 }; |
1459 | 1505 |
1460 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_ | 1506 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_ |
OLD | NEW |