| Index: chrome/browser/automation/testing_automation_provider_chromeos.cc
|
| diff --git a/chrome/browser/automation/testing_automation_provider_chromeos.cc b/chrome/browser/automation/testing_automation_provider_chromeos.cc
|
| index e67bf51e7dc113ee9fee888337788d9387e00678..9957f0cf0fdb6bb1495bf9948b08c5f5dc45b4e7 100644
|
| --- a/chrome/browser/automation/testing_automation_provider_chromeos.cc
|
| +++ b/chrome/browser/automation/testing_automation_provider_chromeos.cc
|
| @@ -216,6 +216,15 @@ DictionaryValue* CreateDictionaryWithPolicies(
|
| return dict;
|
| }
|
|
|
| +// Returns the EnterpriseEnrollmentScreen, if it exists.
|
| +chromeos::EnterpriseEnrollmentScreen* GetEnterpriseEnrollmentScreen() {
|
| + chromeos::WizardController* wizard_controller =
|
| + chromeos::WizardController::default_controller();
|
| + if (!wizard_controller)
|
| + return NULL;
|
| + return wizard_controller->GetEnterpriseEnrollmentScreen();
|
| +}
|
| +
|
| // Last reported power status.
|
| chromeos::PowerSupplyStatus global_power_status;
|
|
|
| @@ -924,43 +933,49 @@ void TestingAutomationProvider::IsEnterpriseDevice(
|
| reply.SendSuccess(return_value.get());
|
| }
|
|
|
| -void TestingAutomationProvider::EnrollEnterpriseDevice(
|
| +void TestingAutomationProvider::ShowEnterpriseWizard(
|
| DictionaryValue* args, IPC::Message* reply_message) {
|
| - std::string user, password;
|
| - if (!args->GetString("user", &user) ||
|
| - !args->GetString("password", &password)) {
|
| - AutomationJSONReply(this, reply_message)
|
| - .SendError("Invalid or missing args.");
|
| - return;
|
| - }
|
| + AutomationJSONReply reply(this, reply_message);
|
| chromeos::ExistingUserController* user_controller =
|
| chromeos::ExistingUserController::current_controller();
|
| if (!user_controller) {
|
| - AutomationJSONReply(this, reply_message).SendError(
|
| - "Unable to access ExistingUserController");
|
| + reply.SendError("Unable to access ExistingUserController");
|
| return;
|
| }
|
| user_controller->login_display_host()->StartWizard(
|
| chromeos::WizardController::kEnterpriseEnrollmentScreenName,
|
| NULL);
|
| - chromeos::WizardController* wizard_controller =
|
| - chromeos::WizardController::default_controller();
|
| - if (!wizard_controller) {
|
| - AutomationJSONReply(this, reply_message).SendError(
|
| - "Unable to access WizardController");
|
| + chromeos::EnterpriseEnrollmentScreen* enroll_screen =
|
| + GetEnterpriseEnrollmentScreen();
|
| + if (!enroll_screen) {
|
| + reply.SendError("Unable to access EnterpriseEnrollmentScreen");
|
| return;
|
| }
|
| + enroll_screen->GetActor()->Show();
|
| + reply.SendSuccess(NULL);
|
| +}
|
| +
|
| +void TestingAutomationProvider::AddEnrollmentObserver(
|
| + DictionaryValue* args, IPC::Message* reply_message) {
|
| + AutomationJSONReply reply(this, reply_message);
|
| chromeos::EnterpriseEnrollmentScreen* enroll_screen =
|
| - wizard_controller->GetEnterpriseEnrollmentScreen();
|
| + GetEnterpriseEnrollmentScreen();
|
| if (!enroll_screen) {
|
| AutomationJSONReply(this, reply_message).SendError(
|
| "Unable to access EnterpriseEnrollmentScreen");
|
| return;
|
| }
|
| - // Set up an observer (it will delete itself).
|
| - new EnrollmentObserver(this, reply_message, enroll_screen->GetActor(),
|
| - enroll_screen);
|
| - enroll_screen->GetActor()->SubmitTestCredentials(user, password);
|
| + if (!automation_event_queue_.get())
|
| + automation_event_queue_.reset(new AutomationEventQueue);
|
| +
|
| + int observer_id = automation_event_queue_->AddObserver(
|
| + new EnrollmentEventObserver(automation_event_queue_.get(),
|
| + enroll_screen->GetActor()));
|
| +
|
| + // Return the observer's id.
|
| + DictionaryValue return_value;
|
| + return_value.SetInteger("observer_id", observer_id);
|
| + reply.SendSuccess(&return_value);
|
| }
|
|
|
| void TestingAutomationProvider::ExecuteJavascriptInOOBEWebUI(
|
|
|