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 3ea1f0a91ab29544f43d79bbb36bf0e9cd5d18de..7aa6f7ac428d835d51104bbe548954b05231e7c1 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 "ash/resources/vector_icons/vector_icons.h" |
#include "grit/ash_resources.h" |
@@ -69,7 +70,11 @@ class BluetoothDefaultView : public TrayItemMore { |
public: |
BluetoothDefaultView(SystemTrayItem* owner, bool show_more) |
: TrayItemMore(owner, show_more) { |
- if (!MaterialDesignController::IsSystemTrayMenuMaterial()) { |
+ if (MaterialDesignController::IsSystemTrayMenuMaterial()) { |
+ style()->SetFontStyle( |
+ TrayPopupItemStyle::FontStyle::MAIN_PANEL_SECTION_ROW); |
+ } else { |
+ // The image does not need to change for non-material. |
ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
SetImage( |
*bundle.GetImageNamed(IDR_AURA_UBER_TRAY_BLUETOOTH).ToImageSkia()); |
@@ -82,13 +87,38 @@ 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(); |
tdanderson
2016/09/12 18:51:47
I don't think you need to give this a name since y
bruthig
2016/09/15 18:56:29
Done.
|
+ |
+ if (MaterialDesignController::IsSystemTrayMenuMaterial()) { |
+ // 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); |
+ // UpdateContent() should be called due to the style change above. |
tdanderson
2016/09/12 18:51:47
Did you mean to actually call UpdateContent() here
bruthig
2016/09/15 18:56:29
It will be called via TrayItemMore::OnTrayPopupIte
tdanderson
2016/09/15 19:49:33
I read the 'should' in this comment as "[you the d
|
+ } else { |
+ UpdateContent(); |
+ } |
+ } |
+ |
+ protected: |
+ void UpdateContent() override { |
tdanderson
2016/09/12 18:51:47
private seems like a better choice than protected
bruthig
2016/09/15 18:56:29
Done.
|
+ TrayItemMore::UpdateContent(); |
+ |
+ SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate(); |
+ const bool enabled = delegate->GetBluetoothEnabled(); |
+ const bool is_bluetooth_available = delegate->GetBluetoothAvailable(); |
+ |
if (MaterialDesignController::IsSystemTrayMenuMaterial()) { |
- SetImage(gfx::CreateVectorIcon( |
+ gfx::ImageSkia image = gfx::CreateVectorIcon( |
enabled ? kSystemMenuBluetoothIcon : kSystemMenuBluetoothDisabledIcon, |
- kMenuIconColor)); |
+ 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 |