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 1626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1637 private: | 1637 private: |
1638 content::NotificationRegistrar registrar_; | 1638 content::NotificationRegistrar registrar_; |
1639 base::WeakPtr<AutomationProvider> automation_; | 1639 base::WeakPtr<AutomationProvider> automation_; |
1640 scoped_ptr<IPC::Message> reply_message_; | 1640 scoped_ptr<IPC::Message> reply_message_; |
1641 int event_type_; | 1641 int event_type_; |
1642 int count_; | 1642 int count_; |
1643 | 1643 |
1644 DISALLOW_COPY_AND_ASSIGN(InputEventAckNotificationObserver); | 1644 DISALLOW_COPY_AND_ASSIGN(InputEventAckNotificationObserver); |
1645 }; | 1645 }; |
1646 | 1646 |
1647 // Allows the automation provider to wait for all the tabs to finish any | 1647 // Allows the automation provider to wait for all render views to finish any |
1648 // pending loads. This only waits for tabs that exist at the observer's | 1648 // pending loads. This wait is only guaranteed for views that exist at the |
1649 // creation. Will send a message on construction if no tabs are loading | 1649 // observer's creation. Will send a message on construction if no views are |
1650 // currently. | 1650 // currently loading. |
1651 class AllTabsStoppedLoadingObserver : public TabEventObserver, | 1651 class AllViewsStoppedLoadingObserver : public TabEventObserver, |
1652 public content::NotificationObserver { | 1652 public content::NotificationObserver { |
1653 public: | 1653 public: |
1654 AllTabsStoppedLoadingObserver(AutomationProvider* automation, | 1654 AllViewsStoppedLoadingObserver( |
1655 IPC::Message* reply_message); | 1655 AutomationProvider* automation, |
1656 virtual ~AllTabsStoppedLoadingObserver(); | 1656 IPC::Message* reply_message, |
| 1657 ExtensionProcessManager* extension_process_manager); |
| 1658 virtual ~AllViewsStoppedLoadingObserver(); |
1657 | 1659 |
1658 // TabEventObserver implementation. | 1660 // TabEventObserver implementation. |
1659 virtual void OnFirstPendingLoad(TabContents* tab_contents) OVERRIDE; | 1661 virtual void OnFirstPendingLoad(TabContents* tab_contents) OVERRIDE; |
1660 virtual void OnNoMorePendingLoads(TabContents* tab_contents) OVERRIDE; | 1662 virtual void OnNoMorePendingLoads(TabContents* tab_contents) OVERRIDE; |
1661 | 1663 |
1662 // content::NotificationObserver implementation. | 1664 // content::NotificationObserver implementation. |
1663 virtual void Observe(int type, | 1665 virtual void Observe(int type, |
1664 const content::NotificationSource& source, | 1666 const content::NotificationSource& source, |
1665 const content::NotificationDetails& details) OVERRIDE; | 1667 const content::NotificationDetails& details) OVERRIDE; |
1666 | 1668 |
1667 private: | 1669 private: |
1668 typedef std::set<TabContents*> TabSet; | 1670 typedef std::set<TabContents*> TabSet; |
1669 | 1671 |
1670 // Checks if there are no pending loads. If none, it will send an automation | 1672 // Checks if there are no pending loads. If none, it will send an automation |
1671 // relpy and delete itself. | 1673 // relpy and delete itself. |
1672 void CheckIfNoMorePendingLoads(); | 1674 void CheckIfNoMorePendingLoads(); |
1673 | 1675 |
1674 TabSet pending_tabs_; | |
1675 content::NotificationRegistrar registrar_; | |
1676 base::WeakPtr<AutomationProvider> automation_; | 1676 base::WeakPtr<AutomationProvider> automation_; |
1677 scoped_ptr<IPC::Message> reply_message_; | 1677 scoped_ptr<IPC::Message> reply_message_; |
| 1678 ExtensionProcessManager* extension_process_manager_; |
| 1679 content::NotificationRegistrar registrar_; |
| 1680 TabSet pending_tabs_; |
1678 | 1681 |
1679 DISALLOW_COPY_AND_ASSIGN(AllTabsStoppedLoadingObserver); | 1682 DISALLOW_COPY_AND_ASSIGN(AllViewsStoppedLoadingObserver); |
1680 }; | 1683 }; |
1681 | 1684 |
1682 // Observer used to listen for new tab creation to complete. | 1685 // Observer used to listen for new tab creation to complete. |
1683 class NewTabObserver : public content::NotificationObserver { | 1686 class NewTabObserver : public content::NotificationObserver { |
1684 public: | 1687 public: |
1685 NewTabObserver(AutomationProvider* automation, IPC::Message* reply_message); | 1688 NewTabObserver(AutomationProvider* automation, IPC::Message* reply_message); |
1686 | 1689 |
1687 virtual void Observe(int type, | 1690 virtual void Observe(int type, |
1688 const content::NotificationSource& source, | 1691 const content::NotificationSource& source, |
1689 const content::NotificationDetails& details) OVERRIDE; | 1692 const content::NotificationDetails& details) OVERRIDE; |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1832 | 1835 |
1833 base::WeakPtr<AutomationProvider> automation_; | 1836 base::WeakPtr<AutomationProvider> automation_; |
1834 scoped_ptr<IPC::Message> reply_message_; | 1837 scoped_ptr<IPC::Message> reply_message_; |
1835 std::vector<policy::ConfigurationPolicyObserverRegistrar*> registrars_; | 1838 std::vector<policy::ConfigurationPolicyObserverRegistrar*> registrars_; |
1836 | 1839 |
1837 DISALLOW_COPY_AND_ASSIGN(PolicyUpdatesObserver); | 1840 DISALLOW_COPY_AND_ASSIGN(PolicyUpdatesObserver); |
1838 }; | 1841 }; |
1839 | 1842 |
1840 #endif // defined(ENABLE_CONFIGURATION_POLICY) | 1843 #endif // defined(ENABLE_CONFIGURATION_POLICY) |
1841 | 1844 |
| 1845 // Waits for an extension popup to appear and load. |
| 1846 class ExtensionPopupObserver : public content::NotificationObserver { |
| 1847 public: |
| 1848 ExtensionPopupObserver( |
| 1849 AutomationProvider* automation, |
| 1850 IPC::Message* reply_message, |
| 1851 const std::string& extension_id); |
| 1852 ~ExtensionPopupObserver(); |
| 1853 |
| 1854 virtual void Observe(int type, |
| 1855 const content::NotificationSource& source, |
| 1856 const content::NotificationDetails& details) OVERRIDE; |
| 1857 |
| 1858 private: |
| 1859 base::WeakPtr<AutomationProvider> automation_; |
| 1860 scoped_ptr<IPC::Message> reply_message_; |
| 1861 std::string extension_id_; |
| 1862 content::NotificationRegistrar registrar_; |
| 1863 |
| 1864 DISALLOW_COPY_AND_ASSIGN(ExtensionPopupObserver); |
| 1865 }; |
| 1866 |
1842 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_ | 1867 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_ |
OLD | NEW |