Commit 098beb35 authored by Leslie Watkins's avatar Leslie Watkins Committed by Commit Bot

Add a row in the network tray to inform users to turn Bluetooth on to enable Tether.

Rename TrayDetailsView::InfoLabel to TrayInfoLabel and moved it to its own file. It also now subclasses ActionableView instead of View, so it can be clickable. TrayInfoLabel::Delegate keeps track of whether or not the label is clickable, and handles clicks.

Reland of https://codereview.chromium.org/2957043002/

This reverts commit fc8ab64a.

Bug: 672263, 735642, 740671
Change-Id: I7957bc934e01e226ee588939a21d1fc4afc0bdb3
Reviewed-on: https://chromium-review.googlesource.com/578142
Commit-Queue: Kyle Horimoto <khorimoto@chromium.org>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#488263}
parent 8602f317
...@@ -540,6 +540,8 @@ component("ash") { ...@@ -540,6 +540,8 @@ component("ash") {
"system/tray/tray_event_filter.h", "system/tray/tray_event_filter.h",
"system/tray/tray_image_item.cc", "system/tray/tray_image_item.cc",
"system/tray/tray_image_item.h", "system/tray/tray_image_item.h",
"system/tray/tray_info_label.cc",
"system/tray/tray_info_label.h",
"system/tray/tray_item_more.cc", "system/tray/tray_item_more.cc",
"system/tray/tray_item_more.h", "system/tray/tray_item_more.h",
"system/tray/tray_item_view.cc", "system/tray/tray_item_view.cc",
...@@ -1248,6 +1250,7 @@ source_set("common_unittests") { ...@@ -1248,6 +1250,7 @@ source_set("common_unittests") {
"system/tray/system_tray_unittest.cc", "system/tray/system_tray_unittest.cc",
"system/tray/tray_details_view_unittest.cc", "system/tray/tray_details_view_unittest.cc",
"system/tray/tray_event_filter_unittest.cc", "system/tray/tray_event_filter_unittest.cc",
"system/tray/tray_info_label_unittest.cc",
"system/tray/tri_view_unittest.cc", "system/tray/tri_view_unittest.cc",
"system/tray_tracing_unittest.cc", "system/tray_tracing_unittest.cc",
"system/update/tray_update_unittest.cc", "system/update/tray_update_unittest.cc",
......
...@@ -892,6 +892,9 @@ This file contains the strings for ash. ...@@ -892,6 +892,9 @@ This file contains the strings for ash.
<message name="IDS_ASH_STATUS_TRAY_NO_MOBILE_NETWORKS" desc="The message to display in the network list when no mobile networks are available."> <message name="IDS_ASH_STATUS_TRAY_NO_MOBILE_NETWORKS" desc="The message to display in the network list when no mobile networks are available.">
No mobile network available No mobile network available
</message> </message>
<message name="IDS_ASH_STATUS_TRAY_ENABLE_BLUETOOTH" desc="The message to display in the network list when Tether is enabled but Bluetooth is disabled.">
Turn on Bluetooth to discover nearby devices
</message>
<message name="IDS_ASH_STATUS_TRAY_VPN_DISCONNECTED" desc="The label used in system tray bubble to display vpn is disconnected."> <message name="IDS_ASH_STATUS_TRAY_VPN_DISCONNECTED" desc="The label used in system tray bubble to display vpn is disconnected.">
VPN disconnected VPN disconnected
</message> </message>
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "ash/system/tray/system_tray_notifier.h" #include "ash/system/tray/system_tray_notifier.h"
#include "ash/system/tray/tray_constants.h" #include "ash/system/tray/tray_constants.h"
#include "ash/system/tray/tray_details_view.h" #include "ash/system/tray/tray_details_view.h"
#include "ash/system/tray/tray_info_label.h"
#include "ash/system/tray/tray_item_more.h" #include "ash/system/tray/tray_item_more.h"
#include "ash/system/tray/tray_popup_item_style.h" #include "ash/system/tray/tray_popup_item_style.h"
#include "ash/system/tray/tray_popup_utils.h" #include "ash/system/tray/tray_popup_utils.h"
...@@ -314,8 +315,8 @@ class BluetoothDetailedView : public TrayDetailsView { ...@@ -314,8 +315,8 @@ class BluetoothDetailedView : public TrayDetailsView {
// Show user Bluetooth state if there is no bluetooth devices in list. // Show user Bluetooth state if there is no bluetooth devices in list.
if (device_map_.size() == 0 && bluetooth_available && bluetooth_enabled) { if (device_map_.size() == 0 && bluetooth_available && bluetooth_enabled) {
scroll_content()->AddChildView( scroll_content()->AddChildView(new TrayInfoLabel(
new InfoLabel(IDS_ASH_STATUS_TRAY_BLUETOOTH_DISCOVERING)); nullptr /* delegate */, IDS_ASH_STATUS_TRAY_BLUETOOTH_DISCOVERING));
} }
// Focus the device which was focused before the device-list update. // Focus the device which was focused before the device-list update.
......
...@@ -876,10 +876,15 @@ int GetMobileUninitializedMsg() { ...@@ -876,10 +876,15 @@ int GetMobileUninitializedMsg() {
static int s_uninitialized_msg(0); static int s_uninitialized_msg(0);
NetworkStateHandler* handler = NetworkHandler::Get()->network_state_handler(); NetworkStateHandler* handler = NetworkHandler::Get()->network_state_handler();
if (handler->GetTechnologyState(NetworkTypePattern::Mobile()) == // TODO(lesliewatkins): Only return this message when Tether is uninitialized
// due to no Bluetooth (dependent on codereview.chromium.org/2969493002/).
if (handler->GetTechnologyState(NetworkTypePattern::Tether()) ==
NetworkStateHandler::TECHNOLOGY_UNINITIALIZED) { NetworkStateHandler::TECHNOLOGY_UNINITIALIZED) {
// TODO (lesliewatkins): Add a more descriptive message (e.g. "Enable s_uninitialized_msg = IDS_ASH_STATUS_TRAY_ENABLE_BLUETOOTH;
// Bluetooth") for Tether technology type. s_uninitialized_state_time = base::Time::Now();
return s_uninitialized_msg;
} else if (handler->GetTechnologyState(NetworkTypePattern::Mobile()) ==
NetworkStateHandler::TECHNOLOGY_UNINITIALIZED) {
s_uninitialized_msg = IDS_ASH_STATUS_TRAY_INITIALIZING_CELLULAR; s_uninitialized_msg = IDS_ASH_STATUS_TRAY_INITIALIZING_CELLULAR;
s_uninitialized_state_time = base::Time::Now(); s_uninitialized_state_time = base::Time::Now();
return s_uninitialized_msg; return s_uninitialized_msg;
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "ash/system/tray/system_tray_controller.h" #include "ash/system/tray/system_tray_controller.h"
#include "ash/system/tray/system_tray_delegate.h" #include "ash/system/tray/system_tray_delegate.h"
#include "ash/system/tray/tray_constants.h" #include "ash/system/tray/tray_constants.h"
#include "ash/system/tray/tray_info_label.h"
#include "ash/system/tray/tray_popup_item_style.h" #include "ash/system/tray/tray_popup_item_style.h"
#include "ash/system/tray/tray_popup_utils.h" #include "ash/system/tray/tray_popup_utils.h"
#include "ash/system/tray/tri_view.h" #include "ash/system/tray/tri_view.h"
...@@ -630,8 +631,8 @@ void NetworkListView::PlaceViewAtIndex(views::View* view, int index) { ...@@ -630,8 +631,8 @@ void NetworkListView::PlaceViewAtIndex(views::View* view, int index) {
void NetworkListView::UpdateInfoLabel(int message_id, void NetworkListView::UpdateInfoLabel(int message_id,
int insertion_index, int insertion_index,
InfoLabel** info_label_ptr) { TrayInfoLabel** info_label_ptr) {
InfoLabel* info_label = *info_label_ptr; TrayInfoLabel* info_label = *info_label_ptr;
if (!message_id) { if (!message_id) {
if (info_label) { if (info_label) {
needs_relayout_ = true; needs_relayout_ = true;
...@@ -641,13 +642,23 @@ void NetworkListView::UpdateInfoLabel(int message_id, ...@@ -641,13 +642,23 @@ void NetworkListView::UpdateInfoLabel(int message_id,
return; return;
} }
if (!info_label) if (!info_label)
info_label = new InfoLabel(message_id); info_label = new TrayInfoLabel(this /* delegate */, message_id);
else else
info_label->SetMessage(message_id); info_label->Update(message_id);
PlaceViewAtIndex(info_label, insertion_index); PlaceViewAtIndex(info_label, insertion_index);
*info_label_ptr = info_label; *info_label_ptr = info_label;
} }
void NetworkListView::OnLabelClicked(int message_id) {
if (message_id == IDS_ASH_STATUS_TRAY_ENABLE_BLUETOOTH)
Shell::Get()->system_tray_controller()->ShowBluetoothSettings();
}
bool NetworkListView::IsLabelClickable(int message_id) const {
return message_id == IDS_ASH_STATUS_TRAY_ENABLE_BLUETOOTH;
}
int NetworkListView::UpdateSectionHeaderRow(NetworkTypePattern pattern, int NetworkListView::UpdateSectionHeaderRow(NetworkTypePattern pattern,
bool enabled, bool enabled,
int child_index, int child_index,
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "ash/system/network/network_icon_animation_observer.h" #include "ash/system/network/network_icon_animation_observer.h"
#include "ash/system/network/network_info.h" #include "ash/system/network/network_info.h"
#include "ash/system/network/network_state_list_detailed_view.h" #include "ash/system/network/network_state_list_detailed_view.h"
#include "ash/system/tray/tray_info_label.h"
#include "base/macros.h" #include "base/macros.h"
#include "chromeos/network/network_state_handler.h" #include "chromeos/network/network_state_handler.h"
#include "chromeos/network/network_type_pattern.h" #include "chromeos/network/network_type_pattern.h"
...@@ -32,7 +33,8 @@ namespace tray { ...@@ -32,7 +33,8 @@ namespace tray {
// A list of available networks of a given type. This class is used for all // A list of available networks of a given type. This class is used for all
// network types except VPNs. For VPNs, see the |VPNList| class. // network types except VPNs. For VPNs, see the |VPNList| class.
class NetworkListView : public NetworkStateListDetailedView, class NetworkListView : public NetworkStateListDetailedView,
public network_icon::AnimationObserver { public network_icon::AnimationObserver,
public TrayInfoLabel::Delegate {
public: public:
class SectionHeaderRowView; class SectionHeaderRowView;
...@@ -104,7 +106,7 @@ class NetworkListView : public NetworkStateListDetailedView, ...@@ -104,7 +106,7 @@ class NetworkListView : public NetworkStateListDetailedView,
// and is only modified if the info label is created or destroyed. // and is only modified if the info label is created or destroyed.
void UpdateInfoLabel(int message_id, void UpdateInfoLabel(int message_id,
int insertion_index, int insertion_index,
InfoLabel** info_label_ptr); TrayInfoLabel** info_label_ptr);
// Creates a cellular/tether/Wi-Fi header row |view| and adds it to // Creates a cellular/tether/Wi-Fi header row |view| and adds it to
// |scroll_content()| if necessary and reorders the |scroll_content()| placing // |scroll_content()| if necessary and reorders the |scroll_content()| placing
...@@ -116,6 +118,10 @@ class NetworkListView : public NetworkStateListDetailedView, ...@@ -116,6 +118,10 @@ class NetworkListView : public NetworkStateListDetailedView,
SectionHeaderRowView** view, SectionHeaderRowView** view,
views::Separator** separator_view); views::Separator** separator_view);
// TrayInfoLabel::Delegate:
void OnLabelClicked(int message_id) override;
bool IsLabelClickable(int message_id) const override;
// network_icon::AnimationObserver: // network_icon::AnimationObserver:
void NetworkIconChanged() override; void NetworkIconChanged() override;
...@@ -125,8 +131,8 @@ class NetworkListView : public NetworkStateListDetailedView, ...@@ -125,8 +131,8 @@ class NetworkListView : public NetworkStateListDetailedView,
bool needs_relayout_; bool needs_relayout_;
InfoLabel* no_wifi_networks_view_; TrayInfoLabel* no_wifi_networks_view_;
InfoLabel* no_mobile_networks_view_; TrayInfoLabel* no_mobile_networks_view_;
SectionHeaderRowView* mobile_header_view_; SectionHeaderRowView* mobile_header_view_;
SectionHeaderRowView* wifi_header_view_; SectionHeaderRowView* wifi_header_view_;
views::Separator* mobile_separator_view_; views::Separator* mobile_separator_view_;
......
...@@ -237,35 +237,6 @@ const int kTitleRowPaddingBottom = ...@@ -237,35 +237,6 @@ const int kTitleRowPaddingBottom =
} // namespace } // namespace
////////////////////////////////////////////////////////////////////////////////
// TrayDetailsView::InfoLabel:
TrayDetailsView::InfoLabel::InfoLabel(int message_id)
: label_(TrayPopupUtils::CreateDefaultLabel()) {
SetLayoutManager(new views::FillLayout);
TrayPopupItemStyle style(TrayPopupItemStyle::FontStyle::SYSTEM_INFO);
style.SetupLabel(label_);
TriView* tri_view = TrayPopupUtils::CreateMultiTargetRowView();
tri_view->SetInsets(gfx::Insets(0,
kMenuExtraMarginFromLeftEdge +
kTrayPopupPaddingHorizontal -
kTrayPopupLabelHorizontalPadding,
0, kTrayPopupPaddingHorizontal));
tri_view->SetContainerVisible(TriView::Container::START, false);
tri_view->SetContainerVisible(TriView::Container::END, false);
tri_view->AddView(TriView::Container::CENTER, label_);
AddChildView(tri_view);
SetMessage(message_id);
}
TrayDetailsView::InfoLabel::~InfoLabel() {}
void TrayDetailsView::InfoLabel::SetMessage(int message_id) {
label_->SetText(l10n_util::GetStringUTF16(message_id));
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// TrayDetailsView: // TrayDetailsView:
......
...@@ -22,7 +22,6 @@ struct VectorIcon; ...@@ -22,7 +22,6 @@ struct VectorIcon;
namespace views { namespace views {
class BoxLayout; class BoxLayout;
class CustomButton; class CustomButton;
class Label;
class ProgressBar; class ProgressBar;
class ScrollView; class ScrollView;
} // namespace views } // namespace views
...@@ -52,22 +51,6 @@ class ASH_EXPORT TrayDetailsView : public views::View, ...@@ -52,22 +51,6 @@ class ASH_EXPORT TrayDetailsView : public views::View,
SystemTrayItem* owner() { return owner_; } SystemTrayItem* owner() { return owner_; }
protected: protected:
// A view containing only a label, which is to be inserted as a non-targetable
// row within a system menu detailed view (e.g., the "Scanning for devices..."
// message that can appear at the top of the Bluetooth detailed view).
class InfoLabel : public View {
public:
explicit InfoLabel(int message_id);
~InfoLabel() override;
void SetMessage(int message_id);
private:
views::Label* const label_;
DISALLOW_COPY_AND_ASSIGN(InfoLabel);
};
// views::View: // views::View:
void Layout() override; void Layout() override;
int GetHeightForWidth(int width) const override; int GetHeightForWidth(int width) const override;
......
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/system/tray/tray_info_label.h"
#include "ash/system/tray/tray_popup_item_style.h"
#include "ash/system/tray/tray_popup_utils.h"
#include "ui/accessibility/ax_node_data.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/views/layout/fill_layout.h"
namespace ash {
TrayInfoLabel::TrayInfoLabel(TrayInfoLabel::Delegate* delegate, int message_id)
: ActionableView(nullptr /* owner */, TrayPopupInkDropStyle::FILL_BOUNDS),
label_(TrayPopupUtils::CreateDefaultLabel()),
message_id_(message_id),
delegate_(delegate) {
SetLayoutManager(new views::FillLayout);
TriView* tri_view = TrayPopupUtils::CreateMultiTargetRowView();
tri_view->SetInsets(gfx::Insets(0,
kMenuExtraMarginFromLeftEdge +
kTrayPopupPaddingHorizontal -
kTrayPopupLabelHorizontalPadding,
0, kTrayPopupPaddingHorizontal));
tri_view->SetContainerVisible(TriView::Container::START, false);
tri_view->SetContainerVisible(TriView::Container::END, false);
tri_view->AddView(TriView::Container::CENTER, label_);
AddChildView(tri_view);
Update(message_id);
}
void TrayInfoLabel::Update(int message_id) {
message_id_ = message_id;
TrayPopupItemStyle::FontStyle font_style;
if (IsClickable()) {
SetInkDropMode(InkDropHostView::InkDropMode::ON);
font_style = TrayPopupItemStyle::FontStyle::CLICKABLE_SYSTEM_INFO;
} else {
SetInkDropMode(InkDropHostView::InkDropMode::OFF);
font_style = TrayPopupItemStyle::FontStyle::SYSTEM_INFO;
}
const TrayPopupItemStyle style(font_style);
style.SetupLabel(label_);
label_->SetText(l10n_util::GetStringUTF16(message_id));
}
bool TrayInfoLabel::PerformAction(const ui::Event& event) {
if (IsClickable()) {
delegate_->OnLabelClicked(message_id_);
return true;
}
return false;
}
void TrayInfoLabel::GetAccessibleNodeData(ui::AXNodeData* node_data) {
if (IsClickable())
node_data->role = ui::AX_ROLE_BUTTON;
else
node_data->role = ui::AX_ROLE_LABEL_TEXT;
}
bool TrayInfoLabel::IsClickable() {
if (delegate_)
return delegate_->IsLabelClickable(message_id_);
return false;
}
} // namespace ash
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_SYSTEM_TRAY_TRAY_INFO_LABEL_H_
#define ASH_SYSTEM_TRAY_TRAY_INFO_LABEL_H_
#include "ash/ash_export.h"
#include "ash/system/tray/actionable_view.h"
#include "ui/views/controls/label.h"
namespace ash {
// A view containing only a label, which is to be inserted as a
// row within a system menu detailed view (e.g., the "Scanning for devices..."
// message that can appear at the top of the Bluetooth detailed view).
// TrayInfoLabel can be clickable; this property is configured by its delegate.
class ASH_EXPORT TrayInfoLabel : public ActionableView {
public:
// A delegate for determining whether or not a TrayInfoLabel is clickable, and
// handling actions when it is clicked.
class Delegate {
public:
virtual ~Delegate() {}
virtual void OnLabelClicked(int message_id) = 0;
virtual bool IsLabelClickable(int message_id) const = 0;
};
// |delegate| may be null, which results in a TrayInfoLabel which cannot be
// clicked.
TrayInfoLabel(Delegate* delegate, int message_id);
~TrayInfoLabel() override{};
// Updates the TrayInfoLabel to display the message associated with
// |message_id|. This may update text styling if the delegate indicates that
// the TrayInfoLabel should be clickable.
void Update(int message_id);
// ActionableView:
bool PerformAction(const ui::Event& event) override;
void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
private:
friend class TrayInfoLabelTest;
bool IsClickable();
views::Label* const label_;
int message_id_;
Delegate* delegate_;
DISALLOW_COPY_AND_ASSIGN(TrayInfoLabel);
};
} // namespace ash
#endif // ASH_SYSTEM_TRAY_TRAY_INFO_LABEL_H_
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/system/tray/tray_info_label.h"
#include "ash/strings/grit/ash_strings.h"
#include "ash/test/ash_test_base.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/accessibility/ax_node_data.h"
namespace ash {
namespace {
class TestClickEvent : public ui::Event {
public:
TestClickEvent() : ui::Event(ui::ET_MOUSE_PRESSED, base::TimeTicks(), 0) {}
};
class TestDelegate : public TrayInfoLabel::Delegate {
public:
TestDelegate() {}
const std::vector<int>& clicked_message_ids() { return clicked_message_ids_; }
void AddClickableMessageId(int message_id) {
clickable_message_ids_.insert(message_id);
}
// TrayInfoLabel::Delegate:
void OnLabelClicked(int message_id) override {
clicked_message_ids_.push_back(message_id);
}
bool IsLabelClickable(int message_id) const override {
return clickable_message_ids_.find(message_id) !=
clickable_message_ids_.end();
}
private:
std::unordered_set<int> clickable_message_ids_;
std::vector<int> clicked_message_ids_;
};
} // namespace
class TrayInfoLabelTest : public AshTestBase {
public:
void TearDown() override {
AshTestBase::TearDown();
label_.reset();
delegate_.reset();
}
void CreateLabel(bool use_delegate, int message_id) {
if (use_delegate)
delegate_ = base::MakeUnique<TestDelegate>();
label_ = base::MakeUnique<TrayInfoLabel>(delegate_.get(), message_id);
}
void ClickOnLabel(bool expect_click_was_handled) {
bool click_was_handled = label_->PerformAction(TestClickEvent());
EXPECT_EQ(expect_click_was_handled, click_was_handled);
}
void VerifyClickability(bool expected_clickable) {
EXPECT_EQ(expected_clickable, label_->IsClickable());
ui::AXNodeData node_data;
label_->GetAccessibleNodeData(&node_data);
if (expected_clickable)
EXPECT_EQ(ui::AX_ROLE_BUTTON, node_data.role);
else
EXPECT_EQ(ui::AX_ROLE_LABEL_TEXT, node_data.role);
}
void VerifyClicks(const std::vector<int>& expected_clicked_message_ids) {
if (!delegate_) {
EXPECT_TRUE(expected_clicked_message_ids.empty());
return;
}
EXPECT_EQ(expected_clicked_message_ids, delegate_->clicked_message_ids());
}
void VerifyNoClicks() { VerifyClicks(std::vector<int>()); }
protected:
std::unique_ptr<TrayInfoLabel> label_;
std::unique_ptr<TestDelegate> delegate_;
};
TEST_F(TrayInfoLabelTest, NoDelegate) {
CreateLabel(false /* use_delegate */, IDS_ASH_STATUS_TRAY_BLUETOOTH_ENABLED);
VerifyClickability(false /* expected_clickable */);
label_->Update(IDS_ASH_STATUS_TRAY_BLUETOOTH_DISABLED);
VerifyClickability(false /* expected_clickable */);
label_->Update(IDS_ASH_STATUS_TRAY_BLUETOOTH_DISCOVERING);
VerifyClickability(false /* expected_clickable */);
}
TEST_F(TrayInfoLabelTest, PerformAction) {
const int kClickableMessageId1 = IDS_ASH_STATUS_TRAY_BLUETOOTH_ENABLED;
const int kClickableMessageId2 = IDS_ASH_STATUS_TRAY_BLUETOOTH_DISABLED;
const int kNonClickableMessageId = IDS_ASH_STATUS_TRAY_BLUETOOTH_DISCOVERING;
CreateLabel(true /* use_delegate */, kClickableMessageId1);
delegate_->AddClickableMessageId(kClickableMessageId1);
delegate_->AddClickableMessageId(kClickableMessageId2);
VerifyNoClicks();
VerifyClickability(true /* expected_clickable */);
ClickOnLabel(true /* expect_click_was_handled */);
VerifyClicks(std::vector<int>{kClickableMessageId1});
ClickOnLabel(true /* expect_click_was_handled */);
VerifyClicks(std::vector<int>{kClickableMessageId1, kClickableMessageId1});
label_->Update(kNonClickableMessageId);
VerifyClickability(false /* expected_clickable */);
ClickOnLabel(false /* expect_click_was_handled */);
VerifyClicks(std::vector<int>{kClickableMessageId1, kClickableMessageId1});
label_->Update(kClickableMessageId2);
VerifyClickability(true /* expected_clickable */);
ClickOnLabel(true /* expect_click_was_handled */);
VerifyClicks(std::vector<int>{kClickableMessageId1, kClickableMessageId1,
kClickableMessageId2});
}
} // namespace ash
...@@ -89,6 +89,13 @@ void TrayPopupItemStyle::SetupLabel(views::Label* label) const { ...@@ -89,6 +89,13 @@ void TrayPopupItemStyle::SetupLabel(views::Label* label) const {
label->SetFontList(base_font_list.Derive(1, gfx::Font::NORMAL, label->SetFontList(base_font_list.Derive(1, gfx::Font::NORMAL,
gfx::Font::Weight::NORMAL)); gfx::Font::Weight::NORMAL));
break; break;
case FontStyle::CLICKABLE_SYSTEM_INFO:
label->SetFontList(base_font_list.Derive(1, gfx::Font::NORMAL,
gfx::Font::Weight::NORMAL));
label->SetEnabledColor(label->GetNativeTheme()->GetSystemColor(
ui::NativeTheme::kColorId_ProminentButtonColor));
label->SetAutoColorReadabilityEnabled(false);
break;
case FontStyle::BUTTON: case FontStyle::BUTTON:
label->SetFontList(base_font_list.Derive(0, gfx::Font::NORMAL, label->SetFontList(base_font_list.Derive(0, gfx::Font::NORMAL,
gfx::Font::Weight::MEDIUM)); gfx::Font::Weight::MEDIUM));
......
...@@ -44,6 +44,8 @@ class TrayPopupItemStyle { ...@@ -44,6 +44,8 @@ class TrayPopupItemStyle {
// System information text (e.g. date/time, battery status, "Scanning for // System information text (e.g. date/time, battery status, "Scanning for
// devices..." seen in the Bluetooth detailed view, etc). // devices..." seen in the Bluetooth detailed view, etc).
SYSTEM_INFO, SYSTEM_INFO,
// System information text within a clickable row.
CLICKABLE_SYSTEM_INFO,
// Child buttons within rows that have a visible border (e.g. Cast's // Child buttons within rows that have a visible border (e.g. Cast's
// "Stop", etc). // "Stop", etc).
BUTTON, BUTTON,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment