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_EVENT_OBSERVERS_H_ | 5 #ifndef CHROME_BROWSER_AUTOMATION_AUTOMATION_EVENT_OBSERVERS_H_ |
6 #define CHROME_BROWSER_AUTOMATION_AUTOMATION_EVENT_OBSERVERS_H_ | 6 #define CHROME_BROWSER_AUTOMATION_AUTOMATION_EVENT_OBSERVERS_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/automation/automation_event_queue.h" | 10 #include "chrome/browser/automation/automation_event_queue.h" |
11 #include "chrome/browser/automation/automation_provider.h" | 11 #include "chrome/browser/automation/automation_provider.h" |
12 #include "chrome/browser/automation/automation_provider_observers.h" | 12 #include "chrome/browser/automation/automation_provider_observers.h" |
13 #if defined(OS_CHROMEOS) | 13 #if defined(OS_CHROMEOS) |
14 #include "chrome/browser/chromeos/login/login_status_consumer.h" | 14 #include "chrome/browser/chromeos/login/login_status_consumer.h" |
15 #endif // defined(OS_CHROMEOS) | 15 #endif // defined(OS_CHROMEOS) |
16 #include "content/public/browser/notification_observer.h" | 16 #include "content/public/browser/notification_observer.h" |
17 #include "content/public/browser/notification_registrar.h" | 17 #include "content/public/browser/notification_registrar.h" |
18 | 18 |
19 // AutomationEventObserver watches for a specific event, and pushes an | 19 // AutomationEventObserver watches for a specific event, and pushes an |
20 // AutomationEvent into the AutomationEventQueue for each occurance. | 20 // AutomationEvent into the AutomationEventQueue for each occurance. |
21 class AutomationEventObserver { | 21 class AutomationEventObserver { |
22 public: | 22 public: |
23 explicit AutomationEventObserver(AutomationEventQueue* event_queue, | 23 explicit AutomationEventObserver(AutomationEventQueue* event_queue, |
24 bool recurring); | 24 bool recurring); |
25 virtual ~AutomationEventObserver(); | 25 virtual ~AutomationEventObserver(); |
26 | 26 |
27 virtual void Init(int observer_id); | 27 virtual void Init(int observer_id); |
28 void NotifyEvent(DictionaryValue* value); | 28 void NotifyEvent(base::DictionaryValue* value); |
29 int GetId() const; | 29 int GetId() const; |
30 | 30 |
31 protected: | 31 protected: |
32 void RemoveIfDone(); // This may delete the object. | 32 void RemoveIfDone(); // This may delete the object. |
33 | 33 |
34 private: | 34 private: |
35 AutomationEventQueue* event_queue_; | 35 AutomationEventQueue* event_queue_; |
36 bool recurring_; | 36 bool recurring_; |
37 int observer_id_; | 37 int observer_id_; |
38 // TODO(craigdh): Add a PyAuto hook to retrieve the number of times an event | 38 // TODO(craigdh): Add a PyAuto hook to retrieve the number of times an event |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 base::WeakPtr<AutomationProvider> automation_; | 96 base::WeakPtr<AutomationProvider> automation_; |
97 | 97 |
98 void _NotifyLoginEvent(const std::string& error_string); | 98 void _NotifyLoginEvent(const std::string& error_string); |
99 | 99 |
100 DISALLOW_COPY_AND_ASSIGN(LoginEventObserver); | 100 DISALLOW_COPY_AND_ASSIGN(LoginEventObserver); |
101 }; | 101 }; |
102 | 102 |
103 #endif // defined(OS_CHROMEOS) | 103 #endif // defined(OS_CHROMEOS) |
104 | 104 |
105 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_EVENT_OBSERVERS_H_ | 105 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_EVENT_OBSERVERS_H_ |
OLD | NEW |