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

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

Issue 2795143005: [Ash] Remove pre-MD code paths from HoverHighlightView (Closed)
Patch Set: estade comments Created 3 years, 8 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 fabfdf3beef2bd11a4673c6d176c71cd84c4223a..b145d9560634956719412eff29f08a78e4fa5a27 100644
--- a/ash/common/system/tray/hover_highlight_view.h
+++ b/ash/common/system/tray/hover_highlight_view.h
@@ -38,53 +38,38 @@ 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;
// 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
- // scrollable rows in detailed views in material design.
+ // scrollable rows in detailed views.
void AddIconAndLabels(const gfx::ImageSkia& image,
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
// parenting it.
- views::Label* AddLabel(const base::string16& text,
- gfx::HorizontalAlignment alignment,
- bool highlight);
+ // TODO(tdanderson): Remove this function and use AddLabelRow() instead.
+ // See crbug.com/708190.
+ views::Label* AddLabelDeprecated(const base::string16& text,
+ gfx::HorizontalAlignment alignment,
+ bool highlight);
// 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.
@@ -97,14 +82,10 @@ class HoverHighlightView : public ActionableView {
// Hide or show the right view.
void SetRightViewVisible(bool visible);
- // Allows view to expand its height.
- // Size of unexapandable view is fixed and equals to kTrayPopupItemHeight.
+ // Allows view to expand its height. 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; }
@@ -113,75 +94,51 @@ 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_; }
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.
+ // Adds the image and label to the row with the label being styled using
+ // |font_style|.
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);
+ 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.
- void DoAddIconAndLabelsMd(const gfx::ImageSkia& image,
- const base::string16& text,
- TrayPopupItemStyle::FontStyle font_style,
- const base::string16& sub_text);
+ // FontStyle::CAPTION and ColorStyle::INACTIVE.
+ void DoAddIconAndLabels(const gfx::ImageSkia& image,
+ const base::string16& text,
+ 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;
views::Label* text_label_ = nullptr;
views::Label* sub_text_label_ = nullptr;
- views::BoxLayout* box_layout_ = nullptr; // Not used in material design.
+ views::BoxLayout* box_layout_ = nullptr;
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.
- bool hover_ = false; // Not used in material design.
+ TriView* tri_view_ = nullptr;
+ SkColor text_default_color_ = 0;
bool expandable_ = false;
- int custom_height_ = 0; // Not used in material design.
+ int custom_height_ = 0;
AccessibilityState accessibility_state_ = AccessibilityState::DEFAULT;
base::string16 tooltip_;

Powered by Google App Engine
This is Rietveld 408576698