| 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 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1234   base::WeakPtr<AutomationProvider> provider_; |  1234   base::WeakPtr<AutomationProvider> provider_; | 
|  1235   scoped_ptr<IPC::Message> reply_message_; |  1235   scoped_ptr<IPC::Message> reply_message_; | 
|  1236 }; |  1236 }; | 
|  1237  |  1237  | 
|  1238 // Observes when login entries stored in the password store are changed.  The |  1238 // Observes when login entries stored in the password store are changed.  The | 
|  1239 // notifications are sent on the DB thread, the thread that interacts with the |  1239 // notifications are sent on the DB thread, the thread that interacts with the | 
|  1240 // web database. |  1240 // web database. | 
|  1241 class PasswordStoreLoginsChangedObserver |  1241 class PasswordStoreLoginsChangedObserver | 
|  1242     : public base::RefCountedThreadSafe< |  1242     : public base::RefCountedThreadSafe< | 
|  1243           PasswordStoreLoginsChangedObserver, |  1243           PasswordStoreLoginsChangedObserver, | 
|  1244           BrowserThread::DeleteOnUIThread>, |  1244           content::BrowserThread::DeleteOnUIThread>, | 
|  1245       public content::NotificationObserver { |  1245       public content::NotificationObserver { | 
|  1246  public: |  1246  public: | 
|  1247   PasswordStoreLoginsChangedObserver(AutomationProvider* automation, |  1247   PasswordStoreLoginsChangedObserver(AutomationProvider* automation, | 
|  1248                                      IPC::Message* reply_message, |  1248                                      IPC::Message* reply_message, | 
|  1249                                      PasswordStoreChange::Type expected_type, |  1249                                      PasswordStoreChange::Type expected_type, | 
|  1250                                      const std::string& result_key); |  1250                                      const std::string& result_key); | 
|  1251   virtual ~PasswordStoreLoginsChangedObserver(); |  1251   virtual ~PasswordStoreLoginsChangedObserver(); | 
|  1252  |  1252  | 
|  1253   // Schedules a task on the DB thread to register the appropriate observers. |  1253   // Schedules a task on the DB thread to register the appropriate observers. | 
|  1254   virtual void Init(); |  1254   virtual void Init(); | 
|  1255  |  1255  | 
|  1256   // content::NotificationObserver interface. |  1256   // content::NotificationObserver interface. | 
|  1257   virtual void Observe(int type, |  1257   virtual void Observe(int type, | 
|  1258                        const content::NotificationSource& source, |  1258                        const content::NotificationSource& source, | 
|  1259                        const content::NotificationDetails& details); |  1259                        const content::NotificationDetails& details); | 
|  1260  |  1260  | 
|  1261  private: |  1261  private: | 
|  1262   friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; |  1262   friend struct content::BrowserThread::DeleteOnThread< | 
 |  1263       content::BrowserThread::UI>; | 
|  1263   friend class DeleteTask<PasswordStoreLoginsChangedObserver>; |  1264   friend class DeleteTask<PasswordStoreLoginsChangedObserver>; | 
|  1264  |  1265  | 
|  1265   // Registers the appropriate observers.  Called on the DB thread. |  1266   // Registers the appropriate observers.  Called on the DB thread. | 
|  1266   void RegisterObserversTask(); |  1267   void RegisterObserversTask(); | 
|  1267  |  1268  | 
|  1268   // Sends the |reply_message_| to |automation_| indicating we're done.  Called |  1269   // Sends the |reply_message_| to |automation_| indicating we're done.  Called | 
|  1269   // on the UI thread. |  1270   // on the UI thread. | 
|  1270   void IndicateDone(); |  1271   void IndicateDone(); | 
|  1271  |  1272  | 
|  1272   // Sends an error reply to |automation_|.  Called on the UI thread. |  1273   // Sends an error reply to |automation_|.  Called on the UI thread. | 
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1457  |  1458  | 
|  1458   DISALLOW_COPY_AND_ASSIGN(AutofillDisplayedObserver); |  1459   DISALLOW_COPY_AND_ASSIGN(AutofillDisplayedObserver); | 
|  1459 }; |  1460 }; | 
|  1460  |  1461  | 
|  1461 // Observes when a specified number of autofill profiles and credit cards have |  1462 // Observes when a specified number of autofill profiles and credit cards have | 
|  1462 // been changed in the WebDataService.  The notifications are sent on the DB |  1463 // been changed in the WebDataService.  The notifications are sent on the DB | 
|  1463 // thread, the thread that interacts with the database. |  1464 // thread, the thread that interacts with the database. | 
|  1464 class AutofillChangedObserver |  1465 class AutofillChangedObserver | 
|  1465     : public base::RefCountedThreadSafe< |  1466     : public base::RefCountedThreadSafe< | 
|  1466           AutofillChangedObserver, |  1467           AutofillChangedObserver, | 
|  1467           BrowserThread::DeleteOnUIThread>, |  1468           content::BrowserThread::DeleteOnUIThread>, | 
|  1468       public content::NotificationObserver { |  1469       public content::NotificationObserver { | 
|  1469  public: |  1470  public: | 
|  1470   AutofillChangedObserver(AutomationProvider* automation, |  1471   AutofillChangedObserver(AutomationProvider* automation, | 
|  1471                           IPC::Message* reply_message, |  1472                           IPC::Message* reply_message, | 
|  1472                           int num_profiles, |  1473                           int num_profiles, | 
|  1473                           int num_credit_cards); |  1474                           int num_credit_cards); | 
|  1474   virtual ~AutofillChangedObserver(); |  1475   virtual ~AutofillChangedObserver(); | 
|  1475  |  1476  | 
|  1476   // Schedules a task on the DB thread to register the appropriate observers. |  1477   // Schedules a task on the DB thread to register the appropriate observers. | 
|  1477   virtual void Init(); |  1478   virtual void Init(); | 
|  1478  |  1479  | 
|  1479   // content::NotificationObserver interface. |  1480   // content::NotificationObserver interface. | 
|  1480   virtual void Observe(int type, |  1481   virtual void Observe(int type, | 
|  1481                        const content::NotificationSource& source, |  1482                        const content::NotificationSource& source, | 
|  1482                        const content::NotificationDetails& details); |  1483                        const content::NotificationDetails& details); | 
|  1483  |  1484  | 
|  1484  private: |  1485  private: | 
|  1485   friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; |  1486   friend struct content::BrowserThread::DeleteOnThread< | 
 |  1487       content::BrowserThread::UI>; | 
|  1486   friend class DeleteTask<AutofillChangedObserver>; |  1488   friend class DeleteTask<AutofillChangedObserver>; | 
|  1487  |  1489  | 
|  1488   // Registers the appropriate observers.  Called on the DB thread. |  1490   // Registers the appropriate observers.  Called on the DB thread. | 
|  1489   void RegisterObserversTask(); |  1491   void RegisterObserversTask(); | 
|  1490  |  1492  | 
|  1491   // Sends the |reply_message_| to |automation_| indicating we're done.  Called |  1493   // Sends the |reply_message_| to |automation_| indicating we're done.  Called | 
|  1492   // on the UI thread. |  1494   // on the UI thread. | 
|  1493   void IndicateDone(); |  1495   void IndicateDone(); | 
|  1494  |  1496  | 
|  1495   base::WeakPtr<AutomationProvider> automation_; |  1497   base::WeakPtr<AutomationProvider> automation_; | 
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1705   scoped_ptr<IPC::Message> reply_message_; |  1707   scoped_ptr<IPC::Message> reply_message_; | 
|  1706  |  1708  | 
|  1707   DISALLOW_COPY_AND_ASSIGN(NewTabObserver); |  1709   DISALLOW_COPY_AND_ASSIGN(NewTabObserver); | 
|  1708 }; |  1710 }; | 
|  1709  |  1711  | 
|  1710 // Posts a task to the PROCESS_LAUNCHER thread, once processed posts a task |  1712 // Posts a task to the PROCESS_LAUNCHER thread, once processed posts a task | 
|  1711 // back to the UI thread that notifies the provider we're done. |  1713 // back to the UI thread that notifies the provider we're done. | 
|  1712 class WaitForProcessLauncherThreadToGoIdleObserver |  1714 class WaitForProcessLauncherThreadToGoIdleObserver | 
|  1713     : public base::RefCountedThreadSafe< |  1715     : public base::RefCountedThreadSafe< | 
|  1714           WaitForProcessLauncherThreadToGoIdleObserver, |  1716           WaitForProcessLauncherThreadToGoIdleObserver, | 
|  1715           BrowserThread::DeleteOnUIThread> { |  1717           content::BrowserThread::DeleteOnUIThread> { | 
|  1716  public: |  1718  public: | 
|  1717   WaitForProcessLauncherThreadToGoIdleObserver( |  1719   WaitForProcessLauncherThreadToGoIdleObserver( | 
|  1718       AutomationProvider* automation, IPC::Message* reply_message); |  1720       AutomationProvider* automation, IPC::Message* reply_message); | 
|  1719  |  1721  | 
|  1720  private: |  1722  private: | 
|  1721   friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; |  1723   friend struct content::BrowserThread::DeleteOnThread< | 
 |  1724       content::BrowserThread::UI>; | 
|  1722   friend class DeleteTask<WaitForProcessLauncherThreadToGoIdleObserver>; |  1725   friend class DeleteTask<WaitForProcessLauncherThreadToGoIdleObserver>; | 
|  1723  |  1726  | 
|  1724   virtual ~WaitForProcessLauncherThreadToGoIdleObserver(); |  1727   virtual ~WaitForProcessLauncherThreadToGoIdleObserver(); | 
|  1725  |  1728  | 
|  1726   // Schedules a task on the PROCESS_LAUNCHER thread to execute |  1729   // Schedules a task on the PROCESS_LAUNCHER thread to execute | 
|  1727   // |RunOnProcessLauncherThread2|. By the time the task is executed the |  1730   // |RunOnProcessLauncherThread2|. By the time the task is executed the | 
|  1728   // PROCESS_LAUNCHER thread should be some what idle. |  1731   // PROCESS_LAUNCHER thread should be some what idle. | 
|  1729   void RunOnProcessLauncherThread(); |  1732   void RunOnProcessLauncherThread(); | 
|  1730  |  1733  | 
|  1731   // When executed the PROCESS_LAUNCHER thread should have processed any pending |  1734   // When executed the PROCESS_LAUNCHER thread should have processed any pending | 
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1802  private: |  1805  private: | 
|  1803   content::NotificationRegistrar registrar_; |  1806   content::NotificationRegistrar registrar_; | 
|  1804   base::WeakPtr<AutomationProvider> automation_; |  1807   base::WeakPtr<AutomationProvider> automation_; | 
|  1805   scoped_ptr<IPC::Message> reply_message_; |  1808   scoped_ptr<IPC::Message> reply_message_; | 
|  1806   int new_window_id_; |  1809   int new_window_id_; | 
|  1807  |  1810  | 
|  1808   DISALLOW_COPY_AND_ASSIGN(BrowserOpenedWithNewProfileNotificationObserver); |  1811   DISALLOW_COPY_AND_ASSIGN(BrowserOpenedWithNewProfileNotificationObserver); | 
|  1809 }; |  1812 }; | 
|  1810  |  1813  | 
|  1811 #endif  // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_ |  1814 #endif  // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_ | 
| OLD | NEW |