1 // Copyright 2013 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/default_system_tray_delegate.h"
9 #include "ash/session/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"
19 class DefaultVolumnControlDelegate
: public VolumeControlDelegate
{
21 DefaultVolumnControlDelegate() {}
22 virtual ~DefaultVolumnControlDelegate() {}
24 virtual bool HandleVolumeMute(const ui::Accelerator
& accelerator
) OVERRIDE
{
27 virtual bool HandleVolumeDown(const ui::Accelerator
& accelerator
) OVERRIDE
{
30 virtual bool HandleVolumeUp(const ui::Accelerator
& accelerator
) OVERRIDE
{
35 DISALLOW_COPY_AND_ASSIGN(DefaultVolumnControlDelegate
);
40 DefaultSystemTrayDelegate::DefaultSystemTrayDelegate()
41 : bluetooth_enabled_(true),
42 volume_control_delegate_(new DefaultVolumnControlDelegate
) {
45 DefaultSystemTrayDelegate::~DefaultSystemTrayDelegate() {
48 void DefaultSystemTrayDelegate::Initialize() {
51 void DefaultSystemTrayDelegate::Shutdown() {
54 bool DefaultSystemTrayDelegate::GetTrayVisibilityOnStartup() {
58 user::LoginStatus
DefaultSystemTrayDelegate::GetUserLoginStatus() const {
59 return user::LOGGED_IN_USER
;
62 void DefaultSystemTrayDelegate::ChangeProfilePicture() {
65 const std::string
DefaultSystemTrayDelegate::GetEnterpriseDomain() const {
69 const base::string16
DefaultSystemTrayDelegate::GetEnterpriseMessage() const {
70 return base::string16();
74 DefaultSystemTrayDelegate::GetSupervisedUserManager() const {
79 DefaultSystemTrayDelegate::GetSupervisedUserManagerName()
81 return base::string16();
84 const base::string16
DefaultSystemTrayDelegate::GetSupervisedUserMessage()
86 return base::string16();
89 bool DefaultSystemTrayDelegate::SystemShouldUpgrade() const {
93 base::HourClockType
DefaultSystemTrayDelegate::GetHourClockType() const {
94 return base::k24HourClock
;
97 void DefaultSystemTrayDelegate::ShowSettings() {
100 bool DefaultSystemTrayDelegate::ShouldShowSettings() {
104 void DefaultSystemTrayDelegate::ShowDateSettings() {
107 void DefaultSystemTrayDelegate::ShowSetTimeDialog() {
110 void DefaultSystemTrayDelegate::ShowNetworkSettings(
111 const std::string
& service_path
) {
114 void DefaultSystemTrayDelegate::ShowBluetoothSettings() {
117 void DefaultSystemTrayDelegate::ShowDisplaySettings() {
120 void DefaultSystemTrayDelegate::ShowChromeSlow() {
123 bool DefaultSystemTrayDelegate::ShouldShowDisplayNotification() {
127 void DefaultSystemTrayDelegate::ShowIMESettings() {
130 void DefaultSystemTrayDelegate::ShowHelp() {
133 void DefaultSystemTrayDelegate::ShowAccessibilityHelp() {
136 void DefaultSystemTrayDelegate::ShowAccessibilitySettings() {
139 void DefaultSystemTrayDelegate::ShowPublicAccountInfo() {
142 void DefaultSystemTrayDelegate::ShowEnterpriseInfo() {
145 void DefaultSystemTrayDelegate::ShowSupervisedUserInfo() {
148 void DefaultSystemTrayDelegate::ShowUserLogin() {
151 bool DefaultSystemTrayDelegate::ShowSpringChargerReplacementDialog() {
155 bool DefaultSystemTrayDelegate::IsSpringChargerReplacementDialogVisible() {
159 bool DefaultSystemTrayDelegate::HasUserConfirmedSafeSpringCharger() {
163 void DefaultSystemTrayDelegate::ShutDown() {
166 void DefaultSystemTrayDelegate::SignOut() {
169 void DefaultSystemTrayDelegate::RequestLockScreen() {
172 void DefaultSystemTrayDelegate::RequestRestartForUpdate() {
175 void DefaultSystemTrayDelegate::GetAvailableBluetoothDevices(
176 BluetoothDeviceList
* list
) {
179 void DefaultSystemTrayDelegate::BluetoothStartDiscovering() {
182 void DefaultSystemTrayDelegate::BluetoothStopDiscovering() {
185 void DefaultSystemTrayDelegate::ConnectToBluetoothDevice(
186 const std::string
& address
) {
189 void DefaultSystemTrayDelegate::GetCurrentIME(IMEInfo
* info
) {
192 void DefaultSystemTrayDelegate::GetAvailableIMEList(IMEInfoList
* list
) {
195 void DefaultSystemTrayDelegate::GetCurrentIMEProperties(
196 IMEPropertyInfoList
* list
) {
199 void DefaultSystemTrayDelegate::SwitchIME(const std::string
& ime_id
) {
202 void DefaultSystemTrayDelegate::ActivateIMEProperty(const std::string
& key
) {
205 void DefaultSystemTrayDelegate::ShowNetworkConfigure(
206 const std::string
& network_id
,
207 gfx::NativeWindow parent_window
) {
210 bool DefaultSystemTrayDelegate::EnrollNetwork(const std::string
& network_id
,
211 gfx::NativeWindow parent_window
) {
215 void DefaultSystemTrayDelegate::ManageBluetoothDevices() {
218 void DefaultSystemTrayDelegate::ToggleBluetooth() {
219 bluetooth_enabled_
= !bluetooth_enabled_
;
222 bool DefaultSystemTrayDelegate::IsBluetoothDiscovering() {
226 void DefaultSystemTrayDelegate::ShowMobileSimDialog() {
229 void DefaultSystemTrayDelegate::ShowMobileSetupDialog(
230 const std::string
& service_path
) {
233 void DefaultSystemTrayDelegate::ShowOtherNetworkDialog(
234 const std::string
& type
) {
237 bool DefaultSystemTrayDelegate::GetBluetoothAvailable() {
241 bool DefaultSystemTrayDelegate::GetBluetoothEnabled() {
242 return bluetooth_enabled_
;
245 bool DefaultSystemTrayDelegate::GetBluetoothDiscovering() {
249 void DefaultSystemTrayDelegate::ChangeProxySettings() {
252 VolumeControlDelegate
* DefaultSystemTrayDelegate::GetVolumeControlDelegate()
254 return volume_control_delegate_
.get();
257 void DefaultSystemTrayDelegate::SetVolumeControlDelegate(
258 scoped_ptr
<VolumeControlDelegate
> delegate
) {
259 volume_control_delegate_
= delegate
.Pass();
262 bool DefaultSystemTrayDelegate::GetSessionStartTime(
263 base::TimeTicks
* session_start_time
) {
267 bool DefaultSystemTrayDelegate::GetSessionLengthLimit(
268 base::TimeDelta
* session_length_limit
) {
272 int DefaultSystemTrayDelegate::GetSystemTrayMenuWidth() {
273 // This is the default width for English languages.
277 void DefaultSystemTrayDelegate::ActiveUserWasChanged() {
280 bool DefaultSystemTrayDelegate::IsSearchKeyMappedToCapsLock() {
284 tray::UserAccountsDelegate
* DefaultSystemTrayDelegate::GetUserAccountsDelegate(
285 const std::string
& user_id
) {