Commit 5125662b authored by minch's avatar minch Committed by Commit Bot

dark_mode: Remove LabelTrayView.

Delete not used LabelTrayView. Also DEFAULT_VIEW_LABEL and
AddIconAndLabelForDefaultView that only used by this class.
Also delete AddIconAndLabels, which is not used any more either.

Bug: 982950
Change-Id: If1fd29d8273394ae0e38705c68ba7b53156a158c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1764271Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Min Chen <minch@chromium.org>
Cr-Commit-Position: refs/heads/master@{#690006}
parent 23f920b2
......@@ -932,8 +932,6 @@ component("ash") {
"system/tray/hover_highlight_view.h",
"system/tray/interacted_by_tap_recorder.cc",
"system/tray/interacted_by_tap_recorder.h",
"system/tray/label_tray_view.cc",
"system/tray/label_tray_view.h",
"system/tray/size_range_layout.cc",
"system/tray/size_range_layout.h",
"system/tray/system_menu_button.cc",
......
......@@ -94,33 +94,10 @@ void HoverHighlightView::AddIconAndLabel(const gfx::ImageSkia& image,
TrayPopupItemStyle::FontStyle::DETAILED_VIEW_LABEL);
}
void HoverHighlightView::AddIconAndLabels(const gfx::ImageSkia& image,
const base::string16& text,
const base::string16& sub_text) {
DoAddIconAndLabels(image, text,
TrayPopupItemStyle::FontStyle::DETAILED_VIEW_LABEL,
sub_text);
}
void HoverHighlightView::AddIconAndLabelForDefaultView(
const gfx::ImageSkia& image,
const base::string16& text) {
DoAddIconAndLabel(image, text,
TrayPopupItemStyle::FontStyle::DEFAULT_VIEW_LABEL);
}
void HoverHighlightView::DoAddIconAndLabel(
const gfx::ImageSkia& image,
const base::string16& text,
TrayPopupItemStyle::FontStyle font_style) {
DoAddIconAndLabels(image, text, font_style, base::string16());
}
void HoverHighlightView::DoAddIconAndLabels(
const gfx::ImageSkia& image,
const base::string16& text,
TrayPopupItemStyle::FontStyle font_style,
const base::string16& sub_text) {
DCHECK(!is_populated_);
is_populated_ = true;
......@@ -144,10 +121,6 @@ void HoverHighlightView::DoAddIconAndLabels(
tri_view_->SetContainerBorder(
TriView::Container::CENTER,
views::CreateEmptyBorder(0, 0, 0, kTrayPopupLabelRightPadding));
if (!sub_text.empty())
SetSubText(sub_text);
tri_view_->SetContainerVisible(TriView::Container::END, false);
SetAccessibleName(text);
......
......@@ -49,18 +49,6 @@ class HoverHighlightView : public ActionableView {
// detailed views.
void AddIconAndLabel(const gfx::ImageSkia& image, const base::string16& text);
// Convenience function for populating the view with an icon, a main label,
// and a sub label. This also sets the accessible name based on the main
// label. Used for scrollable rows in detailed views.
void AddIconAndLabels(const gfx::ImageSkia& image,
const base::string16& text,
const base::string16& sub_text);
// A convenience function for populating the view with an icon and a label for
// a system menu default view row.
void AddIconAndLabelForDefaultView(const gfx::ImageSkia& image,
const base::string16& text);
// Populates the view with a text label, inset on the left by the horizontal
// space that would normally be occupied by an icon.
void AddLabelRow(const base::string16& text);
......@@ -116,14 +104,6 @@ class HoverHighlightView : public ActionableView {
const base::string16& text,
TrayPopupItemStyle::FontStyle font_style);
// Adds the image, main label and sub label to the row with the main label
// being styled using |font_style| and the sub label being styled using
// FontStyle::CAPTION and ColorStyle::INACTIVE.
void DoAddIconAndLabels(const gfx::ImageSkia& image,
const base::string16& text,
TrayPopupItemStyle::FontStyle font_style,
const base::string16& sub_text);
// ActionableView:
bool PerformAction(const ui::Event& event) override;
......
// Copyright (c) 2012 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/label_tray_view.h"
#include "ash/resources/vector_icons/vector_icons.h"
#include "ash/style/ash_color_provider.h"
#include "ash/system/tray/hover_highlight_view.h"
#include "ash/system/tray/view_click_listener.h"
#include "ui/gfx/font.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/views/controls/label.h"
#include "ui/views/layout/fill_layout.h"
namespace ash {
LabelTrayView::LabelTrayView(ViewClickListener* click_listener,
const gfx::VectorIcon& icon)
: click_listener_(click_listener), icon_(icon) {
SetLayoutManager(std::make_unique<views::FillLayout>());
SetVisible(false);
}
LabelTrayView::~LabelTrayView() = default;
void LabelTrayView::SetMessage(const base::string16& message) {
if (message_ == message)
return;
message_ = message;
RemoveAllChildViews(true);
if (!message_.empty()) {
AddChildView(CreateChildView(message_));
SetVisible(true);
} else {
SetVisible(false);
}
}
const char* LabelTrayView::GetClassName() const {
return "LabelTrayView";
}
views::View* LabelTrayView::CreateChildView(
const base::string16& message) const {
HoverHighlightView* child = new HoverHighlightView(click_listener_);
gfx::ImageSkia icon_image = gfx::CreateVectorIcon(
icon_, AshColorProvider::Get()->GetContentLayerColor(
AshColorProvider::ContentLayerType::kIconPrimary,
AshColorProvider::AshColorMode::kLight));
child->AddIconAndLabelForDefaultView(icon_image, message);
child->text_label()->SetMultiLine(true);
child->text_label()->SetAllowCharacterBreak(true);
child->SetExpandable(true);
child->SetVisible(true);
return child;
}
} // namespace ash
// Copyright (c) 2012 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_LABEL_TRAY_VIEW_H_
#define ASH_SYSTEM_TRAY_LABEL_TRAY_VIEW_H_
#include "base/macros.h"
#include "base/strings/string16.h"
#include "ui/views/view.h"
namespace gfx {
struct VectorIcon;
} // namespace gfx
namespace ash {
class ViewClickListener;
// A view to display an icon and message text in the system menu which
// automatically hides when the message text is empty. Multi-line message text
// is supported.
class LabelTrayView : public views::View {
public:
// If |click_listener| is null then no action is taken on click.
LabelTrayView(ViewClickListener* click_listener, const gfx::VectorIcon& icon);
~LabelTrayView() override;
const base::string16& message() { return message_; }
void SetMessage(const base::string16& message);
// views::View:
const char* GetClassName() const override;
private:
views::View* CreateChildView(const base::string16& message) const;
ViewClickListener* click_listener_;
const gfx::VectorIcon& icon_;
base::string16 message_;
DISALLOW_COPY_AND_ASSIGN(LabelTrayView);
};
} // namespace ash
#endif // ASH_SYSTEM_TRAY_LABEL_TRAY_VIEW_H_
......@@ -95,10 +95,6 @@ void TrayPopupItemStyle::SetupLabel(views::Label* label) const {
gfx::Font::NORMAL,
gfx::Font::Weight::MEDIUM));
break;
case FontStyle::DEFAULT_VIEW_LABEL:
label->SetFontList(base_font_list.Derive(1, gfx::Font::NORMAL,
gfx::Font::Weight::NORMAL));
break;
case FontStyle::SUB_HEADER:
label->SetFontList(base_font_list.Derive(use_unified_theme_ ? 4 : 1,
gfx::Font::NORMAL,
......
......@@ -36,8 +36,6 @@ class TrayPopupItemStyle {
enum class FontStyle {
// Topmost header rows for default view and detailed view.
TITLE,
// Main text used by default view rows.
DEFAULT_VIEW_LABEL,
// Text in sub-section header rows in detailed views.
SUB_HEADER,
// Main text used by detailed view rows.
......
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