| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 24 matching lines...) Expand all Loading... |
| 35 #include "chrome/browser/chromeos/options/take_photo_dialog.h" | 35 #include "chrome/browser/chromeos/options/take_photo_dialog.h" |
| 36 #endif // defined(OS_CHROMEOS) | 36 #endif // defined(OS_CHROMEOS) |
| 37 #include "chrome/browser/cancelable_request.h" | 37 #include "chrome/browser/cancelable_request.h" |
| 38 #include "chrome/browser/history/history.h" | 38 #include "chrome/browser/history/history.h" |
| 39 #include "chrome/browser/history/history_types.h" | 39 #include "chrome/browser/history/history_types.h" |
| 40 #include "chrome/browser/importer/importer_data_types.h" | 40 #include "chrome/browser/importer/importer_data_types.h" |
| 41 #include "chrome/browser/importer/importer_progress_observer.h" | 41 #include "chrome/browser/importer/importer_progress_observer.h" |
| 42 #include "chrome/browser/memory_details.h" | 42 #include "chrome/browser/memory_details.h" |
| 43 #include "chrome/browser/password_manager/password_store_change.h" | 43 #include "chrome/browser/password_manager/password_store_change.h" |
| 44 #include "chrome/browser/password_manager/password_store_consumer.h" | 44 #include "chrome/browser/password_manager/password_store_consumer.h" |
| 45 #include "chrome/browser/policy/configuration_policy_provider.h" | |
| 46 #include "chrome/browser/search_engines/template_url_service_observer.h" | 45 #include "chrome/browser/search_engines/template_url_service_observer.h" |
| 47 #include "chrome/browser/tabs/tab_strip_model.h" | 46 #include "chrome/browser/tabs/tab_strip_model.h" |
| 48 #include "chrome/common/automation_constants.h" | 47 #include "chrome/common/automation_constants.h" |
| 49 #include "chrome/common/extensions/extension_constants.h" | 48 #include "chrome/common/extensions/extension_constants.h" |
| 50 #include "content/public/browser/download_item.h" | 49 #include "content/public/browser/download_item.h" |
| 51 #include "content/public/browser/download_manager.h" | 50 #include "content/public/browser/download_manager.h" |
| 52 #include "content/public/browser/notification_observer.h" | 51 #include "content/public/browser/notification_observer.h" |
| 53 #include "content/public/browser/notification_registrar.h" | 52 #include "content/public/browser/notification_registrar.h" |
| 54 #include "content/public/browser/notification_types.h" | 53 #include "content/public/browser/notification_types.h" |
| 55 #include "ui/gfx/size.h" | 54 #include "ui/gfx/size.h" |
| (...skipping 1730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1786 | 1785 |
| 1787 private: | 1786 private: |
| 1788 content::NotificationRegistrar registrar_; | 1787 content::NotificationRegistrar registrar_; |
| 1789 base::WeakPtr<AutomationProvider> automation_; | 1788 base::WeakPtr<AutomationProvider> automation_; |
| 1790 scoped_ptr<IPC::Message> reply_message_; | 1789 scoped_ptr<IPC::Message> reply_message_; |
| 1791 int new_window_id_; | 1790 int new_window_id_; |
| 1792 | 1791 |
| 1793 DISALLOW_COPY_AND_ASSIGN(BrowserOpenedWithNewProfileNotificationObserver); | 1792 DISALLOW_COPY_AND_ASSIGN(BrowserOpenedWithNewProfileNotificationObserver); |
| 1794 }; | 1793 }; |
| 1795 | 1794 |
| 1796 #if defined(ENABLE_CONFIGURATION_POLICY) | |
| 1797 | |
| 1798 // Waits for a policy refresh on each policy provider available. Refreshes | |
| 1799 // can be triggered by invoking |connector|->RefreshPolicies(). | |
| 1800 // Deletes itself when done. | |
| 1801 class PolicyUpdatesObserver | |
| 1802 : public policy::ConfigurationPolicyProvider::Observer { | |
| 1803 public: | |
| 1804 PolicyUpdatesObserver(AutomationProvider* automation, | |
| 1805 IPC::Message* reply_message, | |
| 1806 policy::BrowserPolicyConnector* connector); | |
| 1807 virtual ~PolicyUpdatesObserver(); | |
| 1808 | |
| 1809 // Invokes |callback| on the UI thread after policies that have changed | |
| 1810 // recently are ready and being enforced. | |
| 1811 static void PostCallbackAfterPolicyUpdates(const base::Closure& callback); | |
| 1812 | |
| 1813 private: | |
| 1814 virtual void OnUpdatePolicy( | |
| 1815 policy::ConfigurationPolicyProvider* provider) OVERRIDE; | |
| 1816 virtual void OnProviderGoingAway( | |
| 1817 policy::ConfigurationPolicyProvider* provider) OVERRIDE; | |
| 1818 void MaybeReply(); | |
| 1819 void Reply(); | |
| 1820 | |
| 1821 // Helper for WaitForPoliciesToBeReadyAndThen that resolves the overloading | |
| 1822 // of BrowserThread::PostTask within Bind calls. | |
| 1823 static void PostTask(content::BrowserThread::ID id, | |
| 1824 const base::Closure& callback); | |
| 1825 | |
| 1826 base::WeakPtr<AutomationProvider> automation_; | |
| 1827 scoped_ptr<IPC::Message> reply_message_; | |
| 1828 std::vector<policy::ConfigurationPolicyObserverRegistrar*> registrars_; | |
| 1829 | |
| 1830 DISALLOW_COPY_AND_ASSIGN(PolicyUpdatesObserver); | |
| 1831 }; | |
| 1832 | |
| 1833 #endif // defined(ENABLE_CONFIGURATION_POLICY) | |
| 1834 | |
| 1835 // Waits for an extension popup to appear and load. | 1795 // Waits for an extension popup to appear and load. |
| 1836 class ExtensionPopupObserver : public content::NotificationObserver { | 1796 class ExtensionPopupObserver : public content::NotificationObserver { |
| 1837 public: | 1797 public: |
| 1838 ExtensionPopupObserver( | 1798 ExtensionPopupObserver( |
| 1839 AutomationProvider* automation, | 1799 AutomationProvider* automation, |
| 1840 IPC::Message* reply_message, | 1800 IPC::Message* reply_message, |
| 1841 const std::string& extension_id); | 1801 const std::string& extension_id); |
| 1842 ~ExtensionPopupObserver(); | 1802 ~ExtensionPopupObserver(); |
| 1843 | 1803 |
| 1844 virtual void Observe(int type, | 1804 virtual void Observe(int type, |
| 1845 const content::NotificationSource& source, | 1805 const content::NotificationSource& source, |
| 1846 const content::NotificationDetails& details) OVERRIDE; | 1806 const content::NotificationDetails& details) OVERRIDE; |
| 1847 | 1807 |
| 1848 private: | 1808 private: |
| 1849 base::WeakPtr<AutomationProvider> automation_; | 1809 base::WeakPtr<AutomationProvider> automation_; |
| 1850 scoped_ptr<IPC::Message> reply_message_; | 1810 scoped_ptr<IPC::Message> reply_message_; |
| 1851 std::string extension_id_; | 1811 std::string extension_id_; |
| 1852 content::NotificationRegistrar registrar_; | 1812 content::NotificationRegistrar registrar_; |
| 1853 | 1813 |
| 1854 DISALLOW_COPY_AND_ASSIGN(ExtensionPopupObserver); | 1814 DISALLOW_COPY_AND_ASSIGN(ExtensionPopupObserver); |
| 1855 }; | 1815 }; |
| 1856 | 1816 |
| 1857 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_ | 1817 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_ |
| OLD | NEW |