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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 | 67 |
68 // The first instance of this string in an event name will be replaced with | 68 // The first instance of this string in an event name will be replaced with |
69 // the id of this observer. | 69 // the id of this observer. |
70 static const char* kSubstringReplaceWithObserverId; | 70 static const char* kSubstringReplaceWithObserverId; |
71 | 71 |
72 DISALLOW_COPY_AND_ASSIGN(DomEventObserver); | 72 DISALLOW_COPY_AND_ASSIGN(DomEventObserver); |
73 }; | 73 }; |
74 | 74 |
75 #if defined(OS_CHROMEOS) | 75 #if defined(OS_CHROMEOS) |
76 | 76 |
| 77 namespace chromeos { |
| 78 struct UserCredentials; |
| 79 } |
| 80 |
77 // Event observer that listens for the completion of login. | 81 // Event observer that listens for the completion of login. |
78 class LoginEventObserver | 82 class LoginEventObserver |
79 : public AutomationEventObserver, | 83 : public AutomationEventObserver, |
80 public chromeos::LoginStatusConsumer, | 84 public chromeos::LoginStatusConsumer, |
81 public content::NotificationObserver { | 85 public content::NotificationObserver { |
82 public: | 86 public: |
83 LoginEventObserver(AutomationEventQueue* event_queue, | 87 LoginEventObserver(AutomationEventQueue* event_queue, |
84 AutomationProvider* automation); | 88 AutomationProvider* automation); |
85 virtual ~LoginEventObserver(); | 89 virtual ~LoginEventObserver(); |
86 | 90 |
87 virtual void OnLoginFailure(const chromeos::LoginFailure& error) OVERRIDE; | 91 virtual void OnLoginFailure(const chromeos::LoginFailure& error) OVERRIDE; |
88 | 92 |
89 virtual void OnLoginSuccess(const std::string& username, | 93 virtual void OnLoginSuccess(const chromeos::UserCredentials& credentials, |
90 const std::string& password, | |
91 bool pending_requests, bool using_oauth) OVERRIDE; | 94 bool pending_requests, bool using_oauth) OVERRIDE; |
92 // Overridden from content::NotificationObserver. | 95 // Overridden from content::NotificationObserver. |
93 virtual void Observe(int type, | 96 virtual void Observe(int type, |
94 const content::NotificationSource& source, | 97 const content::NotificationSource& source, |
95 const content::NotificationDetails& details) OVERRIDE; | 98 const content::NotificationDetails& details) OVERRIDE; |
96 | 99 |
97 private: | 100 private: |
98 base::WeakPtr<AutomationProvider> automation_; | 101 base::WeakPtr<AutomationProvider> automation_; |
99 content::NotificationRegistrar registrar_; | 102 content::NotificationRegistrar registrar_; |
100 | 103 |
101 void _NotifyLoginEvent(const std::string& error_string); | 104 void _NotifyLoginEvent(const std::string& error_string); |
102 | 105 |
103 DISALLOW_COPY_AND_ASSIGN(LoginEventObserver); | 106 DISALLOW_COPY_AND_ASSIGN(LoginEventObserver); |
104 }; | 107 }; |
105 | 108 |
106 #endif // defined(OS_CHROMEOS) | 109 #endif // defined(OS_CHROMEOS) |
107 | 110 |
108 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_EVENT_OBSERVERS_H_ | 111 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_EVENT_OBSERVERS_H_ |
OLD | NEW |