| 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 1426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1443 // Set up an observer (it will delete itself). | 1444 // Set up an observer (it will delete itself). |
| 1444 take_photo_dialog->AddObserver(new PhotoCaptureObserver( | 1445 take_photo_dialog->AddObserver(new PhotoCaptureObserver( |
| 1445 this, reply_message)); | 1446 this, reply_message)); |
| 1446 | 1447 |
| 1447 views::Widget* window = views::Widget::CreateWindowWithParent( | 1448 views::Widget* window = views::Widget::CreateWindowWithParent( |
| 1448 take_photo_dialog, browser->window()->GetNativeWindow()); | 1449 take_photo_dialog, browser->window()->GetNativeWindow()); |
| 1449 window->SetAlwaysOnTop(true); | 1450 window->SetAlwaysOnTop(true); |
| 1450 window->Show(); | 1451 window->Show(); |
| 1451 } | 1452 } |
| 1452 | 1453 |
| 1454 void TestingAutomationProvider::RunAshCommand( |
| 1455 base::DictionaryValue* args, |
| 1456 IPC::Message* reply_message) { |
| 1457 int action; |
| 1458 AutomationJSONReply reply(this, reply_message); |
| 1459 if (!args->GetInteger("action", &action)) |
| 1460 reply.SendError("Invalid or missing args."); |
| 1461 |
| 1462 bool handled = |
| 1463 ash::Shell::GetInstance()->accelerator_controller()->PerformAction( |
| 1464 action, ui::Accelerator()); |
| 1465 |
| 1466 DictionaryValue result; |
| 1467 result.SetBoolean("handled", handled); |
| 1468 reply.SendSuccess(&result); |
| 1469 } |
| 1470 |
| 1453 void TestingAutomationProvider::AddChromeosObservers() { | 1471 void TestingAutomationProvider::AddChromeosObservers() { |
| 1454 power_manager_observer_ = new PowerManagerClientObserverForTesting; | 1472 power_manager_observer_ = new PowerManagerClientObserverForTesting; |
| 1455 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> | 1473 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> |
| 1456 AddObserver(power_manager_observer_); | 1474 AddObserver(power_manager_observer_); |
| 1457 } | 1475 } |
| 1458 | 1476 |
| 1459 void TestingAutomationProvider::RemoveChromeosObservers() { | 1477 void TestingAutomationProvider::RemoveChromeosObservers() { |
| 1460 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> | 1478 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> |
| 1461 RemoveObserver(power_manager_observer_); | 1479 RemoveObserver(power_manager_observer_); |
| 1462 delete power_manager_observer_; | 1480 delete power_manager_observer_; |
| 1463 power_manager_observer_ = NULL; | 1481 power_manager_observer_ = NULL; |
| 1464 } | 1482 } |
| OLD | NEW |