| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/i18n/time_formatting.h" | 8 #include "base/i18n/time_formatting.h" |
| 9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
| 10 #include "base/time.h" | 10 #include "base/time.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include "chrome/browser/chromeos/proxy_cros_settings_provider.h" | 29 #include "chrome/browser/chromeos/proxy_cros_settings_provider.h" |
| 30 #include "chrome/browser/chromeos/system/timezone_settings.h" | 30 #include "chrome/browser/chromeos/system/timezone_settings.h" |
| 31 #include "chrome/browser/policy/browser_policy_connector.h" | 31 #include "chrome/browser/policy/browser_policy_connector.h" |
| 32 #include "chrome/browser/policy/cloud_policy_cache_base.h" | 32 #include "chrome/browser/policy/cloud_policy_cache_base.h" |
| 33 #include "chrome/browser/policy/cloud_policy_data_store.h" | 33 #include "chrome/browser/policy/cloud_policy_data_store.h" |
| 34 #include "chrome/browser/policy/cloud_policy_subsystem.h" | 34 #include "chrome/browser/policy/cloud_policy_subsystem.h" |
| 35 #include "chrome/browser/policy/enterprise_install_attributes.h" | 35 #include "chrome/browser/policy/enterprise_install_attributes.h" |
| 36 #include "chrome/browser/prefs/pref_service.h" | 36 #include "chrome/browser/prefs/pref_service.h" |
| 37 #include "chrome/browser/ui/browser_window.h" | 37 #include "chrome/browser/ui/browser_window.h" |
| 38 #include "chrome/browser/ui/views/window.h" | 38 #include "chrome/browser/ui/views/window.h" |
| 39 #include "chrome/common/chrome_switches.h" | |
| 40 #include "chrome/common/pref_names.h" | 39 #include "chrome/common/pref_names.h" |
| 41 #include "net/base/network_change_notifier.h" | 40 #include "net/base/network_change_notifier.h" |
| 42 #include "policy/policy_constants.h" | 41 #include "policy/policy_constants.h" |
| 43 #include "views/widget/widget.h" | 42 #include "views/widget/widget.h" |
| 44 | 43 |
| 45 using chromeos::CrosLibrary; | 44 using chromeos::CrosLibrary; |
| 46 using chromeos::NetworkLibrary; | 45 using chromeos::NetworkLibrary; |
| 47 using chromeos::UpdateLibrary; | 46 using chromeos::UpdateLibrary; |
| 48 using chromeos::UserManager; | 47 using chromeos::UserManager; |
| 49 | 48 |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 IPC::Message* reply_message) { | 216 IPC::Message* reply_message) { |
| 218 AutomationJSONReply reply(this, reply_message); | 217 AutomationJSONReply reply(this, reply_message); |
| 219 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); | 218 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); |
| 220 | 219 |
| 221 const UserManager* user_manager = UserManager::Get(); | 220 const UserManager* user_manager = UserManager::Get(); |
| 222 if (!user_manager) | 221 if (!user_manager) |
| 223 reply.SendError("No user manager!"); | 222 reply.SendError("No user manager!"); |
| 224 const chromeos::ScreenLocker* screen_locker = | 223 const chromeos::ScreenLocker* screen_locker = |
| 225 chromeos::ScreenLocker::default_screen_locker(); | 224 chromeos::ScreenLocker::default_screen_locker(); |
| 226 | 225 |
| 227 return_value->SetString( | 226 return_value->SetString("login_ui_type", "webui"); |
| 228 "login_ui_type", | |
| 229 CommandLine::ForCurrentProcess()->HasSwitch(switches::kWebUILogin)? | |
| 230 "webui": "nativeui"); | |
| 231 | |
| 232 return_value->SetBoolean("is_owner", user_manager->current_user_is_owner()); | 227 return_value->SetBoolean("is_owner", user_manager->current_user_is_owner()); |
| 233 return_value->SetBoolean("is_logged_in", user_manager->user_is_logged_in()); | 228 return_value->SetBoolean("is_logged_in", user_manager->user_is_logged_in()); |
| 234 return_value->SetBoolean("is_screen_locked", screen_locker); | 229 return_value->SetBoolean("is_screen_locked", screen_locker); |
| 235 if (user_manager->user_is_logged_in()) { | 230 if (user_manager->user_is_logged_in()) { |
| 236 return_value->SetBoolean("is_guest", user_manager->IsLoggedInAsGuest()); | 231 return_value->SetBoolean("is_guest", user_manager->IsLoggedInAsGuest()); |
| 237 return_value->SetString("email", user_manager->logged_in_user().email()); | 232 return_value->SetString("email", user_manager->logged_in_user().email()); |
| 238 } | 233 } |
| 239 | 234 |
| 240 reply.SendSuccess(return_value.get()); | 235 reply.SendSuccess(return_value.get()); |
| 241 } | 236 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 270 "Invalid or missing args."); | 265 "Invalid or missing args."); |
| 271 return; | 266 return; |
| 272 } | 267 } |
| 273 | 268 |
| 274 chromeos::ExistingUserController* controller = | 269 chromeos::ExistingUserController* controller = |
| 275 chromeos::ExistingUserController::current_controller(); | 270 chromeos::ExistingUserController::current_controller(); |
| 276 | 271 |
| 277 // Set up an observer (it will delete itself). | 272 // Set up an observer (it will delete itself). |
| 278 new LoginObserver(controller, this, reply_message); | 273 new LoginObserver(controller, this, reply_message); |
| 279 | 274 |
| 280 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kWebUILogin)) { | 275 // WebUI login. |
| 281 // WebUI login. | 276 chromeos::WebUILoginDisplay* webui_login_display = |
| 282 chromeos::WebUILoginDisplay* webui_login_display = | 277 static_cast<chromeos::WebUILoginDisplay*>(controller->login_display()); |
| 283 static_cast<chromeos::WebUILoginDisplay*>(controller->login_display()); | 278 webui_login_display->ShowSigninScreenForCreds(username, password); |
| 284 webui_login_display->ShowSigninScreenForCreds(username, password); | |
| 285 } else { | |
| 286 // Native UI login. | |
| 287 controller->login_display()->SelectPod(0); | |
| 288 controller->Login(username, password); | |
| 289 } | |
| 290 } | 279 } |
| 291 | 280 |
| 292 void TestingAutomationProvider::LockScreen(DictionaryValue* args, | 281 void TestingAutomationProvider::LockScreen(DictionaryValue* args, |
| 293 IPC::Message* reply_message) { | 282 IPC::Message* reply_message) { |
| 294 if (!EnsureCrosLibraryLoaded(this, reply_message)) | 283 if (!EnsureCrosLibraryLoaded(this, reply_message)) |
| 295 return; | 284 return; |
| 296 | 285 |
| 297 new ScreenLockUnlockObserver(this, reply_message, true); | 286 new ScreenLockUnlockObserver(this, reply_message, true); |
| 298 CrosLibrary::Get()->GetScreenLockLibrary()-> | 287 CrosLibrary::Get()->GetScreenLockLibrary()-> |
| 299 NotifyScreenLockRequested(); | 288 NotifyScreenLockRequested(); |
| (...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1213 views::Widget* window = browser::CreateViewsWindow( | 1202 views::Widget* window = browser::CreateViewsWindow( |
| 1214 browser->window()->GetNativeHandle(), take_photo_dialog); | 1203 browser->window()->GetNativeHandle(), take_photo_dialog); |
| 1215 window->SetAlwaysOnTop(true); | 1204 window->SetAlwaysOnTop(true); |
| 1216 window->Show(); | 1205 window->Show(); |
| 1217 } | 1206 } |
| 1218 | 1207 |
| 1219 void TestingAutomationProvider::PowerChanged( | 1208 void TestingAutomationProvider::PowerChanged( |
| 1220 const chromeos::PowerSupplyStatus& status) { | 1209 const chromeos::PowerSupplyStatus& status) { |
| 1221 power_status = status; | 1210 power_status = status; |
| 1222 } | 1211 } |
| OLD | NEW |