| 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_provider_observers.h" | 5 #include "chrome/browser/automation/automation_provider_observers.h" |
| 6 | 6 |
| 7 #include "base/values.h" | 7 #include "base/values.h" |
| 8 #include "chrome/browser/automation/automation_provider.h" | 8 #include "chrome/browser/automation/automation_provider.h" |
| 9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
| 10 #include "chrome/browser/chromeos/login/authentication_notification_details.h" | 10 #include "chrome/browser/chromeos/login/authentication_notification_details.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 automation_(automation->AsWeakPtr()), | 59 automation_(automation->AsWeakPtr()), |
| 60 reply_message_(reply_message) { | 60 reply_message_(reply_message) { |
| 61 controller_->set_login_status_consumer(this); | 61 controller_->set_login_status_consumer(this); |
| 62 } | 62 } |
| 63 | 63 |
| 64 LoginObserver::~LoginObserver() { | 64 LoginObserver::~LoginObserver() { |
| 65 controller_->set_login_status_consumer(NULL); | 65 controller_->set_login_status_consumer(NULL); |
| 66 } | 66 } |
| 67 | 67 |
| 68 void LoginObserver::OnLoginFailure(const chromeos::LoginFailure& error) { | 68 void LoginObserver::OnLoginFailure(const chromeos::LoginFailure& error) { |
| 69 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); | 69 scoped_ptr<base::DictionaryValue> return_value(new base::DictionaryValue); |
| 70 return_value->SetString("error_string", error.GetErrorString()); | 70 return_value->SetString("error_string", error.GetErrorString()); |
| 71 AutomationJSONReply(automation_.get(), reply_message_.release()) | 71 AutomationJSONReply(automation_.get(), reply_message_.release()) |
| 72 .SendSuccess(return_value.get()); | 72 .SendSuccess(return_value.get()); |
| 73 delete this; | 73 delete this; |
| 74 } | 74 } |
| 75 | 75 |
| 76 void LoginObserver::OnLoginSuccess(const chromeos::UserContext& user_context) { | 76 void LoginObserver::OnLoginSuccess(const chromeos::UserContext& user_context) { |
| 77 controller_->set_login_status_consumer(NULL); | 77 controller_->set_login_status_consumer(NULL); |
| 78 AutomationJSONReply(automation_.get(), reply_message_.release()) | 78 AutomationJSONReply(automation_.get(), reply_message_.release()) |
| 79 .SendSuccess(NULL); | 79 .SendSuccess(NULL); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 112 |
| 113 void WizardControllerObserver::Observe( | 113 void WizardControllerObserver::Observe( |
| 114 int type, | 114 int type, |
| 115 const content::NotificationSource& source, | 115 const content::NotificationSource& source, |
| 116 const content::NotificationDetails& details) { | 116 const content::NotificationDetails& details) { |
| 117 DCHECK(type == chrome::NOTIFICATION_LOGIN_WEBUI_LOADED); | 117 DCHECK(type == chrome::NOTIFICATION_LOGIN_WEBUI_LOADED); |
| 118 SendReply(WizardController::kLoginScreenName); | 118 SendReply(WizardController::kLoginScreenName); |
| 119 } | 119 } |
| 120 | 120 |
| 121 void WizardControllerObserver::SendReply(const std::string& screen_name) { | 121 void WizardControllerObserver::SendReply(const std::string& screen_name) { |
| 122 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); | 122 scoped_ptr<base::DictionaryValue> return_value(new base::DictionaryValue); |
| 123 return_value->SetString("next_screen", screen_name); | 123 return_value->SetString("next_screen", screen_name); |
| 124 AutomationJSONReply(automation_.get(), reply_message_.release()) | 124 AutomationJSONReply(automation_.get(), reply_message_.release()) |
| 125 .SendSuccess(return_value.get()); | 125 .SendSuccess(return_value.get()); |
| 126 delete this; | 126 delete this; |
| 127 } | 127 } |
| 128 | 128 |
| 129 ScreenLockUnlockObserver::ScreenLockUnlockObserver( | 129 ScreenLockUnlockObserver::ScreenLockUnlockObserver( |
| 130 AutomationProvider* automation, | 130 AutomationProvider* automation, |
| 131 IPC::Message* reply_message, | 131 IPC::Message* reply_message, |
| 132 bool lock_screen) | 132 bool lock_screen) |
| (...skipping 30 matching lines...) Expand all Loading... |
| 163 | 163 |
| 164 ScreenUnlockObserver::~ScreenUnlockObserver() { | 164 ScreenUnlockObserver::~ScreenUnlockObserver() { |
| 165 chromeos::ScreenLocker* screen_locker = | 165 chromeos::ScreenLocker* screen_locker = |
| 166 chromeos::ScreenLocker::default_screen_locker(); | 166 chromeos::ScreenLocker::default_screen_locker(); |
| 167 if (screen_locker) | 167 if (screen_locker) |
| 168 screen_locker->SetLoginStatusConsumer(NULL); | 168 screen_locker->SetLoginStatusConsumer(NULL); |
| 169 } | 169 } |
| 170 | 170 |
| 171 void ScreenUnlockObserver::OnLoginFailure(const chromeos::LoginFailure& error) { | 171 void ScreenUnlockObserver::OnLoginFailure(const chromeos::LoginFailure& error) { |
| 172 if (automation_) { | 172 if (automation_) { |
| 173 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); | 173 scoped_ptr<base::DictionaryValue> return_value(new base::DictionaryValue); |
| 174 return_value->SetString("error_string", error.GetErrorString()); | 174 return_value->SetString("error_string", error.GetErrorString()); |
| 175 AutomationJSONReply(automation_.get(), reply_message_.release()) | 175 AutomationJSONReply(automation_.get(), reply_message_.release()) |
| 176 .SendSuccess(return_value.get()); | 176 .SendSuccess(return_value.get()); |
| 177 } | 177 } |
| 178 delete this; | 178 delete this; |
| 179 } | 179 } |
| OLD | NEW |