| 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 #include "chrome/browser/automation/automation_event_observers.h" | 5 #include "chrome/browser/automation/automation_event_observers.h" |
| 6 #include "chrome/browser/browser_process.h" | 6 #include "chrome/browser/browser_process.h" |
| 7 #include "chrome/browser/chromeos/login/enrollment/enterprise_enrollment_screen_
actor.h" |
| 7 #include "chrome/browser/chromeos/login/existing_user_controller.h" | 8 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
| 8 | 9 |
| 9 LoginEventObserver::LoginEventObserver( | 10 LoginEventObserver::LoginEventObserver( |
| 10 AutomationEventQueue* event_queue, | 11 AutomationEventQueue* event_queue, |
| 11 chromeos::ExistingUserController* controller, | 12 chromeos::ExistingUserController* controller, |
| 12 AutomationProvider* automation) | 13 AutomationProvider* automation) |
| 13 : AutomationEventObserver(event_queue, false), | 14 : AutomationEventObserver(event_queue, false), |
| 14 controller_(controller), | 15 controller_(controller), |
| 15 automation_(automation->AsWeakPtr()) { | 16 automation_(automation->AsWeakPtr()) { |
| 16 controller_->set_login_status_consumer(this); | 17 controller_->set_login_status_consumer(this); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 37 | 38 |
| 38 void LoginEventObserver::_NotifyLoginEvent(const std::string& error_string) { | 39 void LoginEventObserver::_NotifyLoginEvent(const std::string& error_string) { |
| 39 DictionaryValue* dict = new DictionaryValue; | 40 DictionaryValue* dict = new DictionaryValue; |
| 40 dict->SetString("type", "login_event"); | 41 dict->SetString("type", "login_event"); |
| 41 if (error_string.length()) | 42 if (error_string.length()) |
| 42 dict->SetString("error_string", error_string); | 43 dict->SetString("error_string", error_string); |
| 43 NotifyEvent(dict); | 44 NotifyEvent(dict); |
| 44 controller_->set_login_status_consumer(NULL); | 45 controller_->set_login_status_consumer(NULL); |
| 45 RemoveIfDone(); | 46 RemoveIfDone(); |
| 46 } | 47 } |
| 48 |
| 49 EnrollmentEventObserver::EnrollmentEventObserver( |
| 50 AutomationEventQueue* event_queue, |
| 51 chromeos::EnterpriseEnrollmentScreenActor* enrollment_screen_actor) |
| 52 : AutomationEventObserver(event_queue, false) { |
| 53 enrollment_screen_actor->AddObserver(this); |
| 54 } |
| 55 |
| 56 EnrollmentEventObserver::~EnrollmentEventObserver() {} |
| 57 |
| 58 void EnrollmentEventObserver::OnEnrollmentComplete( |
| 59 chromeos::EnterpriseEnrollmentScreenActor* enrollment_screen_actor, |
| 60 bool succeeded, |
| 61 const std::string& error_string) { |
| 62 DictionaryValue* dict = new DictionaryValue; |
| 63 enrollment_screen_actor->RemoveObserver(this); |
| 64 if (!succeeded) |
| 65 dict->SetString("error_string", error_string); |
| 66 NotifyEvent(dict); |
| 67 RemoveIfDone(); |
| 68 } |
| OLD | NEW |