| 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/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.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) | 19 #if defined(OS_CHROMEOS) |
| 20 namespace chromeos { | 20 namespace chromeos { |
| 21 class EnterpriseEnrollmentScreenActor; |
| 21 class ExistingUserController; | 22 class ExistingUserController; |
| 22 } | 23 } |
| 23 #endif // defined(OS_CHROMEOS) | 24 #endif // defined(OS_CHROMEOS) |
| 24 | 25 |
| 25 // AutomationEventObserver watches for a specific event, and pushes an | 26 // AutomationEventObserver watches for a specific event, and pushes an |
| 26 // AutomationEvent into the AutomationEventQueue for each occurance. | 27 // AutomationEvent into the AutomationEventQueue for each occurance. |
| 27 class AutomationEventObserver { | 28 class AutomationEventObserver { |
| 28 public: | 29 public: |
| 29 explicit AutomationEventObserver(AutomationEventQueue* event_queue, | 30 explicit AutomationEventObserver(AutomationEventQueue* event_queue, |
| 30 bool recurring); | 31 bool recurring); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 public: | 87 public: |
| 87 LoginEventObserver(AutomationEventQueue* event_queue, | 88 LoginEventObserver(AutomationEventQueue* event_queue, |
| 88 chromeos::ExistingUserController* controller, | 89 chromeos::ExistingUserController* controller, |
| 89 AutomationProvider* automation); | 90 AutomationProvider* automation); |
| 90 virtual ~LoginEventObserver(); | 91 virtual ~LoginEventObserver(); |
| 91 | 92 |
| 92 virtual void OnLoginFailure(const chromeos::LoginFailure& error) OVERRIDE; | 93 virtual void OnLoginFailure(const chromeos::LoginFailure& error) OVERRIDE; |
| 93 | 94 |
| 94 virtual void OnLoginSuccess(const std::string& username, | 95 virtual void OnLoginSuccess(const std::string& username, |
| 95 const std::string& password, | 96 const std::string& password, |
| 96 bool pending_requests, bool using_oauth) OVERRIDE; | 97 bool pending_requests, |
| 98 bool using_oauth) OVERRIDE; |
| 97 | 99 |
| 98 private: | 100 private: |
| 99 chromeos::ExistingUserController* controller_; | 101 chromeos::ExistingUserController* controller_; |
| 100 base::WeakPtr<AutomationProvider> automation_; | 102 base::WeakPtr<AutomationProvider> automation_; |
| 101 | 103 |
| 102 void _NotifyLoginEvent(const std::string& error_string); | 104 void _NotifyLoginEvent(const std::string& error_string); |
| 103 | 105 |
| 104 DISALLOW_COPY_AND_ASSIGN(LoginEventObserver); | 106 DISALLOW_COPY_AND_ASSIGN(LoginEventObserver); |
| 105 }; | 107 }; |
| 106 | 108 |
| 109 // Event observer that listens for enrollment to complete. |
| 110 class EnrollmentEventObserver |
| 111 : public AutomationEventObserver, |
| 112 public chromeos::EnterpriseEnrollmentScreenActor::Observer { |
| 113 public: |
| 114 EnrollmentEventObserver( |
| 115 AutomationEventQueue* event_queue, |
| 116 chromeos::EnterpriseEnrollmentScreenActor* enrollment_screen_actor); |
| 117 |
| 118 virtual ~EnrollmentEventObserver(); |
| 119 |
| 120 // chromeos::EnterpriseEnrollmentScreenActor::Observer implementation. |
| 121 virtual void OnEnrollmentComplete( |
| 122 chromeos::EnterpriseEnrollmentScreenActor* enrollment_screen_actor, |
| 123 bool succeeded, |
| 124 const std::string& error_string); |
| 125 |
| 126 private: |
| 127 DISALLOW_COPY_AND_ASSIGN(EnrollmentEventObserver); |
| 128 }; |
| 129 |
| 107 #endif // defined(OS_CHROMEOS) | 130 #endif // defined(OS_CHROMEOS) |
| 108 | 131 |
| 109 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_EVENT_OBSERVERS_H_ | 132 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_EVENT_OBSERVERS_H_ |
| OLD | NEW |