| 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" |
| 11 #include "base/i18n/time_formatting.h" | 11 #include "base/i18n/time_formatting.h" |
| 12 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
| 13 #include "base/stringprintf.h" | 13 #include "base/stringprintf.h" |
| 14 #include "base/time.h" | 14 #include "base/time.h" |
| 15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 16 #include "chrome/browser/automation/automation_provider_json.h" | 16 #include "chrome/browser/automation/automation_provider_json.h" |
| 17 #include "chrome/browser/automation/automation_provider_observers.h" | 17 #include "chrome/browser/automation/automation_provider_observers.h" |
| 18 #include "chrome/browser/automation/automation_util.h" | 18 #include "chrome/browser/automation/automation_util.h" |
| 19 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/browser_process.h" |
| 20 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| 20 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | 21 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
| 21 #include "chrome/browser/chromeos/audio/audio_handler.h" | 22 #include "chrome/browser/chromeos/audio/audio_handler.h" |
| 22 #include "chrome/browser/chromeos/cros/cros_library.h" | 23 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 23 #include "chrome/browser/chromeos/cros/network_library.h" | 24 #include "chrome/browser/chromeos/cros/network_library.h" |
| 24 #include "chrome/browser/chromeos/login/default_user_images.h" | 25 #include "chrome/browser/chromeos/login/default_user_images.h" |
| 25 #include "chrome/browser/chromeos/login/enrollment/enrollment_screen.h" | 26 #include "chrome/browser/chromeos/login/enrollment/enrollment_screen.h" |
| 26 #include "chrome/browser/chromeos/login/existing_user_controller.h" | 27 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
| 27 #include "chrome/browser/chromeos/login/login_display.h" | 28 #include "chrome/browser/chromeos/login/login_display.h" |
| 28 #include "chrome/browser/chromeos/login/login_display_host_impl.h" | 29 #include "chrome/browser/chromeos/login/login_display_host_impl.h" |
| 29 #include "chrome/browser/chromeos/login/screen_locker.h" | 30 #include "chrome/browser/chromeos/login/screen_locker.h" |
| (...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1109 reply.SendError("Invalid or missing args."); | 1110 reply.SendError("Invalid or missing args."); |
| 1110 return; | 1111 return; |
| 1111 } | 1112 } |
| 1112 const UserManager* user_manager = UserManager::Get(); | 1113 const UserManager* user_manager = UserManager::Get(); |
| 1113 if (!user_manager) { | 1114 if (!user_manager) { |
| 1114 reply.SendError("No user manager!"); | 1115 reply.SendError("No user manager!"); |
| 1115 return; | 1116 return; |
| 1116 } | 1117 } |
| 1117 | 1118 |
| 1118 if (user_manager->IsUserLoggedIn()) { | 1119 if (user_manager->IsUserLoggedIn()) { |
| 1119 chromeos::accessibility::EnableSpokenFeedback( | 1120 chromeos::AccessibilityManager::Get()->EnableSpokenFeedback( |
| 1120 enabled, NULL, ash::A11Y_NOTIFICATION_NONE); | 1121 enabled, NULL, ash::A11Y_NOTIFICATION_NONE); |
| 1121 } else { | 1122 } else { |
| 1122 ExistingUserController* controller = | 1123 ExistingUserController* controller = |
| 1123 ExistingUserController::current_controller(); | 1124 ExistingUserController::current_controller(); |
| 1124 chromeos::LoginDisplayHostImpl* webui_host = | 1125 chromeos::LoginDisplayHostImpl* webui_host = |
| 1125 static_cast<chromeos::LoginDisplayHostImpl*>( | 1126 static_cast<chromeos::LoginDisplayHostImpl*>( |
| 1126 controller->login_display_host()); | 1127 controller->login_display_host()); |
| 1127 chromeos::accessibility::EnableSpokenFeedback( | 1128 chromeos::AccessibilityManager::Get()->EnableSpokenFeedback( |
| 1128 enabled, | 1129 enabled, |
| 1129 webui_host->GetOobeUI()->web_ui(), | 1130 webui_host->GetOobeUI()->web_ui(), |
| 1130 ash::A11Y_NOTIFICATION_NONE); | 1131 ash::A11Y_NOTIFICATION_NONE); |
| 1131 } | 1132 } |
| 1132 | 1133 |
| 1133 reply.SendSuccess(return_value.get()); | 1134 reply.SendSuccess(return_value.get()); |
| 1134 } | 1135 } |
| 1135 | 1136 |
| 1136 void TestingAutomationProvider::IsSpokenFeedbackEnabled( | 1137 void TestingAutomationProvider::IsSpokenFeedbackEnabled( |
| 1137 DictionaryValue* args, IPC::Message* reply_message) { | 1138 DictionaryValue* args, IPC::Message* reply_message) { |
| 1138 AutomationJSONReply reply(this, reply_message); | 1139 AutomationJSONReply reply(this, reply_message); |
| 1139 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); | 1140 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); |
| 1140 return_value->SetBoolean("spoken_feedback", | 1141 return_value->SetBoolean( |
| 1141 chromeos::accessibility::IsSpokenFeedbackEnabled()); | 1142 "spoken_feedback", |
| 1143 chromeos::AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); |
| 1142 reply.SendSuccess(return_value.get()); | 1144 reply.SendSuccess(return_value.get()); |
| 1143 } | 1145 } |
| 1144 | 1146 |
| 1145 void TestingAutomationProvider::GetTimeInfo(Browser* browser, | 1147 void TestingAutomationProvider::GetTimeInfo(Browser* browser, |
| 1146 DictionaryValue* args, | 1148 DictionaryValue* args, |
| 1147 IPC::Message* reply_message) { | 1149 IPC::Message* reply_message) { |
| 1148 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); | 1150 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); |
| 1149 base::Time time(base::Time::Now()); | 1151 base::Time time(base::Time::Now()); |
| 1150 bool use_24hour_clock = browser && browser->profile()->GetPrefs()->GetBoolean( | 1152 bool use_24hour_clock = browser && browser->profile()->GetPrefs()->GetBoolean( |
| 1151 prefs::kUse24HourClock); | 1153 prefs::kUse24HourClock); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1267 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> | 1269 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> |
| 1268 AddObserver(power_manager_observer_); | 1270 AddObserver(power_manager_observer_); |
| 1269 } | 1271 } |
| 1270 | 1272 |
| 1271 void TestingAutomationProvider::RemoveChromeosObservers() { | 1273 void TestingAutomationProvider::RemoveChromeosObservers() { |
| 1272 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> | 1274 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> |
| 1273 RemoveObserver(power_manager_observer_); | 1275 RemoveObserver(power_manager_observer_); |
| 1274 delete power_manager_observer_; | 1276 delete power_manager_observer_; |
| 1275 power_manager_observer_ = NULL; | 1277 power_manager_observer_ = NULL; |
| 1276 } | 1278 } |
| OLD | NEW |