OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bundle_locations.h" | 7 #include "base/mac/bundle_locations.h" |
8 #include "base/mac/mac_util.h" | 8 #include "base/mac/mac_util.h" |
9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
10 #import "chrome/browser/bookmarks/bookmark_model_factory.h" | 10 #import "chrome/browser/bookmarks/bookmark_model_factory.h" |
(...skipping 1316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1327 [self setSelectedButtonByIndex:[self indexOfButton:sender]]; | 1327 [self setSelectedButtonByIndex:[self indexOfButton:sender]]; |
1328 | 1328 |
1329 // Cancel a previous hover if needed. | 1329 // Cancel a previous hover if needed. |
1330 [NSObject cancelPreviousPerformRequestsWithTarget:self]; | 1330 [NSObject cancelPreviousPerformRequestsWithTarget:self]; |
1331 | 1331 |
1332 // If already opened, then we exited but re-entered the button | 1332 // If already opened, then we exited but re-entered the button |
1333 // (without entering another button open), do nothing. | 1333 // (without entering another button open), do nothing. |
1334 if ([folderController_ parentButton] == sender) | 1334 if ([folderController_ parentButton] == sender) |
1335 return; | 1335 return; |
1336 | 1336 |
1337 [self performSelector:@selector(openBookmarkFolderFromButtonAndCloseOldOne:) | 1337 // If right click was done immediately on entering a button, then open the |
1338 withObject:sender | 1338 // folder without delay so that context menu appears over the folder menu. |
1339 afterDelay:bookmarks::kHoverOpenDelay | 1339 if ([event type] == NSRightMouseDown) |
1340 inModes:[NSArray arrayWithObject:NSRunLoopCommonModes]]; | 1340 [self openBookmarkFolderFromButtonAndCloseOldOne:sender]; |
| 1341 else |
| 1342 [self performSelector:@selector(openBookmarkFolderFromButtonAndCloseOldOne:) |
| 1343 withObject:sender |
| 1344 afterDelay:bookmarks::kHoverOpenDelay |
| 1345 inModes:[NSArray arrayWithObject:NSRunLoopCommonModes]]; |
1341 } | 1346 } |
1342 | 1347 |
1343 // Called from the BookmarkButton | 1348 // Called from the BookmarkButton |
1344 - (void)mouseExitedButton:(id)sender event:(NSEvent*)event { | 1349 - (void)mouseExitedButton:(id)sender event:(NSEvent*)event { |
1345 if (buttonThatMouseIsIn_ == sender) | 1350 if (buttonThatMouseIsIn_ == sender) |
1346 buttonThatMouseIsIn_ = nil; | 1351 buttonThatMouseIsIn_ = nil; |
1347 [self setSelectedButtonByIndex:-1]; | 1352 [self setSelectedButtonByIndex:-1]; |
1348 | 1353 |
1349 // Stop any timer about opening a new hover-open folder. | 1354 // Stop any timer about opening a new hover-open folder. |
1350 | 1355 |
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1998 | 2003 |
1999 - (void)setIgnoreAnimations:(BOOL)ignore { | 2004 - (void)setIgnoreAnimations:(BOOL)ignore { |
2000 ignoreAnimations_ = ignore; | 2005 ignoreAnimations_ = ignore; |
2001 } | 2006 } |
2002 | 2007 |
2003 - (BookmarkButton*)buttonThatMouseIsIn { | 2008 - (BookmarkButton*)buttonThatMouseIsIn { |
2004 return buttonThatMouseIsIn_; | 2009 return buttonThatMouseIsIn_; |
2005 } | 2010 } |
2006 | 2011 |
2007 @end // BookmarkBarFolderController | 2012 @end // BookmarkBarFolderController |
OLD | NEW |