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

Unified Diff: chrome/browser/ui/ash/system_tray_delegate_chromeos.cc

Issue 2381493005: Add bluetooth device type icons on MD system tray. (Closed)
Patch Set: Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/ash/system_tray_delegate_chromeos.cc
diff --git a/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc b/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc
index a78cad3166ccac5514271bb79753e08915d87304..c821966a572d54415668f0b8c70e0303c2d8df39 100644
--- a/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc
+++ b/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc
@@ -13,6 +13,7 @@
#include <vector>
#include "ash/common/login_status.h"
+#include "ash/common/material_design/material_design_controller.h"
#include "ash/common/session/session_state_delegate.h"
#include "ash/common/session/session_state_observer.h"
#include "ash/common/shell_delegate.h"
@@ -26,11 +27,13 @@
#include "ash/common/system/tray/system_tray.h"
#include "ash/common/system/tray/system_tray_delegate.h"
#include "ash/common/system/tray/system_tray_notifier.h"
+#include "ash/common/system/tray/tray_constants.h"
#include "ash/common/system/tray_accessibility.h"
#include "ash/common/system/update/update_observer.h"
#include "ash/common/system/user/user_observer.h"
#include "ash/common/system/volume_control_delegate.h"
#include "ash/common/wm_shell.h"
+#include "ash/resources/vector_icons/vector_icons.h"
#include "ash/shell.h"
#include "ash/system/chromeos/rotation/tray_rotation_lock.h"
#include "ash/wm/lock_state_controller.h"
@@ -115,6 +118,7 @@
#include "ui/base/l10n/time_format.h"
#include "ui/chromeos/ime/input_method_menu_item.h"
#include "ui/chromeos/ime/input_method_menu_manager.h"
+#include "ui/gfx/paint_vector_icon.h"
#if defined(ENABLE_SUPERVISED_USERS)
#include "chrome/browser/supervised_user/supervised_user_service.h"
@@ -164,6 +168,32 @@ void BluetoothDeviceConnectError(
device::BluetoothDevice::ConnectErrorCode error_code) {
}
+const gfx::VectorIcon& GetBluetoothDeviceIcon(
+ device::BluetoothDevice::DeviceType device_type) {
+ switch (device_type) {
tdanderson 2016/09/29 18:54:40 Doesn't the compiler complain that you're not hand
fukino 2016/09/30 02:43:49 I didn't see any errors. I assume device::Bluetoot
+ case device::BluetoothDevice::DEVICE_COMPUTER:
+ return ash::kSystemMenuComputerIcon;
+ case device::BluetoothDevice::DEVICE_PHONE:
+ return ash::kSystemMenuPhoneIcon;
+ case device::BluetoothDevice::DEVICE_AUDIO:
+ case device::BluetoothDevice::DEVICE_CAR_AUDIO:
+ return ash::kSystemMenuHeadsetIcon;
+ case device::BluetoothDevice::DEVICE_VIDEO:
+ return ash::kSystemMenuVideocamIcon;
+ case device::BluetoothDevice::DEVICE_JOYSTICK:
+ case device::BluetoothDevice::DEVICE_GAMEPAD:
+ return ash::kSystemMenuGamepadIcon;
+ case device::BluetoothDevice::DEVICE_KEYBOARD:
+ case device::BluetoothDevice::DEVICE_KEYBOARD_MOUSE_COMBO:
+ return ash::kSystemMenuKeyboardIcon;
+ case device::BluetoothDevice::DEVICE_TABLET:
tdanderson 2016/09/29 18:54:40 Are you sure you want to use the mouse icon for ta
fukino 2016/09/30 02:43:49 Oh, there was a mistake on the spec. https://docs.
+ case device::BluetoothDevice::DEVICE_MOUSE:
+ return ash::kSystemMenuMouseIcon;
+ default:
+ return ash::kSystemMenuBluetoothIcon;
+ }
+}
+
std::unique_ptr<ash::CastConfigDelegate> CreateCastConfigDelegate() {
if (CastConfigDelegateMediaRouter::IsEnabled())
return base::MakeUnique<CastConfigDelegateMediaRouter>();
@@ -597,6 +627,10 @@ void SystemTrayDelegateChromeOS::GetAvailableBluetoothDevices(
info.connected = device->IsConnected();
info.connecting = device->IsConnecting();
info.paired = device->IsPaired();
+ if (ash::MaterialDesignController::IsSystemTrayMenuMaterial()) {
+ info.icon_image = gfx::CreateVectorIcon(
+ GetBluetoothDeviceIcon(device->GetDeviceType()), ash::kMenuIconColor);
+ }
list->push_back(info);
}
}

Powered by Google App Engine
This is Rietveld 408576698