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

Unified Diff: ash/common/system/tray/hover_highlight_view.h

Issue 2696033003: [Ash MD] Remove some non-MD code from HoverHighlightView (Closed)
Patch Set: Created 3 years, 10 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
Index: ash/common/system/tray/hover_highlight_view.h
diff --git a/ash/common/system/tray/hover_highlight_view.h b/ash/common/system/tray/hover_highlight_view.h
index f686914d67af96c781d12a715558f80efdb5b4ac..a0c57834a0cb3aa93b2bef12b3ec7519393ddabd 100644
--- a/ash/common/system/tray/hover_highlight_view.h
+++ b/ash/common/system/tray/hover_highlight_view.h
@@ -38,15 +38,16 @@ class HoverHighlightView : public ActionableView {
explicit HoverHighlightView(ViewClickListener* listener);
~HoverHighlightView() override;
- // views::View
+ // views::View:
bool GetTooltipText(const gfx::Point& p,
base::string16* tooltip) const override;
+ // TODO(tdanderson): Perform further cleanup on the Add*() methods in this
+ // class. See crbug.com/686345.
+
// Convenience function for adding an icon and a label. This also sets the
// accessible name. Primarily used for scrollable rows in detailed views.
- void AddIconAndLabel(const gfx::ImageSkia& image,
- const base::string16& text,
- bool highlight);
+ void AddIconAndLabel(const gfx::ImageSkia& image, const base::string16& text);
// Convenience function for adding an icon, a main label, and a sub label.
// This also sets the accessible name besed on the main label. Used for
@@ -55,25 +56,10 @@ class HoverHighlightView : public ActionableView {
const base::string16& text,
const base::string16& sub_text);
- // Convenience function for adding an icon and a label. This also sets the
- // accessible name. This method allows the indent and spacing between elements
- // to be set by the caller. |icon_size| is the size of the icon. |indent| is
- // the distance between the edges of the view and the icons, and
- // |space_between_items| is the minimum distance between any two child views.
- // All distances are in DP. Primarily used for scrollable rows in detailed
- // views.
- void AddIconAndLabelCustomSize(const gfx::ImageSkia& image,
- const base::string16& text,
- bool highlight,
- int icon_size,
- int indent,
- int space_between_items);
-
// A convenience function for adding an icon and label for a system menu
// default view row.
void AddIconAndLabelForDefaultView(const gfx::ImageSkia& image,
- const base::string16& text,
- bool highlight);
+ const base::string16& text);
// Convenience function for adding a label with padding on the left for a
// blank icon. This also sets the accessible name. Returns label after
@@ -82,16 +68,9 @@ class HoverHighlightView : public ActionableView {
gfx::HorizontalAlignment alignment,
bool highlight);
- // Convenience function for adding an optional check and a label. In the
- // absence of a check, padding is added to align with checked items.
- // Returns label after parenting it.
- views::Label* AddCheckableLabel(const base::string16& text,
- bool highlight,
- bool checked);
-
// Adds a row containing only a text label, inset on the left by the
// horizontal space that would normally be occupied by an icon.
- void AddLabelRowMd(const base::string16& text);
+ void AddLabelRow(const base::string16& text);
// Add an optional right icon to an already established view (call one of
// the other Add* functions first). |icon_size| is the size of the icon in DP.
@@ -108,10 +87,6 @@ class HoverHighlightView : public ActionableView {
// Size of unexapandable view is fixed and equals to kTrayPopupItemHeight.
void SetExpandable(bool expandable);
- // Enables or disable highlighting on the label, where a highlighted label
- // just uses a bold font.
- void SetHighlight(bool hightlight);
-
// Set a custom height for the view. A value of 0 means that no custom height
// is set.
void set_custom_height(int custom_height) { custom_height_ = custom_height; }
@@ -120,11 +95,6 @@ class HoverHighlightView : public ActionableView {
// accessibility event if needed.
void SetAccessiblityState(AccessibilityState accessibility_state);
- void set_highlight_color(SkColor color) { highlight_color_ = color; }
- void set_default_color(SkColor color) { default_color_ = color; }
- void set_text_highlight_color(SkColor c) { text_highlight_color_ = c; }
- void set_text_default_color(SkColor color) { text_default_color_ = color; }
-
views::Label* text_label() { return text_label_; }
views::Label* sub_text_label() { return sub_text_label_; }
@@ -133,28 +103,12 @@ class HoverHighlightView : public ActionableView {
void set_tooltip(const base::string16& tooltip) { tooltip_ = tooltip; }
protected:
- // Overridden from views::View.
+ // views::View:
void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
- // Sets the highlighted color on a text label if |hover| is set.
- void SetHoverHighlight(bool hover);
-
TriView* tri_view() { return tri_view_; }
private:
- // Actually adds the icon and label but does not set the layout manager.
- // Not used in material design.
- void DoAddIconAndLabel(const gfx::ImageSkia& image,
- int icon_size,
- const base::string16& text,
- bool highlight);
-
- // Adds the image and label to the row with the label being styled using
- // |font_style|. Only used in material design.
- void DoAddIconAndLabelMd(const gfx::ImageSkia& image,
- 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. Only used in material design.
@@ -163,18 +117,13 @@ class HoverHighlightView : public ActionableView {
TrayPopupItemStyle::FontStyle font_style,
const base::string16& sub_text);
- // Overridden from ActionableView:
+ // ActionableView:
bool PerformAction(const ui::Event& event) override;
- // Overridden from views::View.
+ // views::View:
gfx::Size GetPreferredSize() const override;
int GetHeightForWidth(int width) const override;
- void OnMouseEntered(const ui::MouseEvent& event) override;
- void OnMouseExited(const ui::MouseEvent& event) override;
- void OnGestureEvent(ui::GestureEvent* event) override;
- void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
void OnEnabledChanged() override;
- void OnPaintBackground(gfx::Canvas* canvas) override;
void OnFocus() override;
ViewClickListener* listener_ = nullptr;
@@ -183,11 +132,7 @@ class HoverHighlightView : public ActionableView {
views::BoxLayout* box_layout_ = nullptr; // Not used in material design.
views::ImageView* left_icon_ = nullptr;
views::View* right_view_ = nullptr;
- TriView* tri_view_ = nullptr; // Only used in material design.
- SkColor highlight_color_ = 0; // Not used in material design.
- SkColor default_color_ = 0;
- SkColor text_highlight_color_ = 0; // Not used in material design.
- SkColor text_default_color_ = 0; // Not used in material design.
+ TriView* tri_view_ = nullptr;
bool hover_ = false; // Not used in material design.
bool expandable_ = false;
int custom_height_ = 0; // Not used in material design.

Powered by Google App Engine
This is Rietveld 408576698