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

Unified Diff: ash/common/system/chromeos/bluetooth/tray_bluetooth.cc

Issue 2365523002: Materialized the font/icon color for some default rows in the system menu. (Closed)
Patch Set: Addressed tdanderson@ comments from previous 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
« no previous file with comments | « ash/BUILD.gn ('k') | ash/common/system/chromeos/network/tray_network.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 0bd4759e7a8e036186f21fa085fc439fa9a10880..72866e7b3af5609043bfaeadaf3b19621aacba60 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"
@@ -71,11 +72,11 @@ class BluetoothDefaultView : public TrayItemMore {
BluetoothDefaultView(SystemTrayItem* owner, bool show_more)
: TrayItemMore(owner, show_more) {
if (!MaterialDesignController::IsSystemTrayMenuMaterial()) {
+ // The icon doesn't change in non-md.
ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
SetImage(
*bundle.GetImageNamed(IDR_AURA_UBER_TRAY_BLUETOOTH).ToImageSkia());
}
- Update();
}
~BluetoothDefaultView() override {}
@@ -83,12 +84,6 @@ class BluetoothDefaultView : public TrayItemMore {
void Update() {
SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate();
const bool enabled = delegate->GetBluetoothEnabled();
- if (MaterialDesignController::IsSystemTrayMenuMaterial()) {
- SetImage(gfx::CreateVectorIcon(
- enabled ? kSystemMenuBluetoothIcon : kSystemMenuBluetoothDisabledIcon,
- kMenuIconColor));
- }
-
if (delegate->GetBluetoothAvailable()) {
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
const base::string16 label = rb.GetLocalizedString(
@@ -100,6 +95,37 @@ class BluetoothDefaultView : public TrayItemMore {
} else {
SetVisible(false);
}
+ UpdateStyle();
+ }
+
+ protected:
+ // TrayItemMore:
+ std::unique_ptr<TrayPopupItemStyle> CreateStyle() const override {
+ SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate();
+ std::unique_ptr<TrayPopupItemStyle> style = TrayItemMore::CreateStyle();
+ style->set_color_style(
+ delegate->GetBluetoothEnabled()
+ ? TrayPopupItemStyle::ColorStyle::ACTIVE
+ : delegate->GetBluetoothAvailable()
+ ? TrayPopupItemStyle::ColorStyle::INACTIVE
+ : TrayPopupItemStyle::ColorStyle::DISABLED);
+
+ return style;
+ }
+
+ void UpdateStyle() override {
+ TrayItemMore::UpdateStyle();
+
+ if (!MaterialDesignController::IsSystemTrayMenuMaterial())
+ return;
+
+ SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate();
+ std::unique_ptr<TrayPopupItemStyle> style = CreateStyle();
+
+ SetImage(gfx::CreateVectorIcon(delegate->GetBluetoothEnabled()
+ ? kSystemMenuBluetoothIcon
+ : kSystemMenuBluetoothDisabledIcon,
+ style->GetForegroundColor()));
}
private:
@@ -450,6 +476,7 @@ views::View* TrayBluetooth::CreateDefaultView(LoginStatus status) {
CHECK(default_ == NULL);
default_ =
new tray::BluetoothDefaultView(this, status != LoginStatus::LOCKED);
+ default_->Update();
return default_;
}
« no previous file with comments | « ash/BUILD.gn ('k') | ash/common/system/chromeos/network/tray_network.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698