summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/bookmark_bar_folder_controller.h
diff options
context:
space:
mode:
authordhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-16 16:55:14 +0000
committerdhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-16 16:55:14 +0000
commita251d2d754765fd0536316d01c969ef881ad6a28 (patch)
tree518964522989965e2592219168bff2bff46664fc /chrome/browser/cocoa/bookmark_bar_folder_controller.h
parent34f86e843f76daba2623c5a855f19f19d0850c8b (diff)
downloadchromium_src-a251d2d754765fd0536316d01c969ef881ad6a28.zip
chromium_src-a251d2d754765fd0536316d01c969ef881ad6a28.tar.gz
chromium_src-a251d2d754765fd0536316d01c969ef881ad6a28.tar.bz2
Mac Bookmarks bar crash hovering from one folder to another.
Fix for race condition where the BookmarkBarFolderController was trying to simultaneously open and close its hover view. This code serializes the opening and closing. BUG=40006 TEST=BookmarkBarFolderControllerTest.HoverState Review URL: http://codereview.chromium.org/1593031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44783 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/bookmark_bar_folder_controller.h')
-rw-r--r--chrome/browser/cocoa/bookmark_bar_folder_controller.h34
1 files changed, 29 insertions, 5 deletions
diff --git a/chrome/browser/cocoa/bookmark_bar_folder_controller.h b/chrome/browser/cocoa/bookmark_bar_folder_controller.h
index 24d81f5..b8e9ce7 100644
--- a/chrome/browser/cocoa/bookmark_bar_folder_controller.h
+++ b/chrome/browser/cocoa/bookmark_bar_folder_controller.h
@@ -17,6 +17,21 @@
NSWindowController<BookmarkButtonDelegate,
BookmarkButtonControllerProtocol> {
@private
+ // Enumeration of the valid states that the |hoverButton_| member can be in.
+ // Because the opening and closing of hover views can be done asyncronously
+ // there are periods where the hover state is in transtion between open and
+ // closed. During those times of transition the opening or closing operation
+ // can be cancelled. We serialize the opening and closing of the
+ // |hoverButton_| using this state information. This serialization is to
+ // avoid race conditions where one hover button is being opened while another
+ // is closing.
+ enum HoverState {
+ kHoverStateClosed = 0,
+ kHoverStateOpening = 1,
+ kHoverStateOpen = 2,
+ kHoverStateClosing = 3
+ };
+
// The button whose click opened us.
scoped_nsobject<BookmarkButton> parentButton_;
@@ -81,6 +96,11 @@
// not necessarily fired yet).
scoped_nsobject<BookmarkButton> hoverButton_;
+ // We model hover state as a state machine with specific allowable
+ // transitions. |hoverState_| is the state of this machine at any
+ // given time.
+ HoverState hoverState_;
+
// Logic for dealing with a click on a bookmark folder button.
scoped_nsobject<BookmarkFolderTarget> folderTarget_;
@@ -90,11 +110,6 @@
// window closes the controller gets autoreleased).
BookmarkBarFolderController* folderController_;
- // Has a draggingExited been called? Only relevant for
- // performSelector:after:delay: calls that get triggered in the
- // middle of a drag.
- BOOL draggingExited_;
-
// Implement basic menu scrolling through this tracking area.
scoped_nsobject<NSTrackingArea> scrollTrackingArea_;
@@ -141,5 +156,14 @@
- (id)folderTarget;
- (void)configureWindowLevel;
- (void)performOneScroll:(CGFloat)delta;
+
+// Internal interface for hover button management.
+- (void)scheduleCloseBookmarkFolderOnHoverButton;
+- (void)cancelPendingCloseBookmarkFolderOnHoverButton;
+- (void)scheduleOpenBookmarkFolderOnHoverButton;
+- (void)cancelPendingOpenBookmarkFolderOnHoverButton;
+- (BookmarkButton*)hoverButton;
+- (void)setHoverButton:(BookmarkButton*)button;
+- (HoverState)hoverState;
@end