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
3 // found in the LICENSE file.
5 #include "ash/system/tray/test_system_tray_delegate.h"
9 #include "ash/session_state_delegate.h"
10 #include "ash/shell.h"
11 #include "ash/volume_control_delegate.h"
12 #include "base/message_loop/message_loop.h"
13 #include "base/time/time.h"
20 class TestVolumeControlDelegate
: public VolumeControlDelegate
{
22 TestVolumeControlDelegate() {}
23 virtual ~TestVolumeControlDelegate() {}
25 virtual bool HandleVolumeMute(const ui::Accelerator
& accelerator
) OVERRIDE
{
28 virtual bool HandleVolumeDown(const ui::Accelerator
& accelerator
) OVERRIDE
{
31 virtual bool HandleVolumeUp(const ui::Accelerator
& accelerator
) OVERRIDE
{
36 DISALLOW_COPY_AND_ASSIGN(TestVolumeControlDelegate
);
41 TestSystemTrayDelegate::TestSystemTrayDelegate()
42 : bluetooth_enabled_(true),
43 caps_lock_enabled_(false),
44 should_show_display_notification_(false),
45 volume_control_delegate_(new TestVolumeControlDelegate
) {
48 TestSystemTrayDelegate::~TestSystemTrayDelegate() {
51 void TestSystemTrayDelegate::Initialize() {
54 void TestSystemTrayDelegate::Shutdown() {
57 bool TestSystemTrayDelegate::GetTrayVisibilityOnStartup() {
61 // Overridden from SystemTrayDelegate:
62 user::LoginStatus
TestSystemTrayDelegate::GetUserLoginStatus() const {
63 // At new user image screen manager->IsUserLoggedIn() would return true
64 // but there's no browser session available yet so use SessionStarted().
65 SessionStateDelegate
* delegate
=
66 Shell::GetInstance()->session_state_delegate();
68 if (!delegate
->IsActiveUserSessionStarted())
69 return ash::user::LOGGED_IN_NONE
;
70 if (delegate
->IsScreenLocked())
71 return user::LOGGED_IN_LOCKED
;
72 // TODO(nkostylev): Support LOGGED_IN_OWNER, LOGGED_IN_GUEST, LOGGED_IN_KIOSK,
74 return user::LOGGED_IN_USER
;
77 bool TestSystemTrayDelegate::IsOobeCompleted() const {
81 void TestSystemTrayDelegate::ChangeProfilePicture() {
84 const std::string
TestSystemTrayDelegate::GetEnterpriseDomain() const {
88 const base::string16
TestSystemTrayDelegate::GetEnterpriseMessage() const {
92 const std::string
TestSystemTrayDelegate::GetLocallyManagedUserManager() const {
96 const base::string16
TestSystemTrayDelegate::GetLocallyManagedUserManagerName()
101 const base::string16
TestSystemTrayDelegate::GetLocallyManagedUserMessage()
106 bool TestSystemTrayDelegate::SystemShouldUpgrade() const {
110 base::HourClockType
TestSystemTrayDelegate::GetHourClockType() const {
111 return base::k24HourClock
;
114 void TestSystemTrayDelegate::ShowSettings() {
117 void TestSystemTrayDelegate::ShowDateSettings() {
120 void TestSystemTrayDelegate::ShowNetworkSettings(
121 const std::string
& service_path
) {
124 void TestSystemTrayDelegate::ShowBluetoothSettings() {
127 void TestSystemTrayDelegate::ShowDisplaySettings() {
130 void TestSystemTrayDelegate::ShowChromeSlow() {
133 bool TestSystemTrayDelegate::ShouldShowDisplayNotification() {
134 return should_show_display_notification_
;
137 void TestSystemTrayDelegate::ShowDriveSettings() {
140 void TestSystemTrayDelegate::ShowIMESettings() {
143 void TestSystemTrayDelegate::ShowHelp() {
146 void TestSystemTrayDelegate::ShowAccessibilityHelp() {
149 void TestSystemTrayDelegate::ShowAccessibilitySettings() {
152 void TestSystemTrayDelegate::ShowPublicAccountInfo() {
155 void TestSystemTrayDelegate::ShowEnterpriseInfo() {
158 void TestSystemTrayDelegate::ShowLocallyManagedUserInfo() {
161 void TestSystemTrayDelegate::ShowUserLogin() {
164 void TestSystemTrayDelegate::ShutDown() {
165 base::MessageLoop::current()->Quit();
168 void TestSystemTrayDelegate::SignOut() {
169 base::MessageLoop::current()->Quit();
172 void TestSystemTrayDelegate::RequestLockScreen() {
175 void TestSystemTrayDelegate::RequestRestartForUpdate() {
178 void TestSystemTrayDelegate::GetAvailableBluetoothDevices(
179 BluetoothDeviceList
* list
) {
182 void TestSystemTrayDelegate::BluetoothStartDiscovering() {
185 void TestSystemTrayDelegate::BluetoothStopDiscovering() {
188 void TestSystemTrayDelegate::ConnectToBluetoothDevice(
189 const std::string
& address
) {
192 void TestSystemTrayDelegate::GetCurrentIME(IMEInfo
* info
) {
195 void TestSystemTrayDelegate::GetAvailableIMEList(IMEInfoList
* list
) {
198 void TestSystemTrayDelegate::GetCurrentIMEProperties(
199 IMEPropertyInfoList
* list
) {
202 void TestSystemTrayDelegate::SwitchIME(const std::string
& ime_id
) {
205 void TestSystemTrayDelegate::ActivateIMEProperty(const std::string
& key
) {
208 void TestSystemTrayDelegate::CancelDriveOperation(int32 operation_id
) {
211 void TestSystemTrayDelegate::GetDriveOperationStatusList(
212 ash::DriveOperationStatusList
*) {
215 void TestSystemTrayDelegate::ConfigureNetwork(const std::string
& network_id
) {
218 void TestSystemTrayDelegate::EnrollOrConfigureNetwork(
219 const std::string
& network_id
,
220 gfx::NativeWindow parent_window
) {
223 void TestSystemTrayDelegate::ManageBluetoothDevices() {
226 void TestSystemTrayDelegate::ToggleBluetooth() {
227 bluetooth_enabled_
= !bluetooth_enabled_
;
230 bool TestSystemTrayDelegate::IsBluetoothDiscovering() {
234 void TestSystemTrayDelegate::ShowMobileSimDialog() {
237 void TestSystemTrayDelegate::ShowMobileSetup(const std::string
& network_id
) {
240 void TestSystemTrayDelegate::ShowOtherWifi() {
243 void TestSystemTrayDelegate::ShowOtherVPN() {
246 void TestSystemTrayDelegate::ShowOtherCellular() {
249 bool TestSystemTrayDelegate::GetBluetoothAvailable() {
253 bool TestSystemTrayDelegate::GetBluetoothEnabled() {
254 return bluetooth_enabled_
;
257 bool TestSystemTrayDelegate::GetCellularCarrierInfo(std::string
* carrier_id
,
258 std::string
* topup_url
,
259 std::string
* setup_url
) {
263 void TestSystemTrayDelegate::ShowCellularURL(const std::string
& url
) {
266 void TestSystemTrayDelegate::ChangeProxySettings() {
269 VolumeControlDelegate
* TestSystemTrayDelegate::GetVolumeControlDelegate()
271 return volume_control_delegate_
.get();
274 void TestSystemTrayDelegate::SetVolumeControlDelegate(
275 scoped_ptr
<VolumeControlDelegate
> delegate
) {
276 volume_control_delegate_
= delegate
.Pass();
279 bool TestSystemTrayDelegate::GetSessionStartTime(
280 base::TimeTicks
* session_start_time
) {
284 bool TestSystemTrayDelegate::GetSessionLengthLimit(
285 base::TimeDelta
* session_length_limit
) {
289 int TestSystemTrayDelegate::GetSystemTrayMenuWidth() {
290 // This is the default width for English languages.
294 base::string16
TestSystemTrayDelegate::FormatTimeDuration(
295 const base::TimeDelta
& delta
) const {
296 return base::string16();
299 void TestSystemTrayDelegate::MaybeSpeak(const std::string
& utterance
) const {