OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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/ui/ash/system_tray_delegate_chromeos.h" | 5 #include "chrome/browser/ui/ash/system_tray_delegate_chromeos.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <set> | 10 #include <set> |
11 #include <string> | 11 #include <string> |
12 #include <utility> | 12 #include <utility> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "ash/common/login_status.h" | 15 #include "ash/common/login_status.h" |
16 #include "ash/common/material_design/material_design_controller.h" | |
16 #include "ash/common/session/session_state_delegate.h" | 17 #include "ash/common/session/session_state_delegate.h" |
17 #include "ash/common/session/session_state_observer.h" | 18 #include "ash/common/session/session_state_observer.h" |
18 #include "ash/common/shell_delegate.h" | 19 #include "ash/common/shell_delegate.h" |
19 #include "ash/common/shell_window_ids.h" | 20 #include "ash/common/shell_window_ids.h" |
20 #include "ash/common/system/chromeos/bluetooth/bluetooth_observer.h" | 21 #include "ash/common/system/chromeos/bluetooth/bluetooth_observer.h" |
21 #include "ash/common/system/chromeos/power/power_status.h" | 22 #include "ash/common/system/chromeos/power/power_status.h" |
22 #include "ash/common/system/chromeos/session/logout_button_observer.h" | 23 #include "ash/common/system/chromeos/session/logout_button_observer.h" |
23 #include "ash/common/system/chromeos/shutdown_policy_observer.h" | 24 #include "ash/common/system/chromeos/shutdown_policy_observer.h" |
24 #include "ash/common/system/date/clock_observer.h" | 25 #include "ash/common/system/date/clock_observer.h" |
25 #include "ash/common/system/ime/ime_observer.h" | 26 #include "ash/common/system/ime/ime_observer.h" |
26 #include "ash/common/system/tray/system_tray.h" | 27 #include "ash/common/system/tray/system_tray.h" |
27 #include "ash/common/system/tray/system_tray_delegate.h" | 28 #include "ash/common/system/tray/system_tray_delegate.h" |
28 #include "ash/common/system/tray/system_tray_notifier.h" | 29 #include "ash/common/system/tray/system_tray_notifier.h" |
30 #include "ash/common/system/tray/tray_constants.h" | |
29 #include "ash/common/system/tray_accessibility.h" | 31 #include "ash/common/system/tray_accessibility.h" |
30 #include "ash/common/system/update/update_observer.h" | 32 #include "ash/common/system/update/update_observer.h" |
31 #include "ash/common/system/user/user_observer.h" | 33 #include "ash/common/system/user/user_observer.h" |
32 #include "ash/common/system/volume_control_delegate.h" | 34 #include "ash/common/system/volume_control_delegate.h" |
33 #include "ash/common/wm_shell.h" | 35 #include "ash/common/wm_shell.h" |
36 #include "ash/resources/vector_icons/vector_icons.h" | |
34 #include "ash/shell.h" | 37 #include "ash/shell.h" |
35 #include "ash/system/chromeos/rotation/tray_rotation_lock.h" | 38 #include "ash/system/chromeos/rotation/tray_rotation_lock.h" |
36 #include "ash/wm/lock_state_controller.h" | 39 #include "ash/wm/lock_state_controller.h" |
37 #include "base/bind_helpers.h" | 40 #include "base/bind_helpers.h" |
38 #include "base/callback.h" | 41 #include "base/callback.h" |
39 #include "base/logging.h" | 42 #include "base/logging.h" |
40 #include "base/memory/ptr_util.h" | 43 #include "base/memory/ptr_util.h" |
41 #include "base/memory/weak_ptr.h" | 44 #include "base/memory/weak_ptr.h" |
42 #include "base/strings/stringprintf.h" | 45 #include "base/strings/stringprintf.h" |
43 #include "base/strings/utf_string_conversions.h" | 46 #include "base/strings/utf_string_conversions.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
108 #include "device/bluetooth/bluetooth_device.h" | 111 #include "device/bluetooth/bluetooth_device.h" |
109 #include "net/base/escape.h" | 112 #include "net/base/escape.h" |
110 #include "third_party/cros_system_api/dbus/service_constants.h" | 113 #include "third_party/cros_system_api/dbus/service_constants.h" |
111 #include "ui/base/ime/chromeos/extension_ime_util.h" | 114 #include "ui/base/ime/chromeos/extension_ime_util.h" |
112 #include "ui/base/ime/chromeos/ime_keyboard.h" | 115 #include "ui/base/ime/chromeos/ime_keyboard.h" |
113 #include "ui/base/ime/chromeos/input_method_manager.h" | 116 #include "ui/base/ime/chromeos/input_method_manager.h" |
114 #include "ui/base/l10n/l10n_util.h" | 117 #include "ui/base/l10n/l10n_util.h" |
115 #include "ui/base/l10n/time_format.h" | 118 #include "ui/base/l10n/time_format.h" |
116 #include "ui/chromeos/ime/input_method_menu_item.h" | 119 #include "ui/chromeos/ime/input_method_menu_item.h" |
117 #include "ui/chromeos/ime/input_method_menu_manager.h" | 120 #include "ui/chromeos/ime/input_method_menu_manager.h" |
121 #include "ui/gfx/paint_vector_icon.h" | |
118 | 122 |
119 #if defined(ENABLE_SUPERVISED_USERS) | 123 #if defined(ENABLE_SUPERVISED_USERS) |
120 #include "chrome/browser/supervised_user/supervised_user_service.h" | 124 #include "chrome/browser/supervised_user/supervised_user_service.h" |
121 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" | 125 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" |
122 #endif | 126 #endif |
123 | 127 |
124 namespace chromeos { | 128 namespace chromeos { |
125 | 129 |
126 namespace { | 130 namespace { |
127 | 131 |
(...skipping 29 matching lines...) Expand all Loading... | |
157 } | 161 } |
158 | 162 |
159 void BluetoothSetDiscoveringError() { | 163 void BluetoothSetDiscoveringError() { |
160 LOG(ERROR) << "BluetoothSetDiscovering failed."; | 164 LOG(ERROR) << "BluetoothSetDiscovering failed."; |
161 } | 165 } |
162 | 166 |
163 void BluetoothDeviceConnectError( | 167 void BluetoothDeviceConnectError( |
164 device::BluetoothDevice::ConnectErrorCode error_code) { | 168 device::BluetoothDevice::ConnectErrorCode error_code) { |
165 } | 169 } |
166 | 170 |
171 const gfx::VectorIcon& GetBluetoothDeviceIcon( | |
172 device::BluetoothDevice::DeviceType device_type) { | |
173 switch (device_type) { | |
174 case device::BluetoothDevice::DEVICE_COMPUTER: | |
175 return ash::kSystemMenuComputerIcon; | |
176 case device::BluetoothDevice::DEVICE_PHONE: | |
177 return ash::kSystemMenuPhoneIcon; | |
178 case device::BluetoothDevice::DEVICE_AUDIO: | |
179 case device::BluetoothDevice::DEVICE_CAR_AUDIO: | |
180 return ash::kSystemMenuHeadsetIcon; | |
181 case device::BluetoothDevice::DEVICE_VIDEO: | |
182 return ash::kSystemMenuVideocamIcon; | |
183 case device::BluetoothDevice::DEVICE_JOYSTICK: | |
184 case device::BluetoothDevice::DEVICE_GAMEPAD: | |
185 return ash::kSystemMenuGamepadIcon; | |
186 case device::BluetoothDevice::DEVICE_KEYBOARD: | |
187 case device::BluetoothDevice::DEVICE_KEYBOARD_MOUSE_COMBO: | |
188 return ash::kSystemMenuKeyboardIcon; | |
189 case device::BluetoothDevice::DEVICE_TABLET: | |
190 return ash::kSystemMenuTabletIcon; | |
191 case device::BluetoothDevice::DEVICE_MOUSE: | |
192 return ash::kSystemMenuMouseIcon; | |
193 default: | |
194 return ash::kSystemMenuBluetoothIcon; | |
oshima
2016/09/30 04:37:22
instead of returning in defualt, return outside of
fukino
2016/09/30 06:51:33
Done.
Handled with a warning message.
| |
195 } | |
196 } | |
197 | |
167 std::unique_ptr<ash::CastConfigDelegate> CreateCastConfigDelegate() { | 198 std::unique_ptr<ash::CastConfigDelegate> CreateCastConfigDelegate() { |
168 if (CastConfigDelegateMediaRouter::IsEnabled()) | 199 if (CastConfigDelegateMediaRouter::IsEnabled()) |
169 return base::MakeUnique<CastConfigDelegateMediaRouter>(); | 200 return base::MakeUnique<CastConfigDelegateMediaRouter>(); |
170 return base::MakeUnique<CastConfigDelegateChromeos>(); | 201 return base::MakeUnique<CastConfigDelegateChromeos>(); |
171 } | 202 } |
172 | 203 |
173 void ShowSettingsSubPageForActiveUser(const std::string& sub_page) { | 204 void ShowSettingsSubPageForActiveUser(const std::string& sub_page) { |
174 chrome::ShowSettingsSubPageForProfile( | 205 chrome::ShowSettingsSubPageForProfile( |
175 ProfileManager::GetActiveUserProfile(), sub_page); | 206 ProfileManager::GetActiveUserProfile(), sub_page); |
176 } | 207 } |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
590 device::BluetoothAdapter::DeviceList devices = | 621 device::BluetoothAdapter::DeviceList devices = |
591 bluetooth_adapter_->GetDevices(); | 622 bluetooth_adapter_->GetDevices(); |
592 for (size_t i = 0; i < devices.size(); ++i) { | 623 for (size_t i = 0; i < devices.size(); ++i) { |
593 device::BluetoothDevice* device = devices[i]; | 624 device::BluetoothDevice* device = devices[i]; |
594 ash::BluetoothDeviceInfo info; | 625 ash::BluetoothDeviceInfo info; |
595 info.address = device->GetAddress(); | 626 info.address = device->GetAddress(); |
596 info.display_name = device->GetNameForDisplay(); | 627 info.display_name = device->GetNameForDisplay(); |
597 info.connected = device->IsConnected(); | 628 info.connected = device->IsConnected(); |
598 info.connecting = device->IsConnecting(); | 629 info.connecting = device->IsConnecting(); |
599 info.paired = device->IsPaired(); | 630 info.paired = device->IsPaired(); |
631 if (ash::MaterialDesignController::IsSystemTrayMenuMaterial()) { | |
632 info.icon_image = gfx::CreateVectorIcon( | |
633 GetBluetoothDeviceIcon(device->GetDeviceType()), ash::kMenuIconColor); | |
634 } | |
600 list->push_back(info); | 635 list->push_back(info); |
601 } | 636 } |
602 } | 637 } |
603 | 638 |
604 void SystemTrayDelegateChromeOS::BluetoothStartDiscovering() { | 639 void SystemTrayDelegateChromeOS::BluetoothStartDiscovering() { |
605 if (GetBluetoothDiscovering()) { | 640 if (GetBluetoothDiscovering()) { |
606 LOG(WARNING) << "Already have active Bluetooth device discovery session."; | 641 LOG(WARNING) << "Already have active Bluetooth device discovery session."; |
607 return; | 642 return; |
608 } | 643 } |
609 VLOG(1) << "Requesting new Bluetooth device discovery session."; | 644 VLOG(1) << "Requesting new Bluetooth device discovery session."; |
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1299 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " | 1334 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " |
1300 << "ENABLE_SUPERVISED_USERS undefined."; | 1335 << "ENABLE_SUPERVISED_USERS undefined."; |
1301 return base::string16(); | 1336 return base::string16(); |
1302 } | 1337 } |
1303 | 1338 |
1304 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1339 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
1305 return new SystemTrayDelegateChromeOS(); | 1340 return new SystemTrayDelegateChromeOS(); |
1306 } | 1341 } |
1307 | 1342 |
1308 } // namespace chromeos | 1343 } // namespace chromeos |
OLD | NEW |