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/stringprintf.h" | 12 #include "base/stringprintf.h" |
13 #include "base/time.h" | 13 #include "base/time.h" |
14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
15 #include "chrome/browser/automation/automation_provider_json.h" | 15 #include "chrome/browser/automation/automation_provider_json.h" |
16 #include "chrome/browser/automation/automation_provider_observers.h" | 16 #include "chrome/browser/automation/automation_provider_observers.h" |
17 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
18 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | 18 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
19 #include "chrome/browser/chromeos/audio/audio_handler.h" | 19 #include "chrome/browser/chromeos/audio/audio_handler.h" |
20 #include "chrome/browser/chromeos/cros/cros_library.h" | 20 #include "chrome/browser/chromeos/cros/cros_library.h" |
21 #include "chrome/browser/chromeos/cros/network_library.h" | 21 #include "chrome/browser/chromeos/cros/network_library.h" |
| 22 #include "chrome/browser/chromeos/cros_settings.h" |
22 #include "chrome/browser/chromeos/login/default_user_images.h" | 23 #include "chrome/browser/chromeos/login/default_user_images.h" |
23 #include "chrome/browser/chromeos/login/enrollment/enterprise_enrollment_screen.
h" | 24 #include "chrome/browser/chromeos/login/enrollment/enterprise_enrollment_screen.
h" |
24 #include "chrome/browser/chromeos/login/eula_screen.h" | 25 #include "chrome/browser/chromeos/login/eula_screen.h" |
25 #include "chrome/browser/chromeos/login/existing_user_controller.h" | 26 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
26 #include "chrome/browser/chromeos/login/login_display.h" | 27 #include "chrome/browser/chromeos/login/login_display.h" |
27 #include "chrome/browser/chromeos/login/login_display_host.h" | 28 #include "chrome/browser/chromeos/login/login_display_host.h" |
28 #include "chrome/browser/chromeos/login/network_screen.h" | 29 #include "chrome/browser/chromeos/login/network_screen.h" |
29 #include "chrome/browser/chromeos/login/screen_locker.h" | 30 #include "chrome/browser/chromeos/login/screen_locker.h" |
30 #include "chrome/browser/chromeos/login/update_screen.h" | 31 #include "chrome/browser/chromeos/login/update_screen.h" |
31 #include "chrome/browser/chromeos/login/user_image_screen.h" | 32 #include "chrome/browser/chromeos/login/user_image_screen.h" |
(...skipping 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1420 chromeos::AudioHandler* audio_handler = chromeos::AudioHandler::GetInstance(); | 1421 chromeos::AudioHandler* audio_handler = chromeos::AudioHandler::GetInstance(); |
1421 if (!audio_handler) { | 1422 if (!audio_handler) { |
1422 reply.SendError("AudioHandler not initialized."); | 1423 reply.SendError("AudioHandler not initialized."); |
1423 return; | 1424 return; |
1424 } | 1425 } |
1425 audio_handler->SetMuted(mute); | 1426 audio_handler->SetMuted(mute); |
1426 reply.SendSuccess(NULL); | 1427 reply.SendSuccess(NULL); |
1427 } | 1428 } |
1428 | 1429 |
1429 void TestingAutomationProvider::OpenCrosh(DictionaryValue* args, | 1430 void TestingAutomationProvider::OpenCrosh(DictionaryValue* args, |
1430 IPC::Message* reply_message) { | 1431 IPC::Message* reply_message) { |
1431 new NavigationNotificationObserver( | 1432 new NavigationNotificationObserver( |
1432 NULL, this, reply_message, 1, false, true); | 1433 NULL, this, reply_message, 1, false, true); |
1433 ash::Shell::GetInstance()->delegate()->OpenCrosh(); | 1434 ash::Shell::GetInstance()->delegate()->OpenCrosh(); |
1434 } | 1435 } |
1435 | 1436 |
1436 void TestingAutomationProvider::CaptureProfilePhoto( | 1437 void TestingAutomationProvider::CaptureProfilePhoto( |
1437 Browser* browser, | 1438 Browser* browser, |
1438 DictionaryValue* args, | 1439 DictionaryValue* args, |
1439 IPC::Message* reply_message) { | 1440 IPC::Message* reply_message) { |
1440 chromeos::TakePhotoDialog* take_photo_dialog = | 1441 chromeos::TakePhotoDialog* take_photo_dialog = |
1441 new chromeos::TakePhotoDialog(NULL); | 1442 new chromeos::TakePhotoDialog(NULL); |
1442 | 1443 |
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::SetCrosSetting(base::DictionaryValue* args, |
| 1455 IPC::Message* reply_message) { |
| 1456 AutomationJSONReply reply(this, reply_message); |
| 1457 std::string path; |
| 1458 base::Value* val; |
| 1459 if (!args->GetString("path", &path) || !args->Get("value", &val)) { |
| 1460 reply.SendError("Invalid or missing args."); |
| 1461 return; |
| 1462 } |
| 1463 chromeos::CrosSettings* settings = chromeos::CrosSettings::Get(); |
| 1464 settings->Set(path, *val); |
| 1465 reply.SendSuccess(NULL); |
| 1466 } |
| 1467 |
1453 void TestingAutomationProvider::AddChromeosObservers() { | 1468 void TestingAutomationProvider::AddChromeosObservers() { |
1454 power_manager_observer_ = new PowerManagerClientObserverForTesting; | 1469 power_manager_observer_ = new PowerManagerClientObserverForTesting; |
1455 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> | 1470 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> |
1456 AddObserver(power_manager_observer_); | 1471 AddObserver(power_manager_observer_); |
1457 } | 1472 } |
1458 | 1473 |
1459 void TestingAutomationProvider::RemoveChromeosObservers() { | 1474 void TestingAutomationProvider::RemoveChromeosObservers() { |
1460 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> | 1475 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> |
1461 RemoveObserver(power_manager_observer_); | 1476 RemoveObserver(power_manager_observer_); |
1462 delete power_manager_observer_; | 1477 delete power_manager_observer_; |
1463 power_manager_observer_ = NULL; | 1478 power_manager_observer_ = NULL; |
1464 } | 1479 } |
OLD | NEW |