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

Side by Side Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm

Issue 6612025: [Mac] Apply CrTrackingArea to the two other places where we get |-mouseMoved:| zombie messages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add ScopedCrTrackingArea Created 9 years, 9 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #import "chrome/browser/themes/browser_theme_provider.h" 11 #import "chrome/browser/themes/browser_theme_provider.h"
12 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" 12 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h"
13 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" 13 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h"
14 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_button_cell.h" 14 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_button_cell.h"
15 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_hover_state.h" 15 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_hover_state.h"
16 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_view.h" 16 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_view.h"
17 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_window.h" 17 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_window.h"
18 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_folder_target.h" 18 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_folder_target.h"
19 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 19 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
20 #import "chrome/browser/ui/cocoa/event_utils.h" 20 #import "chrome/browser/ui/cocoa/event_utils.h"
21 #import "chrome/browser/ui/cocoa/tracking_area.h"
21 22
22 using bookmarks::kBookmarkBarMenuCornerRadius; 23 using bookmarks::kBookmarkBarMenuCornerRadius;
23 24
24 namespace { 25 namespace {
25 26
26 // Frequency of the scrolling timer in seconds. 27 // Frequency of the scrolling timer in seconds.
27 const NSTimeInterval kBookmarkBarFolderScrollInterval = 0.1; 28 const NSTimeInterval kBookmarkBarFolderScrollInterval = 0.1;
28 29
29 // Amount to scroll by per timer fire. We scroll rather slowly; to 30 // Amount to scroll by per timer fire. We scroll rather slowly; to
30 // accomodate we do several at a time. 31 // accomodate we do several at a time.
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 - (void)mouseExited:(NSEvent*)theEvent { 953 - (void)mouseExited:(NSEvent*)theEvent {
953 [self endScroll]; 954 [self endScroll];
954 } 955 }
955 956
956 // Add a tracking area so we know when the mouse is pinned to the top 957 // 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 958 // or bottom of the screen. If that happens, and if the mouse
958 // position overlaps the window, scroll it. 959 // position overlaps the window, scroll it.
959 - (void)addOrUpdateScrollTracking { 960 - (void)addOrUpdateScrollTracking {
960 [self removeScrollTracking]; 961 [self removeScrollTracking];
961 NSView* view = [[self window] contentView]; 962 NSView* view = [[self window] contentView];
962 scrollTrackingArea_.reset([[NSTrackingArea alloc] 963 scrollTrackingArea_.reset([[CrTrackingArea alloc]
963 initWithRect:[view bounds] 964 initWithRect:[view bounds]
964 options:(NSTrackingMouseMoved | 965 options:(NSTrackingMouseMoved |
965 NSTrackingMouseEnteredAndExited | 966 NSTrackingMouseEnteredAndExited |
966 NSTrackingActiveAlways) 967 NSTrackingActiveAlways)
967 owner:self 968 proxiedOwner:self
968 userInfo:nil]); 969 userInfo:nil]);
969 [view addTrackingArea:scrollTrackingArea_]; 970 [scrollTrackingArea_ clearOwnerWhenWindowWillClose:[self window]];
971 [view addTrackingArea:scrollTrackingArea_];
970 } 972 }
971 973
972 // Remove the tracking area associated with scrolling. 974 // Remove the tracking area associated with scrolling.
973 - (void)removeScrollTracking { 975 - (void)removeScrollTracking {
974 if (scrollTrackingArea_.get()) { 976 if (scrollTrackingArea_.get()) {
975 [[[self window] contentView] removeTrackingArea:scrollTrackingArea_]; 977 [[[self window] contentView] removeTrackingArea:scrollTrackingArea_];
976 } 978 }
977 scrollTrackingArea_.reset(); 979 scrollTrackingArea_.reset();
978 } 980 }
979 981
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
1685 1687
1686 - (void)setIgnoreAnimations:(BOOL)ignore { 1688 - (void)setIgnoreAnimations:(BOOL)ignore {
1687 ignoreAnimations_ = ignore; 1689 ignoreAnimations_ = ignore;
1688 } 1690 }
1689 1691
1690 - (BookmarkButton*)buttonThatMouseIsIn { 1692 - (BookmarkButton*)buttonThatMouseIsIn {
1691 return buttonThatMouseIsIn_; 1693 return buttonThatMouseIsIn_;
1692 } 1694 }
1693 1695
1694 @end // BookmarkBarFolderController 1696 @end // BookmarkBarFolderController
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698