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

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

Issue 2865533002: Reset HoverHighlightView state before re-populating (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « ash/system/network/vpn_list_view.cc ('k') | ash/system/tray/hover_highlight_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/system/tray/hover_highlight_view.h
diff --git a/ash/system/tray/hover_highlight_view.h b/ash/system/tray/hover_highlight_view.h
index 6c60bfcdf408bf809b63330b1aa05e9b42b4e39e..a5831acf89b4fdc2c8091c4a0c16a2abc57a6ff9 100644
--- a/ash/system/tray/hover_highlight_view.h
+++ b/ash/system/tray/hover_highlight_view.h
@@ -38,39 +38,40 @@ class HoverHighlightView : public ActionableView {
explicit HoverHighlightView(ViewClickListener* listener);
~HoverHighlightView() override;
- // Convenience function for adding an icon and a label. This also sets the
- // accessible name. Primarily used for scrollable rows in detailed views.
+ // Convenience function for populating the view with 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);
- // 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.
+ // 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 adding an icon and label for a system menu
- // default view row.
+ // 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);
- // Adds a row containing only a text label, inset on the left by the
- // horizontal space that would normally be occupied by an icon.
+ // 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);
- // 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.
+ // Adds an optional right icon to an already populated view. |icon_size| is
+ // the size of the icon in DP.
void AddRightIcon(const gfx::ImageSkia& image, int icon_size);
- // Add an optional right view to an already established view (call one of
- // the other Add* functions first).
+ // Adds an optional right view to an already populated view.
void AddRightView(views::View* view);
- // Hide or show the right view.
+ // Hides or shows the right view for an already populated view.
void SetRightViewVisible(bool visible);
- // Sets the text of |sub_text_label_| to |sub_text|. Prior to calling this
- // function, |text_label_| must not be null and |sub_text| must not be empty.
+ // Sets the text of the sub label for an already populated view. |sub_text|
+ // must not be empty and prior to calling this function, |text_label_| must
+ // not be null.
void SetSubText(const base::string16& sub_text);
// Allows view to expand its height. Size of unexapandable view is fixed and
@@ -81,6 +82,9 @@ class HoverHighlightView : public ActionableView {
// accessibility event if needed.
void SetAccessiblityState(AccessibilityState accessibility_state);
+ // Removes current children of the view so that it can be re-populated.
+ void Reset();
+
views::Label* text_label() { return text_label_; }
views::Label* sub_text_label() { return sub_text_label_; }
@@ -114,7 +118,11 @@ class HoverHighlightView : public ActionableView {
void OnEnabledChanged() override;
void OnFocus() override;
- ViewClickListener* listener_ = nullptr;
+ // Determines whether the view is populated or not. If it is, Reset() should
+ // be called before re-populating the view.
+ bool is_populated_ = false;
+
+ ViewClickListener* const listener_ = nullptr;
views::Label* text_label_ = nullptr;
views::Label* sub_text_label_ = nullptr;
views::ImageView* left_icon_ = nullptr;
« no previous file with comments | « ash/system/network/vpn_list_view.cc ('k') | ash/system/tray/hover_highlight_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698