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/networking_config_delegate.h"
10 #include "ash/session/session_state_delegate.h"
11 #include "ash/shell.h"
12 #include "ash/volume_control_delegate.h"
13 #include "base/message_loop/message_loop.h"
14 #include "base/time/time.h"
20 class DefaultVolumnControlDelegate
: public VolumeControlDelegate
{
22 DefaultVolumnControlDelegate() {}
23 ~DefaultVolumnControlDelegate() override
{}
25 void HandleVolumeMute(const ui::Accelerator
& accelerator
) override
{}
26 void HandleVolumeDown(const ui::Accelerator
& accelerator
) override
{}
27 void HandleVolumeUp(const ui::Accelerator
& accelerator
) override
{}
30 DISALLOW_COPY_AND_ASSIGN(DefaultVolumnControlDelegate
);
35 DefaultSystemTrayDelegate::DefaultSystemTrayDelegate()
36 : bluetooth_enabled_(true),
37 volume_control_delegate_(new DefaultVolumnControlDelegate
) {
40 DefaultSystemTrayDelegate::~DefaultSystemTrayDelegate() {
43 void DefaultSystemTrayDelegate::Initialize() {
46 void DefaultSystemTrayDelegate::Shutdown() {
49 bool DefaultSystemTrayDelegate::GetTrayVisibilityOnStartup() {
53 user::LoginStatus
DefaultSystemTrayDelegate::GetUserLoginStatus() const {
54 return user::LOGGED_IN_USER
;
57 void DefaultSystemTrayDelegate::ChangeProfilePicture() {
60 const std::string
DefaultSystemTrayDelegate::GetEnterpriseDomain() const {
64 const base::string16
DefaultSystemTrayDelegate::GetEnterpriseMessage() const {
65 return base::string16();
69 DefaultSystemTrayDelegate::GetSupervisedUserManager() const {
70 if (!IsUserSupervised())
72 return "manager@chrome.com";
76 DefaultSystemTrayDelegate::GetSupervisedUserManagerName()
78 return base::string16();
81 const base::string16
DefaultSystemTrayDelegate::GetSupervisedUserMessage()
83 return base::string16();
86 bool DefaultSystemTrayDelegate::IsUserSupervised() const {
87 return GetUserLoginStatus() == ash::user::LOGGED_IN_SUPERVISED
;
90 bool DefaultSystemTrayDelegate::IsUserChild() const {
94 void DefaultSystemTrayDelegate::GetSystemUpdateInfo(UpdateInfo
* info
) const {
96 info
->severity
= UpdateInfo::UPDATE_NORMAL
;
97 info
->update_required
= true;
98 info
->factory_reset_required
= false;
101 base::HourClockType
DefaultSystemTrayDelegate::GetHourClockType() const {
102 return base::k24HourClock
;
105 void DefaultSystemTrayDelegate::ShowSettings() {
108 bool DefaultSystemTrayDelegate::ShouldShowSettings() {
112 void DefaultSystemTrayDelegate::ShowDateSettings() {
115 void DefaultSystemTrayDelegate::ShowSetTimeDialog() {
118 void DefaultSystemTrayDelegate::ShowNetworkSettings(
119 const std::string
& service_path
) {
122 void DefaultSystemTrayDelegate::ShowBluetoothSettings() {
125 void DefaultSystemTrayDelegate::ShowDisplaySettings() {
128 void DefaultSystemTrayDelegate::ShowChromeSlow() {
131 bool DefaultSystemTrayDelegate::ShouldShowDisplayNotification() {
135 void DefaultSystemTrayDelegate::ShowIMESettings() {
138 void DefaultSystemTrayDelegate::ShowHelp() {
141 void DefaultSystemTrayDelegate::ShowAccessibilityHelp() {
144 void DefaultSystemTrayDelegate::ShowAccessibilitySettings() {
147 void DefaultSystemTrayDelegate::ShowPublicAccountInfo() {
150 void DefaultSystemTrayDelegate::ShowEnterpriseInfo() {
153 void DefaultSystemTrayDelegate::ShowSupervisedUserInfo() {
156 void DefaultSystemTrayDelegate::ShowUserLogin() {
159 void DefaultSystemTrayDelegate::SignOut() {
162 void DefaultSystemTrayDelegate::RequestLockScreen() {
165 void DefaultSystemTrayDelegate::RequestRestartForUpdate() {
168 void DefaultSystemTrayDelegate::GetAvailableBluetoothDevices(
169 BluetoothDeviceList
* list
) {
172 void DefaultSystemTrayDelegate::BluetoothStartDiscovering() {
175 void DefaultSystemTrayDelegate::BluetoothStopDiscovering() {
178 void DefaultSystemTrayDelegate::ConnectToBluetoothDevice(
179 const std::string
& address
) {
182 void DefaultSystemTrayDelegate::GetCurrentIME(IMEInfo
* info
) {
185 void DefaultSystemTrayDelegate::GetAvailableIMEList(IMEInfoList
* list
) {
188 void DefaultSystemTrayDelegate::GetCurrentIMEProperties(
189 IMEPropertyInfoList
* list
) {
192 void DefaultSystemTrayDelegate::SwitchIME(const std::string
& ime_id
) {
195 void DefaultSystemTrayDelegate::ActivateIMEProperty(const std::string
& key
) {
198 void DefaultSystemTrayDelegate::ManageBluetoothDevices() {
201 void DefaultSystemTrayDelegate::ToggleBluetooth() {
202 bluetooth_enabled_
= !bluetooth_enabled_
;
205 bool DefaultSystemTrayDelegate::IsBluetoothDiscovering() {
209 void DefaultSystemTrayDelegate::ShowOtherNetworkDialog(
210 const std::string
& type
) {
213 bool DefaultSystemTrayDelegate::GetBluetoothAvailable() {
217 bool DefaultSystemTrayDelegate::GetBluetoothEnabled() {
218 return bluetooth_enabled_
;
221 bool DefaultSystemTrayDelegate::GetBluetoothDiscovering() {
225 void DefaultSystemTrayDelegate::ChangeProxySettings() {
228 NetworkingConfigDelegate
*
229 DefaultSystemTrayDelegate::GetNetworkingConfigDelegate() const {
233 VolumeControlDelegate
* DefaultSystemTrayDelegate::GetVolumeControlDelegate()
235 return volume_control_delegate_
.get();
238 void DefaultSystemTrayDelegate::SetVolumeControlDelegate(
239 scoped_ptr
<VolumeControlDelegate
> delegate
) {
240 volume_control_delegate_
= delegate
.Pass();
243 bool DefaultSystemTrayDelegate::GetSessionStartTime(
244 base::TimeTicks
* session_start_time
) {
248 bool DefaultSystemTrayDelegate::GetSessionLengthLimit(
249 base::TimeDelta
* session_length_limit
) {
253 int DefaultSystemTrayDelegate::GetSystemTrayMenuWidth() {
254 // This is the default width for English languages.
258 void DefaultSystemTrayDelegate::ActiveUserWasChanged() {
261 bool DefaultSystemTrayDelegate::IsSearchKeyMappedToCapsLock() {
265 tray::UserAccountsDelegate
* DefaultSystemTrayDelegate::GetUserAccountsDelegate(
266 const std::string
& user_id
) {
270 void DefaultSystemTrayDelegate::AddCustodianInfoTrayObserver(
271 CustodianInfoTrayObserver
* observer
) {
274 void DefaultSystemTrayDelegate::RemoveCustodianInfoTrayObserver(
275 CustodianInfoTrayObserver
* observer
) {
278 void DefaultSystemTrayDelegate::AddShutdownPolicyObserver(
279 ShutdownPolicyObserver
* observer
) {
282 void DefaultSystemTrayDelegate::RemoveShutdownPolicyObserver(
283 ShutdownPolicyObserver
* observer
) {
286 void DefaultSystemTrayDelegate::ShouldRebootOnShutdown(
287 const RebootOnShutdownCallback
& callback
) {