Chromium Code Reviews| Index: ash/common/system/chromeos/bluetooth/tray_bluetooth.cc |
| diff --git a/ash/common/system/chromeos/bluetooth/tray_bluetooth.cc b/ash/common/system/chromeos/bluetooth/tray_bluetooth.cc |
| index b9157d78af308ede6d670bfde9c20eed70432740..35d271523d5bb84529c1aab484509671c62f44ab 100644 |
| --- a/ash/common/system/chromeos/bluetooth/tray_bluetooth.cc |
| +++ b/ash/common/system/chromeos/bluetooth/tray_bluetooth.cc |
| @@ -16,6 +16,7 @@ |
| #include "ash/common/system/tray/tray_details_view.h" |
| #include "ash/common/system/tray/tray_item_more.h" |
| #include "ash/common/system/tray/tray_popup_header_button.h" |
| +#include "ash/common/system/tray/tray_popup_item_style.h" |
| #include "ash/common/wm_shell.h" |
| #include "grit/ash_resources.h" |
| #include "grit/ash_strings.h" |
| @@ -69,6 +70,10 @@ class BluetoothDefaultView : public TrayItemMore { |
| public: |
| BluetoothDefaultView(SystemTrayItem* owner, bool show_more) |
| : TrayItemMore(owner, show_more) { |
| + SetStyle(base::MakeUnique<TrayPopupItemStyle>( |
|
tdanderson
2016/09/08 16:11:02
Put this behind an if (is_material) ?
bruthig
2016/09/12 13:45:33
Done.
|
| + GetNativeTheme(), |
| + TrayPopupItemStyle::FontStyle::MAIN_PANEL_SECTION_ROW)); |
| + // The image does not need to change for non-material. |
| if (!MaterialDesignController::IsSystemTrayMenuMaterial()) { |
| ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
| SetImage( |
| @@ -82,14 +87,26 @@ class BluetoothDefaultView : public TrayItemMore { |
| void Update() { |
| SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate(); |
| const bool enabled = delegate->GetBluetoothEnabled(); |
| + const bool is_bluetooth_available = delegate->GetBluetoothAvailable(); |
| + |
| + // Toggle the style here because there is no bluetooth enabled/disabled |
| + // event to observe. |
| + style()->SetColorStyle( |
| + enabled ? TrayPopupItemStyle::ColorStyle::ACTIVE |
| + : is_bluetooth_available |
| + ? TrayPopupItemStyle::ColorStyle::INACTIVE |
| + : TrayPopupItemStyle::ColorStyle::DISABLED); |
| + |
| if (MaterialDesignController::IsSystemTrayMenuMaterial()) { |
| gfx::VectorIconId icon_id = |
| enabled ? gfx::VectorIconId::SYSTEM_MENU_BLUETOOTH |
| : gfx::VectorIconId::SYSTEM_MENU_BLUETOOTH_DISABLED; |
| - SetImage(gfx::CreateVectorIcon(icon_id, kMenuIconColor)); |
| + gfx::ImageSkia image = |
| + gfx::CreateVectorIcon(icon_id, style()->GetForegroundColor()); |
| + SetImage(image); |
| } |
| - if (delegate->GetBluetoothAvailable()) { |
| + if (is_bluetooth_available) { |
| ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| const base::string16 label = rb.GetLocalizedString( |
| enabled ? IDS_ASH_STATUS_TRAY_BLUETOOTH_ENABLED |
| @@ -102,6 +119,12 @@ class BluetoothDefaultView : public TrayItemMore { |
| } |
| } |
| + // TrayItemMore: |
| + void OnTrayPopupItemStyleChanged() override { |
| + Update(); |
| + TrayItemMore::OnTrayPopupItemStyleChanged(); |
| + } |
| + |
| private: |
| DISALLOW_COPY_AND_ASSIGN(BluetoothDefaultView); |
| }; |
| @@ -112,6 +135,7 @@ class BluetoothDetailedView : public TrayDetailsView { |
| : TrayDetailsView(owner), |
| login_(login), |
| manage_devices_(nullptr), |
| + throbber_(nullptr), |
| toggle_bluetooth_(nullptr), |
| enable_bluetooth_(nullptr) { |
| CreateItems(); |