Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(351)

Side by Side Diff: chrome/browser/ui/ash/system_tray_delegate_chromeos.cc

Issue 2381493005: Add bluetooth device type icons on MD system tray. (Closed)
Patch Set: Revert PS4 and fix a header file to be included. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/resources/vector_icons/system_menu_videocam.1x.icon ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 case device::BluetoothDevice::DEVICE_UNKNOWN:
194 LOG(WARNING) << "Unknown device type icon for Bluetooth was requested.";
195 break;
196 default:
197 break;
oshima 2016/10/04 21:00:59 remove default:
fukino 2016/10/05 06:34:45 Done in ash/common/system/chromeos/bluetooth/tray_
198 }
199 return ash::kSystemMenuBluetoothIcon;
200 }
201
167 std::unique_ptr<ash::CastConfigDelegate> CreateCastConfigDelegate() { 202 std::unique_ptr<ash::CastConfigDelegate> CreateCastConfigDelegate() {
168 if (CastConfigDelegateMediaRouter::IsEnabled()) 203 if (CastConfigDelegateMediaRouter::IsEnabled())
169 return base::MakeUnique<CastConfigDelegateMediaRouter>(); 204 return base::MakeUnique<CastConfigDelegateMediaRouter>();
170 return base::MakeUnique<CastConfigDelegateChromeos>(); 205 return base::MakeUnique<CastConfigDelegateChromeos>();
171 } 206 }
172 207
173 void ShowSettingsSubPageForActiveUser(const std::string& sub_page) { 208 void ShowSettingsSubPageForActiveUser(const std::string& sub_page) {
174 chrome::ShowSettingsSubPageForProfile( 209 chrome::ShowSettingsSubPageForProfile(
175 ProfileManager::GetActiveUserProfile(), sub_page); 210 ProfileManager::GetActiveUserProfile(), sub_page);
176 } 211 }
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 device::BluetoothAdapter::DeviceList devices = 625 device::BluetoothAdapter::DeviceList devices =
591 bluetooth_adapter_->GetDevices(); 626 bluetooth_adapter_->GetDevices();
592 for (size_t i = 0; i < devices.size(); ++i) { 627 for (size_t i = 0; i < devices.size(); ++i) {
593 device::BluetoothDevice* device = devices[i]; 628 device::BluetoothDevice* device = devices[i];
594 ash::BluetoothDeviceInfo info; 629 ash::BluetoothDeviceInfo info;
595 info.address = device->GetAddress(); 630 info.address = device->GetAddress();
596 info.display_name = device->GetNameForDisplay(); 631 info.display_name = device->GetNameForDisplay();
597 info.connected = device->IsConnected(); 632 info.connected = device->IsConnected();
598 info.connecting = device->IsConnecting(); 633 info.connecting = device->IsConnecting();
599 info.paired = device->IsPaired(); 634 info.paired = device->IsPaired();
635 if (ash::MaterialDesignController::IsSystemTrayMenuMaterial()) {
636 info.icon_image = gfx::CreateVectorIcon(
637 GetBluetoothDeviceIcon(device->GetDeviceType()), ash::kMenuIconColor);
638 }
600 list->push_back(info); 639 list->push_back(info);
601 } 640 }
602 } 641 }
603 642
604 void SystemTrayDelegateChromeOS::BluetoothStartDiscovering() { 643 void SystemTrayDelegateChromeOS::BluetoothStartDiscovering() {
605 if (GetBluetoothDiscovering()) { 644 if (GetBluetoothDiscovering()) {
606 LOG(WARNING) << "Already have active Bluetooth device discovery session."; 645 LOG(WARNING) << "Already have active Bluetooth device discovery session.";
607 return; 646 return;
608 } 647 }
609 VLOG(1) << "Requesting new Bluetooth device discovery session."; 648 VLOG(1) << "Requesting new Bluetooth device discovery session.";
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " 1338 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while "
1300 << "ENABLE_SUPERVISED_USERS undefined."; 1339 << "ENABLE_SUPERVISED_USERS undefined.";
1301 return base::string16(); 1340 return base::string16();
1302 } 1341 }
1303 1342
1304 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { 1343 ash::SystemTrayDelegate* CreateSystemTrayDelegate() {
1305 return new SystemTrayDelegateChromeOS(); 1344 return new SystemTrayDelegateChromeOS();
1306 } 1345 }
1307 1346
1308 } // namespace chromeos 1347 } // namespace chromeos
OLDNEW
« no previous file with comments | « ash/resources/vector_icons/system_menu_videocam.1x.icon ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698