diff --git a/ash/system/phonehub/enable_hotspot_quick_action_controller.cc b/ash/system/phonehub/enable_hotspot_quick_action_controller.cc index 78936496ce1c1f..7934da2926fe6d 100644 --- a/ash/system/phonehub/enable_hotspot_quick_action_controller.cc +++ b/ash/system/phonehub/enable_hotspot_quick_action_controller.cc @@ -6,6 +6,7 @@ #include "ash/resources/vector_icons/vector_icons.h" #include "ash/strings/grit/ash_strings.h" +#include "ash/style/ash_color_provider.h" #include "ash/system/phonehub/phone_hub_metrics.h" #include "ash/system/phonehub/quick_action_item.h" #include "ui/base/l10n/l10n_util.h" @@ -74,26 +75,34 @@ void EnableHotspotQuickActionController::SetState(ActionState state) { bool icon_enabled; int state_text_id; int sub_label_text; + SkColor sub_label_color; switch (state) { case ActionState::kOff: icon_enabled = false; state_text_id = IDS_ASH_PHONE_HUB_QUICK_ACTIONS_DISABLED_STATE_TOOLTIP; sub_label_text = IDS_ASH_PHONE_HUB_QUICK_ACTIONS_OFF_STATE; + sub_label_color = AshColorProvider::Get()->GetContentLayerColor( + AshColorProvider::ContentLayerType::kTextColorSecondary); break; case ActionState::kConnecting: icon_enabled = true; state_text_id = IDS_ASH_PHONE_HUB_QUICK_ACTIONS_CONNECTING_STATE_TOOLTIP; sub_label_text = IDS_ASH_PHONE_HUB_QUICK_ACTIONS_CONNECTING_STATE; + sub_label_color = AshColorProvider::Get()->GetContentLayerColor( + AshColorProvider::ContentLayerType::kTextColorSecondary); break; case ActionState::kConnected: icon_enabled = true; state_text_id = IDS_ASH_PHONE_HUB_QUICK_ACTIONS_CONNECTED_STATE_TOOLTIP; sub_label_text = IDS_ASH_PHONE_HUB_QUICK_ACTIONS_CONNECTED_STATE; + sub_label_color = AshColorProvider::Get()->GetContentLayerColor( + AshColorProvider::ContentLayerType::kTextColorPositive); break; } item_->SetToggled(icon_enabled); item_->SetSubLabel(l10n_util::GetStringUTF16(sub_label_text)); + item_->SetSubLabelColor(sub_label_color); base::string16 tooltip_state = l10n_util::GetStringFUTF16(state_text_id, item_->GetItemLabel()); item_->SetIconTooltip( diff --git a/ash/system/phonehub/quick_action_item.cc b/ash/system/phonehub/quick_action_item.cc index 86b4d333331a12..1cc20408458c68 100644 --- a/ash/system/phonehub/quick_action_item.cc +++ b/ash/system/phonehub/quick_action_item.cc @@ -63,6 +63,9 @@ QuickActionItem::QuickActionItem(Delegate* delegate, ConfigureLabel(sub_label_, kUnifiedFeaturePodSubLabelLineHeight, kUnifiedFeaturePodSubLabelFontSize); + sub_label_color_ = AshColorProvider::Get()->GetContentLayerColor( + AshColorProvider::ContentLayerType::kTextColorSecondary); + SetEnabled(true /* enabled */); SetPaintToLayer(); @@ -80,6 +83,13 @@ void QuickActionItem::SetSubLabel(const base::string16& sub_label) { sub_label_->SetText(sub_label); } +void QuickActionItem::SetSubLabelColor(SkColor color) { + if (sub_label_color_ == color) + return; + sub_label_color_ = color; + sub_label_->SetEnabledColor(sub_label_color_); +} + void QuickActionItem::SetIcon(bool is_on) { icon_button_->SetVectorIcon(is_on ? icon_on_ : icon_off_); } @@ -120,8 +130,7 @@ void QuickActionItem::SetEnabled(bool enabled) { } else { label_->SetEnabledColor(AshColorProvider::Get()->GetContentLayerColor( AshColorProvider::ContentLayerType::kTextColorPrimary)); - sub_label_->SetEnabledColor(AshColorProvider::Get()->GetContentLayerColor( - AshColorProvider::ContentLayerType::kTextColorSecondary)); + sub_label_->SetEnabledColor(sub_label_color_); } } diff --git a/ash/system/phonehub/quick_action_item.h b/ash/system/phonehub/quick_action_item.h index 910abb68198be0..061609b027b206 100644 --- a/ash/system/phonehub/quick_action_item.h +++ b/ash/system/phonehub/quick_action_item.h @@ -44,6 +44,9 @@ class ASH_EXPORT QuickActionItem : public views::View, // Set the text of sub-label shown below the label. void SetSubLabel(const base::string16& sub_label); + // Set the color of sub-label shown below the label. + void SetSubLabelColor(SkColor color); + // Set the icon button to be either |icon_on_| or |icon_off_|. void SetIcon(bool is_on); @@ -81,6 +84,9 @@ class ASH_EXPORT QuickActionItem : public views::View, const gfx::VectorIcon& icon_off_; views::Label* label_ = nullptr; views::Label* sub_label_ = nullptr; + + // Enabled color of the sub label. + SkColor sub_label_color_; }; } // namespace ash