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

Unified Diff: chrome/browser/ui/cocoa/location_bar/location_bar_decoration.h

Issue 2511043002: [Mac] Omnibox icons active states (Closed)
Patch Set: Fixed Bookmark test Created 4 years, 1 month 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: chrome/browser/ui/cocoa/location_bar/location_bar_decoration.h
diff --git a/chrome/browser/ui/cocoa/location_bar/location_bar_decoration.h b/chrome/browser/ui/cocoa/location_bar/location_bar_decoration.h
index 11de3a008fb484d72b9f3dc43ce5b33d1ec73fb7..ddc8d8d66aa82989e3ade21234ca3b2e843d707c 100644
--- a/chrome/browser/ui/cocoa/location_bar/location_bar_decoration.h
+++ b/chrome/browser/ui/cocoa/location_bar/location_bar_decoration.h
@@ -25,7 +25,9 @@
// Decorations are more like Cocoa cells, except implemented in C++ to
// allow more similarity to the other platform implementations.
-enum class LocationBarDecorationState { NORMAL, HOVER, PRESSED };
+// This enum class represents the state of the decoration's interactions
+// with the mouse.
+enum class DecorationMouseState { NONE, HOVER, PRESSED };
class LocationBarDecoration {
public:
@@ -102,6 +104,10 @@ class LocationBarDecoration {
void OnMouseEntered();
void OnMouseExited();
+ // Sets the active state of the decoration. If the state has changed, call
+ // UpdateDecorationState().
+ void SetActive(bool active);
+
// Called to get the right-click menu, return |nil| for no menu.
virtual NSMenu* GetMenu();
@@ -134,7 +140,9 @@ class LocationBarDecoration {
// to the private DecorationAccessibilityView helper class.
void OnAccessibilityViewAction();
- LocationBarDecorationState state() { return state_; }
+ DecorationMouseState state() const { return state_; }
+
+ bool active() const { return active_; }
// Width returned by |GetWidthForSpace()| when the item should be
// omitted for this width;
@@ -162,6 +170,10 @@ class LocationBarDecoration {
void UpdateDecorationState();
bool visible_ = false;
+
+ // True if the decoration is active.
+ bool active_ = false;
+
base::scoped_nsobject<NSView> accessibility_view_;
// The decoration's tracking area. Only set if the decoration accepts a mouse
@@ -176,7 +188,7 @@ class LocationBarDecoration {
base::scoped_nsobject<DecorationMouseTrackingDelegate> tracking_delegate_;
// The state of the decoration.
- LocationBarDecorationState state_;
+ DecorationMouseState state_;
Robert Sesek 2016/11/28 22:46:59 Can you do initialization here, too?
spqchan 2016/11/29 17:34:49 Done.
DISALLOW_COPY_AND_ASSIGN(LocationBarDecoration);
};

Powered by Google App Engine
This is Rietveld 408576698