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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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::SubmitLoginForm(DictionaryValue* args, | 359 void TestingAutomationProvider::SubmitLoginForm(DictionaryValue* args, |
360 IPC::Message* reply_message) { | 360 IPC::Message* reply_message) { |
361 AutomationJSONReply reply(this, reply_message); | 361 AutomationJSONReply reply(this, reply_message); |
362 | 362 |
363 std::string username, password; | 363 std::string username, password; |
364 bool use_cached_credentials; | |
364 if (!args->GetString("username", &username) || | 365 if (!args->GetString("username", &username) || |
365 !args->GetString("password", &password)) { | 366 !args->GetString("password", &password) || |
367 !args->GetBoolean("use_cached_credentials", &use_cached_credentials)) { | |
366 reply.SendError("Invalid or missing args."); | 368 reply.SendError("Invalid or missing args."); |
367 return; | 369 return; |
368 } | 370 } |
369 | 371 |
370 chromeos::ExistingUserController* controller = | 372 chromeos::ExistingUserController* controller = |
371 chromeos::ExistingUserController::current_controller(); | 373 chromeos::ExistingUserController::current_controller(); |
372 if (!controller) { | 374 if (!controller) { |
373 reply.SendError("Unable to access ExistingUserController"); | 375 reply.SendError("Unable to access ExistingUserController"); |
374 return; | 376 return; |
375 } | 377 } |
376 | 378 |
377 // WebUI login. | 379 // WebUI login. |
378 chromeos::WebUILoginDisplay* webui_login_display = | 380 chromeos::WebUILoginDisplay* webui_login_display = |
379 static_cast<chromeos::WebUILoginDisplay*>(controller->login_display()); | 381 static_cast<chromeos::WebUILoginDisplay*>(controller->login_display()); |
380 VLOG(2) << "TestingAutomationProvider::SubmitLoginForm " | 382 VLOG(2) << "TestingAutomationProvider::SubmitLoginForm " |
381 << "ShowSigninScreenForCreds(" << username << ", " << password << ")"; | 383 << "ShowSigninScreenForCreds(" << username << ", " << password << ")"; |
382 | 384 |
383 webui_login_display->ShowSigninScreenForCreds(username, password); | 385 if (use_cached_credentials) { |
386 webui_login_display->Login(username, password); | |
Nirnimesh
2012/09/21 18:46:43
are you sure this is what is being done at the use
beeps
2012/09/26 18:31:09
tested it with bogus password and it fails
On 2012
| |
387 } else { | |
388 webui_login_display->ShowSigninScreenForCreds(username, password); | |
389 } | |
384 reply.SendSuccess(NULL); | 390 reply.SendSuccess(NULL); |
385 } | 391 } |
386 | 392 |
387 void TestingAutomationProvider::AddLoginEventObserver( | 393 void TestingAutomationProvider::AddLoginEventObserver( |
388 DictionaryValue* args, IPC::Message* reply_message) { | 394 DictionaryValue* args, IPC::Message* reply_message) { |
389 ExistingUserController* controller = | 395 ExistingUserController* controller = |
390 ExistingUserController::current_controller(); | 396 ExistingUserController::current_controller(); |
391 AutomationJSONReply reply(this, reply_message); | 397 AutomationJSONReply reply(this, reply_message); |
392 if (!controller) { | 398 if (!controller) { |
393 // This may happen due to SkipToLogin not being called. | 399 // This may happen due to SkipToLogin not being called. |
(...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1512 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> | 1518 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> |
1513 AddObserver(power_manager_observer_); | 1519 AddObserver(power_manager_observer_); |
1514 } | 1520 } |
1515 | 1521 |
1516 void TestingAutomationProvider::RemoveChromeosObservers() { | 1522 void TestingAutomationProvider::RemoveChromeosObservers() { |
1517 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> | 1523 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> |
1518 RemoveObserver(power_manager_observer_); | 1524 RemoveObserver(power_manager_observer_); |
1519 delete power_manager_observer_; | 1525 delete power_manager_observer_; |
1520 power_manager_observer_ = NULL; | 1526 power_manager_observer_ = NULL; |
1521 } | 1527 } |
OLD | NEW |