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" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 // the id of this observer. | 75 // the id of this observer. |
76 static const char* kSubstringReplaceWithObserverId; | 76 static const char* kSubstringReplaceWithObserverId; |
77 | 77 |
78 DISALLOW_COPY_AND_ASSIGN(DomEventObserver); | 78 DISALLOW_COPY_AND_ASSIGN(DomEventObserver); |
79 }; | 79 }; |
80 | 80 |
81 #if defined(OS_CHROMEOS) | 81 #if defined(OS_CHROMEOS) |
82 | 82 |
83 // Event observer that listens for the completion of login. | 83 // Event observer that listens for the completion of login. |
84 class LoginEventObserver | 84 class LoginEventObserver |
85 : public AutomationEventObserver, public chromeos::LoginStatusConsumer { | 85 : public AutomationEventObserver, |
| 86 public chromeos::LoginStatusConsumer, |
| 87 public content::NotificationObserver { |
86 public: | 88 public: |
87 LoginEventObserver(AutomationEventQueue* event_queue, | 89 LoginEventObserver(AutomationEventQueue* event_queue, |
88 chromeos::ExistingUserController* controller, | 90 chromeos::ExistingUserController* controller, |
89 AutomationProvider* automation); | 91 AutomationProvider* automation); |
90 virtual ~LoginEventObserver(); | 92 virtual ~LoginEventObserver(); |
91 | 93 |
92 virtual void OnLoginFailure(const chromeos::LoginFailure& error) OVERRIDE; | 94 virtual void OnLoginFailure(const chromeos::LoginFailure& error) OVERRIDE; |
93 | 95 |
94 virtual void OnLoginSuccess(const std::string& username, | 96 virtual void OnLoginSuccess(const std::string& username, |
95 const std::string& password, | 97 const std::string& password, |
96 bool pending_requests, bool using_oauth) OVERRIDE; | 98 bool pending_requests, bool using_oauth) OVERRIDE; |
| 99 // Overridden from content::NotificationObserver. |
| 100 virtual void Observe(int type, |
| 101 const content::NotificationSource& source, |
| 102 const content::NotificationDetails& details) OVERRIDE; |
97 | 103 |
98 private: | 104 private: |
99 chromeos::ExistingUserController* controller_; | 105 chromeos::ExistingUserController* controller_; |
100 base::WeakPtr<AutomationProvider> automation_; | 106 base::WeakPtr<AutomationProvider> automation_; |
| 107 content::NotificationRegistrar registrar_; |
101 | 108 |
102 void _NotifyLoginEvent(const std::string& error_string); | 109 void _NotifyLoginEvent(const std::string& error_string); |
103 | 110 |
104 DISALLOW_COPY_AND_ASSIGN(LoginEventObserver); | 111 DISALLOW_COPY_AND_ASSIGN(LoginEventObserver); |
105 }; | 112 }; |
106 | 113 |
107 #endif // defined(OS_CHROMEOS) | 114 #endif // defined(OS_CHROMEOS) |
108 | 115 |
109 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_EVENT_OBSERVERS_H_ | 116 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_EVENT_OBSERVERS_H_ |
OLD | NEW |