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/accelerators/accelerator_controller.h" |
7 #include "ash/shell.h" | 8 #include "ash/shell.h" |
8 #include "ash/shell_delegate.h" | 9 #include "ash/shell_delegate.h" |
9 #include "ash/system/tray/system_tray_delegate.h" | 10 #include "ash/system/tray/system_tray_delegate.h" |
10 #include "base/command_line.h" | 11 #include "base/command_line.h" |
11 #include "base/i18n/time_formatting.h" | 12 #include "base/i18n/time_formatting.h" |
12 #include "base/stringprintf.h" | 13 #include "base/stringprintf.h" |
13 #include "base/time.h" | 14 #include "base/time.h" |
14 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
15 #include "chrome/browser/automation/automation_provider_json.h" | 16 #include "chrome/browser/automation/automation_provider_json.h" |
16 #include "chrome/browser/automation/automation_provider_observers.h" | 17 #include "chrome/browser/automation/automation_provider_observers.h" |
(...skipping 1430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1447 // Set up an observer (it will delete itself). | 1448 // Set up an observer (it will delete itself). |
1448 take_photo_dialog->AddObserver(new PhotoCaptureObserver( | 1449 take_photo_dialog->AddObserver(new PhotoCaptureObserver( |
1449 this, reply_message)); | 1450 this, reply_message)); |
1450 | 1451 |
1451 views::Widget* window = views::Widget::CreateWindowWithParent( | 1452 views::Widget* window = views::Widget::CreateWindowWithParent( |
1452 take_photo_dialog, browser->window()->GetNativeWindow()); | 1453 take_photo_dialog, browser->window()->GetNativeWindow()); |
1453 window->SetAlwaysOnTop(true); | 1454 window->SetAlwaysOnTop(true); |
1454 window->Show(); | 1455 window->Show(); |
1455 } | 1456 } |
1456 | 1457 |
| 1458 void TestingAutomationProvider::RunAshCommand( |
| 1459 base::DictionaryValue* args, |
| 1460 IPC::Message* reply_message) { |
| 1461 int action; |
| 1462 AutomationJSONReply reply(this, reply_message); |
| 1463 if (!args->GetInteger("action", &action)) |
| 1464 reply.SendError("Invalid or missing args."); |
| 1465 |
| 1466 bool handled = |
| 1467 ash::Shell::GetInstance()->accelerator_controller()->PerformAction( |
| 1468 action, ui::Accelerator()); |
| 1469 |
| 1470 DictionaryValue result; |
| 1471 result.SetBoolean("handled", handled); |
| 1472 reply.SendSuccess(&result); |
| 1473 } |
| 1474 |
1457 void TestingAutomationProvider::AddChromeosObservers() { | 1475 void TestingAutomationProvider::AddChromeosObservers() { |
1458 power_manager_observer_ = new PowerManagerClientObserverForTesting; | 1476 power_manager_observer_ = new PowerManagerClientObserverForTesting; |
1459 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> | 1477 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> |
1460 AddObserver(power_manager_observer_); | 1478 AddObserver(power_manager_observer_); |
1461 } | 1479 } |
1462 | 1480 |
1463 void TestingAutomationProvider::RemoveChromeosObservers() { | 1481 void TestingAutomationProvider::RemoveChromeosObservers() { |
1464 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> | 1482 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> |
1465 RemoveObserver(power_manager_observer_); | 1483 RemoveObserver(power_manager_observer_); |
1466 delete power_manager_observer_; | 1484 delete power_manager_observer_; |
1467 power_manager_observer_ = NULL; | 1485 power_manager_observer_ = NULL; |
1468 } | 1486 } |
OLD | NEW |