| 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_controller.h" | 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.h" |
| 6 | 6 |
| 7 #include "base/mac/mac_util.h" | 7 #include "base/mac/mac_util.h" |
| 8 #include "base/sys_string_conversions.h" | 8 #include "base/sys_string_conversions.h" |
| 9 #include "chrome/browser/bookmarks/bookmark_model.h" | 9 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 10 #include "chrome/browser/bookmarks/bookmark_utils.h" | 10 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| (...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 952 - (void)mouseExited:(NSEvent*)theEvent { | 952 - (void)mouseExited:(NSEvent*)theEvent { |
| 953 [self endScroll]; | 953 [self endScroll]; |
| 954 } | 954 } |
| 955 | 955 |
| 956 // Add a tracking area so we know when the mouse is pinned to the top | 956 // Add a tracking area so we know when the mouse is pinned to the top |
| 957 // or bottom of the screen. If that happens, and if the mouse | 957 // or bottom of the screen. If that happens, and if the mouse |
| 958 // position overlaps the window, scroll it. | 958 // position overlaps the window, scroll it. |
| 959 - (void)addOrUpdateScrollTracking { | 959 - (void)addOrUpdateScrollTracking { |
| 960 [self removeScrollTracking]; | 960 [self removeScrollTracking]; |
| 961 NSView* view = [[self window] contentView]; | 961 NSView* view = [[self window] contentView]; |
| 962 scrollTrackingArea_.reset([[NSTrackingArea alloc] | 962 scrollTrackingArea_.reset([[CrTrackingArea alloc] |
| 963 initWithRect:[view bounds] | 963 initWithRect:[view bounds] |
| 964 options:(NSTrackingMouseMoved | | 964 options:(NSTrackingMouseMoved | |
| 965 NSTrackingMouseEnteredAndExited | | 965 NSTrackingMouseEnteredAndExited | |
| 966 NSTrackingActiveAlways) | 966 NSTrackingActiveAlways) |
| 967 owner:self | 967 proxiedOwner:self |
| 968 userInfo:nil]); | 968 userInfo:nil]); |
| 969 [view addTrackingArea:scrollTrackingArea_]; | 969 [view addTrackingArea:scrollTrackingArea_.get()]; |
| 970 } | 970 } |
| 971 | 971 |
| 972 // Remove the tracking area associated with scrolling. | 972 // Remove the tracking area associated with scrolling. |
| 973 - (void)removeScrollTracking { | 973 - (void)removeScrollTracking { |
| 974 if (scrollTrackingArea_.get()) { | 974 if (scrollTrackingArea_.get()) { |
| 975 [[[self window] contentView] removeTrackingArea:scrollTrackingArea_]; | 975 [[[self window] contentView] removeTrackingArea:scrollTrackingArea_.get()]; |
| 976 } | 976 } |
| 977 scrollTrackingArea_.reset(); | 977 scrollTrackingArea_.reset(); |
| 978 } | 978 } |
| 979 | 979 |
| 980 // Close the old hover-open bookmark folder, and open a new one. We | 980 // Close the old hover-open bookmark folder, and open a new one. We |
| 981 // do both in one step to allow for a delay in closing the old one. | 981 // do both in one step to allow for a delay in closing the old one. |
| 982 // See comments above kDragHoverCloseDelay (bookmark_bar_controller.h) | 982 // See comments above kDragHoverCloseDelay (bookmark_bar_controller.h) |
| 983 // for more details. | 983 // for more details. |
| 984 - (void)openBookmarkFolderFromButtonAndCloseOldOne:(id)sender { | 984 - (void)openBookmarkFolderFromButtonAndCloseOldOne:(id)sender { |
| 985 // If an old submenu exists, close it immediately. | 985 // If an old submenu exists, close it immediately. |
| (...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1685 | 1685 |
| 1686 - (void)setIgnoreAnimations:(BOOL)ignore { | 1686 - (void)setIgnoreAnimations:(BOOL)ignore { |
| 1687 ignoreAnimations_ = ignore; | 1687 ignoreAnimations_ = ignore; |
| 1688 } | 1688 } |
| 1689 | 1689 |
| 1690 - (BookmarkButton*)buttonThatMouseIsIn { | 1690 - (BookmarkButton*)buttonThatMouseIsIn { |
| 1691 return buttonThatMouseIsIn_; | 1691 return buttonThatMouseIsIn_; |
| 1692 } | 1692 } |
| 1693 | 1693 |
| 1694 @end // BookmarkBarFolderController | 1694 @end // BookmarkBarFolderController |
| OLD | NEW |