OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/cocoa/bookmark_bar_controller.h" | 5 #import "chrome/browser/cocoa/bookmark_bar_controller.h" |
6 #include "app/l10n_util_mac.h" | 6 #include "app/l10n_util_mac.h" |
7 #include "app/resource_bundle.h" | 7 #include "app/resource_bundle.h" |
8 #include "base/mac_util.h" | 8 #include "base/mac_util.h" |
9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
10 #include "chrome/browser/bookmarks/bookmark_editor.h" | 10 #include "chrome/browser/bookmarks/bookmark_editor.h" |
(...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 } else { | 867 } else { |
868 // Oops! An animation we don't know how to handle. | 868 // Oops! An animation we don't know how to handle. |
869 return NO; | 869 return NO; |
870 } | 870 } |
871 | 871 |
872 return YES; | 872 return YES; |
873 } | 873 } |
874 | 874 |
875 // Enable or disable items. We are the menu delegate for both the bar | 875 // Enable or disable items. We are the menu delegate for both the bar |
876 // and for bookmark folder buttons. | 876 // and for bookmark folder buttons. |
877 - (BOOL)validateUserInterfaceItem:(id)item { | 877 - (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)anItem { |
| 878 // NSUserInterfaceValidations says that the passed-in object has type |
| 879 // |id<NSValidatedUserInterfaceItem>|, but this function needs to call the |
| 880 // NSObject method -isKindOfClass: on the parameter. In theory, this is not |
| 881 // correct, but this is probably a bug in the method signature. |
| 882 NSMenuItem* item = static_cast<NSMenuItem*>(anItem); |
878 // Yes for everything we don't explicitly deny. | 883 // Yes for everything we don't explicitly deny. |
879 if (![item isKindOfClass:[NSMenuItem class]]) | 884 if (![item isKindOfClass:[NSMenuItem class]]) |
880 return YES; | 885 return YES; |
881 | 886 |
882 // Yes if we're not a special BookmarkMenu. | 887 // Yes if we're not a special BookmarkMenu. |
883 if (![[item menu] isKindOfClass:[BookmarkMenu class]]) | 888 if (![[item menu] isKindOfClass:[BookmarkMenu class]]) |
884 return YES; | 889 return YES; |
885 | 890 |
886 // No if we think it's a special BookmarkMenu but have trouble. | 891 // No if we think it's a special BookmarkMenu but have trouble. |
887 const BookmarkNode* node = [self nodeFromMenuItem:item]; | 892 const BookmarkNode* node = [self nodeFromMenuItem:item]; |
(...skipping 1590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2478 // to minimize touching the object passed in (likely a mock). | 2483 // to minimize touching the object passed in (likely a mock). |
2479 - (void)setButtonContextMenu:(id)menu { | 2484 - (void)setButtonContextMenu:(id)menu { |
2480 buttonContextMenu_ = menu; | 2485 buttonContextMenu_ = menu; |
2481 } | 2486 } |
2482 | 2487 |
2483 - (void)setIgnoreAnimations:(BOOL)ignore { | 2488 - (void)setIgnoreAnimations:(BOOL)ignore { |
2484 ignoreAnimations_ = ignore; | 2489 ignoreAnimations_ = ignore; |
2485 } | 2490 } |
2486 | 2491 |
2487 @end | 2492 @end |
OLD | NEW |