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" |
| 8 #include "ash/system/tray/system_tray_delegate.h" |
7 #include "base/command_line.h" | 9 #include "base/command_line.h" |
8 #include "base/i18n/time_formatting.h" | 10 #include "base/i18n/time_formatting.h" |
9 #include "base/stringprintf.h" | 11 #include "base/stringprintf.h" |
10 #include "base/time.h" | 12 #include "base/time.h" |
11 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
12 #include "chrome/browser/automation/automation_provider_json.h" | 14 #include "chrome/browser/automation/automation_provider_json.h" |
13 #include "chrome/browser/automation/automation_provider_observers.h" | 15 #include "chrome/browser/automation/automation_provider_observers.h" |
14 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
15 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | 17 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
16 #include "chrome/browser/chromeos/audio/audio_handler.h" | 18 #include "chrome/browser/chromeos/audio/audio_handler.h" |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 int observer_id = automation_event_queue_->AddObserver( | 293 int observer_id = automation_event_queue_->AddObserver( |
292 new LoginEventObserver(automation_event_queue_.get(), | 294 new LoginEventObserver(automation_event_queue_.get(), |
293 controller)); | 295 controller)); |
294 | 296 |
295 // Return the observer's id. | 297 // Return the observer's id. |
296 DictionaryValue return_value; | 298 DictionaryValue return_value; |
297 return_value.SetInteger("observer_id", observer_id); | 299 return_value.SetInteger("observer_id", observer_id); |
298 reply.SendSuccess(&return_value); | 300 reply.SendSuccess(&return_value); |
299 } | 301 } |
300 | 302 |
| 303 void TestingAutomationProvider::SignOut(DictionaryValue* args, |
| 304 IPC::Message* reply_message) { |
| 305 ash::Shell::GetInstance()->tray_delegate()->SignOut(); |
| 306 // Sign out has the side effect of restarting the session_manager |
| 307 // and chrome, thereby severing the automation channel, so it's |
| 308 // not really necessary to send a reply back. The next line is |
| 309 // for consistency with other methods. |
| 310 AutomationJSONReply(this, reply_message).SendSuccess(NULL); |
| 311 } |
| 312 |
301 void TestingAutomationProvider::LockScreen(DictionaryValue* args, | 313 void TestingAutomationProvider::LockScreen(DictionaryValue* args, |
302 IPC::Message* reply_message) { | 314 IPC::Message* reply_message) { |
303 new ScreenLockUnlockObserver(this, reply_message, true); | 315 new ScreenLockUnlockObserver(this, reply_message, true); |
304 DBusThreadManager::Get()->GetPowerManagerClient()-> | 316 DBusThreadManager::Get()->GetPowerManagerClient()-> |
305 NotifyScreenLockRequested(); | 317 NotifyScreenLockRequested(); |
306 } | 318 } |
307 | 319 |
308 void TestingAutomationProvider::UnlockScreen(DictionaryValue* args, | 320 void TestingAutomationProvider::UnlockScreen(DictionaryValue* args, |
309 IPC::Message* reply_message) { | 321 IPC::Message* reply_message) { |
310 std::string password; | 322 std::string password; |
(...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1235 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> | 1247 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> |
1236 AddObserver(power_manager_observer_); | 1248 AddObserver(power_manager_observer_); |
1237 } | 1249 } |
1238 | 1250 |
1239 void TestingAutomationProvider::RemoveChromeosObservers() { | 1251 void TestingAutomationProvider::RemoveChromeosObservers() { |
1240 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> | 1252 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> |
1241 RemoveObserver(power_manager_observer_); | 1253 RemoveObserver(power_manager_observer_); |
1242 delete power_manager_observer_; | 1254 delete power_manager_observer_; |
1243 power_manager_observer_ = NULL; | 1255 power_manager_observer_ = NULL; |
1244 } | 1256 } |
OLD | NEW |