Chromium Code Reviews| 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/shell_delegate.h" | 8 #include "ash/shell_delegate.h" |
| 9 #include "ash/system/tray/system_tray_delegate.h" | 9 #include "ash/system/tray/system_tray_delegate.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 349 // flags. If you used EnableChromeTesting, you will have to call it again. | 349 // flags. If you used EnableChromeTesting, you will have to call it again. |
| 350 void TestingAutomationProvider::LoginAsGuest(DictionaryValue* args, | 350 void TestingAutomationProvider::LoginAsGuest(DictionaryValue* args, |
| 351 IPC::Message* reply_message) { | 351 IPC::Message* reply_message) { |
| 352 ExistingUserController* controller = | 352 ExistingUserController* controller = |
| 353 ExistingUserController::current_controller(); | 353 ExistingUserController::current_controller(); |
| 354 // Return immediately, since we're going to die before the login is finished. | 354 // Return immediately, since we're going to die before the login is finished. |
| 355 AutomationJSONReply(this, reply_message).SendSuccess(NULL); | 355 AutomationJSONReply(this, reply_message).SendSuccess(NULL); |
| 356 controller->LoginAsGuest(); | 356 controller->LoginAsGuest(); |
| 357 } | 357 } |
| 358 | 358 |
| 359 void TestingAutomationProvider::LoginWithCachedCredentials( | |
| 360 DictionaryValue* args, | |
| 361 IPC::Message* reply_message) { | |
| 362 AutomationJSONReply reply(this, reply_message); | |
| 363 | |
| 364 std::string username, password; | |
| 365 if (!args->GetString("username", &username) || | |
| 366 !args->GetString("password", &password)) { | |
| 367 reply.SendError("Invalid or missing args."); | |
| 368 return; | |
| 369 } | |
| 370 | |
| 371 chromeos::ExistingUserController* controller = | |
| 372 chromeos::ExistingUserController::current_controller(); | |
| 373 if (!controller) { | |
| 374 reply.SendError("Unable to access ExistingUserController"); | |
| 375 return; | |
| 376 } | |
| 377 | |
| 378 // WebUI login. | |
| 379 chromeos::WebUILoginDisplay* webui_login_display = | |
| 380 static_cast<chromeos::WebUILoginDisplay*>(controller->login_display()); | |
| 381 | |
| 382 webui_login_display->Login(username, password); | |
|
craigdh
2012/09/18 18:16:35
This looks identical to SubmitLoginForm except for
beeps
2012/09/19 16:29:02
Done.
| |
| 383 reply.SendSuccess(NULL); | |
| 384 } | |
| 385 | |
| 359 void TestingAutomationProvider::SubmitLoginForm(DictionaryValue* args, | 386 void TestingAutomationProvider::SubmitLoginForm(DictionaryValue* args, |
| 360 IPC::Message* reply_message) { | 387 IPC::Message* reply_message) { |
| 361 AutomationJSONReply reply(this, reply_message); | 388 AutomationJSONReply reply(this, reply_message); |
| 362 | 389 |
| 363 std::string username, password; | 390 std::string username, password; |
| 364 if (!args->GetString("username", &username) || | 391 if (!args->GetString("username", &username) || |
| 365 !args->GetString("password", &password)) { | 392 !args->GetString("password", &password)) { |
| 366 reply.SendError("Invalid or missing args."); | 393 reply.SendError("Invalid or missing args."); |
| 367 return; | 394 return; |
| 368 } | 395 } |
| (...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1512 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> | 1539 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> |
| 1513 AddObserver(power_manager_observer_); | 1540 AddObserver(power_manager_observer_); |
| 1514 } | 1541 } |
| 1515 | 1542 |
| 1516 void TestingAutomationProvider::RemoveChromeosObservers() { | 1543 void TestingAutomationProvider::RemoveChromeosObservers() { |
| 1517 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> | 1544 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> |
| 1518 RemoveObserver(power_manager_observer_); | 1545 RemoveObserver(power_manager_observer_); |
| 1519 delete power_manager_observer_; | 1546 delete power_manager_observer_; |
| 1520 power_manager_observer_ = NULL; | 1547 power_manager_observer_ = NULL; |
| 1521 } | 1548 } |
| OLD | NEW |