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 "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_hover_state.h" | 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_hover_state.h" |
6 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" | 6 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" |
7 | 7 |
8 @interface BookmarkBarFolderHoverState(Private) | 8 @interface BookmarkBarFolderHoverState(Private) |
9 - (void)setHoverState:(HoverState)state; | 9 - (void)setHoverState:(HoverState)state; |
10 - (void)closeBookmarkFolderOnHoverButton:(BookmarkButton*)button; | 10 - (void)closeBookmarkFolderOnHoverButton:(BookmarkButton*)button; |
(...skipping 15 matching lines...) Expand all Loading... |
26 // CASE A: hoverButton_ == button implies we've dragged over | 26 // CASE A: hoverButton_ == button implies we've dragged over |
27 // the same folder so no need to open or close anything new. | 27 // the same folder so no need to open or close anything new. |
28 } else if (hoverButton_ && | 28 } else if (hoverButton_ && |
29 hoverButton_ != button) { | 29 hoverButton_ != button) { |
30 // CASE B: we have a hoverButton_ but it is different from the new button. | 30 // CASE B: we have a hoverButton_ but it is different from the new button. |
31 // This implies we've dragged over a new folder, so we'll close the old | 31 // This implies we've dragged over a new folder, so we'll close the old |
32 // and open the new. | 32 // and open the new. |
33 // Note that we only schedule the open or close if we have no other tasks | 33 // Note that we only schedule the open or close if we have no other tasks |
34 // currently pending. | 34 // currently pending. |
35 | 35 |
| 36 // Since the new bookmark folder is not opened until the previous is |
| 37 // closed, the NSDraggingDestination must provide continuous callbacks, |
| 38 // even if the cursor isn't moving. |
36 if (hoverState_ == kHoverStateOpen) { | 39 if (hoverState_ == kHoverStateOpen) { |
37 // Close the old. | 40 // Close the old. |
38 [self scheduleCloseBookmarkFolderOnHoverButton]; | 41 [self scheduleCloseBookmarkFolderOnHoverButton]; |
39 } else if (hoverState_ == kHoverStateClosed) { | 42 } else if (hoverState_ == kHoverStateClosed) { |
40 // Open the new. | 43 // Open the new. |
41 [self scheduleOpenBookmarkFolderOnHoverButton:button]; | 44 [self scheduleOpenBookmarkFolderOnHoverButton:button]; |
42 } | 45 } |
43 } else if (!hoverButton_) { | 46 } else if (!hoverButton_) { |
44 // CASE C: we don't have a current hoverButton_ but we have dragged onto | 47 // CASE C: we don't have a current hoverButton_ but we have dragged onto |
45 // a new folder so we open the new one. | 48 // a new folder so we open the new one. |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 // Called after a delay to open a new hover folder. | 167 // Called after a delay to open a new hover folder. |
165 // Note: this method is not meant to be invoked directly, only through | 168 // Note: this method is not meant to be invoked directly, only through |
166 // a delayed call to |scheduleOpenBookmarkFolderOnHoverButton:|. | 169 // a delayed call to |scheduleOpenBookmarkFolderOnHoverButton:|. |
167 - (void)openBookmarkFolderOnHoverButton:(BookmarkButton*)button { | 170 - (void)openBookmarkFolderOnHoverButton:(BookmarkButton*)button { |
168 [self setHoverState:kHoverStateOpen]; | 171 [self setHoverState:kHoverStateOpen]; |
169 [[button target] performSelector:@selector(openBookmarkFolderFromButton:) | 172 [[button target] performSelector:@selector(openBookmarkFolderFromButton:) |
170 withObject:button]; | 173 withObject:button]; |
171 } | 174 } |
172 | 175 |
173 @end | 176 @end |
OLD | NEW |