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 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1182 reply.SendError("Invalid or missing args."); | 1183 reply.SendError("Invalid or missing args."); |
1183 return; | 1184 return; |
1184 } | 1185 } |
1185 const UserManager* user_manager = UserManager::Get(); | 1186 const UserManager* user_manager = UserManager::Get(); |
1186 if (!user_manager) { | 1187 if (!user_manager) { |
1187 reply.SendError("No user manager!"); | 1188 reply.SendError("No user manager!"); |
1188 return; | 1189 return; |
1189 } | 1190 } |
1190 | 1191 |
1191 if (user_manager->IsUserLoggedIn()) { | 1192 if (user_manager->IsUserLoggedIn()) { |
1192 chromeos::accessibility::EnableSpokenFeedback( | 1193 chromeos::AccessibilityManager::Get()->EnableSpokenFeedback( |
1193 enabled, NULL, ash::A11Y_NOTIFICATION_NONE); | 1194 enabled, NULL, ash::A11Y_NOTIFICATION_NONE); |
1194 } else { | 1195 } else { |
1195 ExistingUserController* controller = | 1196 ExistingUserController* controller = |
1196 ExistingUserController::current_controller(); | 1197 ExistingUserController::current_controller(); |
1197 chromeos::LoginDisplayHostImpl* webui_host = | 1198 chromeos::LoginDisplayHostImpl* webui_host = |
1198 static_cast<chromeos::LoginDisplayHostImpl*>( | 1199 static_cast<chromeos::LoginDisplayHostImpl*>( |
1199 controller->login_display_host()); | 1200 controller->login_display_host()); |
1200 chromeos::accessibility::EnableSpokenFeedback( | 1201 chromeos::AccessibilityManager::Get()->EnableSpokenFeedback( |
1201 enabled, | 1202 enabled, |
1202 webui_host->GetOobeUI()->web_ui(), | 1203 webui_host->GetOobeUI()->web_ui(), |
1203 ash::A11Y_NOTIFICATION_NONE); | 1204 ash::A11Y_NOTIFICATION_NONE); |
1204 } | 1205 } |
1205 | 1206 |
1206 reply.SendSuccess(return_value.get()); | 1207 reply.SendSuccess(return_value.get()); |
1207 } | 1208 } |
1208 | 1209 |
1209 void TestingAutomationProvider::IsSpokenFeedbackEnabled( | 1210 void TestingAutomationProvider::IsSpokenFeedbackEnabled( |
1210 DictionaryValue* args, IPC::Message* reply_message) { | 1211 DictionaryValue* args, IPC::Message* reply_message) { |
1211 AutomationJSONReply reply(this, reply_message); | 1212 AutomationJSONReply reply(this, reply_message); |
1212 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); | 1213 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); |
1213 return_value->SetBoolean("spoken_feedback", | 1214 return_value->SetBoolean( |
1214 chromeos::accessibility::IsSpokenFeedbackEnabled()); | 1215 "spoken_feedback", |
| 1216 chromeos::AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); |
1215 reply.SendSuccess(return_value.get()); | 1217 reply.SendSuccess(return_value.get()); |
1216 } | 1218 } |
1217 | 1219 |
1218 void TestingAutomationProvider::GetTimeInfo(Browser* browser, | 1220 void TestingAutomationProvider::GetTimeInfo(Browser* browser, |
1219 DictionaryValue* args, | 1221 DictionaryValue* args, |
1220 IPC::Message* reply_message) { | 1222 IPC::Message* reply_message) { |
1221 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); | 1223 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); |
1222 base::Time time(base::Time::Now()); | 1224 base::Time time(base::Time::Now()); |
1223 bool use_24hour_clock = browser && browser->profile()->GetPrefs()->GetBoolean( | 1225 bool use_24hour_clock = browser && browser->profile()->GetPrefs()->GetBoolean( |
1224 prefs::kUse24HourClock); | 1226 prefs::kUse24HourClock); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1340 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> | 1342 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> |
1341 AddObserver(power_manager_observer_); | 1343 AddObserver(power_manager_observer_); |
1342 } | 1344 } |
1343 | 1345 |
1344 void TestingAutomationProvider::RemoveChromeosObservers() { | 1346 void TestingAutomationProvider::RemoveChromeosObservers() { |
1345 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> | 1347 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> |
1346 RemoveObserver(power_manager_observer_); | 1348 RemoveObserver(power_manager_observer_); |
1347 delete power_manager_observer_; | 1349 delete power_manager_observer_; |
1348 power_manager_observer_ = NULL; | 1350 power_manager_observer_ = NULL; |
1349 } | 1351 } |
OLD | NEW |