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/testing_automation_provider.h" | 5 #include "chrome/browser/automation/testing_automation_provider.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/system/tray/system_tray_delegate.h" | 8 #include "ash/system/tray/system_tray_delegate.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/i18n/time_formatting.h" | 10 #include "base/i18n/time_formatting.h" |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 IPC::Message* reply_message) { | 271 IPC::Message* reply_message) { |
272 LOG(ERROR) << "TestingAutomationProvider::LoginAsGuest"; | 272 LOG(ERROR) << "TestingAutomationProvider::LoginAsGuest"; |
273 | 273 |
274 chromeos::ExistingUserController* controller = | 274 chromeos::ExistingUserController* controller = |
275 chromeos::ExistingUserController::current_controller(); | 275 chromeos::ExistingUserController::current_controller(); |
276 // Return immediately, since we're going to die before the login is finished. | 276 // Return immediately, since we're going to die before the login is finished. |
277 AutomationJSONReply(this, reply_message).SendSuccess(NULL); | 277 AutomationJSONReply(this, reply_message).SendSuccess(NULL); |
278 controller->LoginAsGuest(); | 278 controller->LoginAsGuest(); |
279 } | 279 } |
280 | 280 |
| 281 void TestingAutomationProvider::SubmitLoginForm(DictionaryValue* args, |
| 282 IPC::Message* reply_message) { |
| 283 AutomationJSONReply reply(this, reply_message); |
| 284 VLOG(2) << "TestingAutomationProvider::StartLogin"; |
| 285 |
| 286 std::string username, password; |
| 287 if (!args->GetString("username", &username) || |
| 288 !args->GetString("password", &password)) { |
| 289 reply.SendError("Invalid or missing args."); |
| 290 return; |
| 291 } |
| 292 |
| 293 chromeos::ExistingUserController* controller = |
| 294 chromeos::ExistingUserController::current_controller(); |
| 295 if (!controller) { |
| 296 reply.SendError("Unable to access ExistingUserController"); |
| 297 return; |
| 298 } |
| 299 |
| 300 // WebUI login. |
| 301 chromeos::WebUILoginDisplay* webui_login_display = |
| 302 static_cast<chromeos::WebUILoginDisplay*>(controller->login_display()); |
| 303 VLOG(2) << "TestingAutomationProvider::StartLogin ShowSigninScreenForCreds(" |
| 304 << username << ", " << password << ")"; |
| 305 |
| 306 webui_login_display->ShowSigninScreenForCreds(username, password); |
| 307 reply.SendSuccess(NULL); |
| 308 } |
| 309 |
281 void TestingAutomationProvider::AddLoginEventObserver( | 310 void TestingAutomationProvider::AddLoginEventObserver( |
282 DictionaryValue* args, IPC::Message* reply_message) { | 311 DictionaryValue* args, IPC::Message* reply_message) { |
283 chromeos::ExistingUserController* controller = | 312 chromeos::ExistingUserController* controller = |
284 chromeos::ExistingUserController::current_controller(); | 313 chromeos::ExistingUserController::current_controller(); |
285 AutomationJSONReply reply(this, reply_message); | 314 AutomationJSONReply reply(this, reply_message); |
286 if (!controller) { | 315 if (!controller) { |
287 reply.SendError("Unable to access ExistingUserController"); | 316 reply.SendError("Unable to access ExistingUserController"); |
288 return; | 317 return; |
289 } | 318 } |
290 | 319 |
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1248 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> | 1277 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> |
1249 AddObserver(power_manager_observer_); | 1278 AddObserver(power_manager_observer_); |
1250 } | 1279 } |
1251 | 1280 |
1252 void TestingAutomationProvider::RemoveChromeosObservers() { | 1281 void TestingAutomationProvider::RemoveChromeosObservers() { |
1253 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> | 1282 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> |
1254 RemoveObserver(power_manager_observer_); | 1283 RemoveObserver(power_manager_observer_); |
1255 delete power_manager_observer_; | 1284 delete power_manager_observer_; |
1256 power_manager_observer_ = NULL; | 1285 power_manager_observer_ = NULL; |
1257 } | 1286 } |
OLD | NEW |