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 #if defined(OS_CHROMEOS) | |
20 namespace chromeos { | |
21 class ExistingUserController; | |
22 } | |
23 #endif // defined(OS_CHROMEOS) | |
24 | |
25 // AutomationEventObserver watches for a specific event, and pushes an | 19 // AutomationEventObserver watches for a specific event, and pushes an |
26 // AutomationEvent into the AutomationEventQueue for each occurance. | 20 // AutomationEvent into the AutomationEventQueue for each occurance. |
27 class AutomationEventObserver { | 21 class AutomationEventObserver { |
28 public: | 22 public: |
29 explicit AutomationEventObserver(AutomationEventQueue* event_queue, | 23 explicit AutomationEventObserver(AutomationEventQueue* event_queue, |
30 bool recurring); | 24 bool recurring); |
31 virtual ~AutomationEventObserver(); | 25 virtual ~AutomationEventObserver(); |
32 | 26 |
33 virtual void Init(int observer_id); | 27 virtual void Init(int observer_id); |
34 void NotifyEvent(DictionaryValue* value); | 28 void NotifyEvent(DictionaryValue* value); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 | 74 |
81 #if defined(OS_CHROMEOS) | 75 #if defined(OS_CHROMEOS) |
82 | 76 |
83 // Event observer that listens for the completion of login. | 77 // Event observer that listens for the completion of login. |
84 class LoginEventObserver | 78 class LoginEventObserver |
85 : public AutomationEventObserver, | 79 : public AutomationEventObserver, |
86 public chromeos::LoginStatusConsumer, | 80 public chromeos::LoginStatusConsumer, |
87 public content::NotificationObserver { | 81 public content::NotificationObserver { |
88 public: | 82 public: |
89 LoginEventObserver(AutomationEventQueue* event_queue, | 83 LoginEventObserver(AutomationEventQueue* event_queue, |
90 chromeos::ExistingUserController* controller, | |
91 AutomationProvider* automation); | 84 AutomationProvider* automation); |
92 virtual ~LoginEventObserver(); | 85 virtual ~LoginEventObserver(); |
93 | 86 |
94 virtual void OnLoginFailure(const chromeos::LoginFailure& error) OVERRIDE; | 87 virtual void OnLoginFailure(const chromeos::LoginFailure& error) OVERRIDE; |
95 | 88 |
96 virtual void OnLoginSuccess(const std::string& username, | 89 virtual void OnLoginSuccess(const std::string& username, |
97 const std::string& password, | 90 const std::string& password, |
98 bool pending_requests, bool using_oauth) OVERRIDE; | 91 bool pending_requests, bool using_oauth) OVERRIDE; |
99 // Overridden from content::NotificationObserver. | 92 // Overridden from content::NotificationObserver. |
100 virtual void Observe(int type, | 93 virtual void Observe(int type, |
101 const content::NotificationSource& source, | 94 const content::NotificationSource& source, |
102 const content::NotificationDetails& details) OVERRIDE; | 95 const content::NotificationDetails& details) OVERRIDE; |
103 | 96 |
104 private: | 97 private: |
105 chromeos::ExistingUserController* controller_; | |
106 base::WeakPtr<AutomationProvider> automation_; | 98 base::WeakPtr<AutomationProvider> automation_; |
107 content::NotificationRegistrar registrar_; | 99 content::NotificationRegistrar registrar_; |
108 | 100 |
109 void _NotifyLoginEvent(const std::string& error_string); | 101 void _NotifyLoginEvent(const std::string& error_string); |
110 | 102 |
111 DISALLOW_COPY_AND_ASSIGN(LoginEventObserver); | 103 DISALLOW_COPY_AND_ASSIGN(LoginEventObserver); |
112 }; | 104 }; |
113 | 105 |
114 #endif // defined(OS_CHROMEOS) | 106 #endif // defined(OS_CHROMEOS) |
115 | 107 |
116 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_EVENT_OBSERVERS_H_ | 108 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_EVENT_OBSERVERS_H_ |
OLD | NEW |