| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 | 6 |
| 7 #include "base/memory/scoped_nsobject.h" | 7 #include "base/mac/scoped_nsobject.h" |
| 8 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" | 8 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" |
| 9 | 9 |
| 10 // Hover state machine. Encapsulates the hover state for | 10 // Hover state machine. Encapsulates the hover state for |
| 11 // BookmarkBarFolderController. | 11 // BookmarkBarFolderController. |
| 12 // A strict call order is implied with these calls. It is ONLY valid to make | 12 // A strict call order is implied with these calls. It is ONLY valid to make |
| 13 // the following state transitions: | 13 // the following state transitions: |
| 14 // From: To: Via: | 14 // From: To: Via: |
| 15 // closed opening scheduleOpen...: | 15 // closed opening scheduleOpen...: |
| 16 // opening closed cancelPendingOpen...: or | 16 // opening closed cancelPendingOpen...: or |
| 17 // open scheduleOpen...: completes. | 17 // open scheduleOpen...: completes. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 32 enum HoverState { | 32 enum HoverState { |
| 33 kHoverStateClosed = 0, | 33 kHoverStateClosed = 0, |
| 34 kHoverStateOpening = 1, | 34 kHoverStateOpening = 1, |
| 35 kHoverStateOpen = 2, | 35 kHoverStateOpen = 2, |
| 36 kHoverStateClosing = 3 | 36 kHoverStateClosing = 3 |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 // Like normal menus, hovering over a folder button causes it to | 39 // Like normal menus, hovering over a folder button causes it to |
| 40 // open. This variable is set when a hover is initiated (but has | 40 // open. This variable is set when a hover is initiated (but has |
| 41 // not necessarily fired yet). | 41 // not necessarily fired yet). |
| 42 scoped_nsobject<BookmarkButton> hoverButton_; | 42 base::scoped_nsobject<BookmarkButton> hoverButton_; |
| 43 | 43 |
| 44 // We model hover state as a state machine with specific allowable | 44 // We model hover state as a state machine with specific allowable |
| 45 // transitions. |hoverState_| is the state of this machine at any | 45 // transitions. |hoverState_| is the state of this machine at any |
| 46 // given time. | 46 // given time. |
| 47 HoverState hoverState_; | 47 HoverState hoverState_; |
| 48 } | 48 } |
| 49 | 49 |
| 50 // Designated initializer. | 50 // Designated initializer. |
| 51 - (id)init; | 51 - (id)init; |
| 52 | 52 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 69 - (void)scheduleOpenBookmarkFolderOnHoverButton:(BookmarkButton*)hoverButton; | 69 - (void)scheduleOpenBookmarkFolderOnHoverButton:(BookmarkButton*)hoverButton; |
| 70 - (void)cancelPendingOpenBookmarkFolderOnHoverButton; | 70 - (void)cancelPendingOpenBookmarkFolderOnHoverButton; |
| 71 @end | 71 @end |
| 72 | 72 |
| 73 // Exposing these for unit testing purposes. They are used only in tests. | 73 // Exposing these for unit testing purposes. They are used only in tests. |
| 74 @interface BookmarkBarFolderHoverState(TestingAPI) | 74 @interface BookmarkBarFolderHoverState(TestingAPI) |
| 75 // Accessors and setters for button and hover state. | 75 // Accessors and setters for button and hover state. |
| 76 - (BookmarkButton*)hoverButton; | 76 - (BookmarkButton*)hoverButton; |
| 77 - (HoverState)hoverState; | 77 - (HoverState)hoverState; |
| 78 @end | 78 @end |
| OLD | NEW |