| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #include "app/l10n_util_mac.h" | 5 #include "app/l10n_util_mac.h" |
| 6 #include "app/resource_bundle.h" | 6 #include "app/resource_bundle.h" |
| 7 #include "base/mac_util.h" | 7 #include "base/mac_util.h" |
| 8 #include "base/sys_string_conversions.h" | 8 #include "base/sys_string_conversions.h" |
| 9 #include "chrome/browser/bookmarks/bookmark_editor.h" | 9 #include "chrome/browser/bookmarks/bookmark_editor.h" |
| 10 #include "chrome/browser/bookmarks/bookmark_model.h" | 10 #include "chrome/browser/bookmarks/bookmark_model.h" |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 } | 296 } |
| 297 | 297 |
| 298 - (BookmarkNode*)nodeFromButton:(id)button { | 298 - (BookmarkNode*)nodeFromButton:(id)button { |
| 299 NSCell* cell = [button cell]; | 299 NSCell* cell = [button cell]; |
| 300 BookmarkNode* node = static_cast<BookmarkNode*>( | 300 BookmarkNode* node = static_cast<BookmarkNode*>( |
| 301 [[cell representedObject] pointerValue]); | 301 [[cell representedObject] pointerValue]); |
| 302 DCHECK(node); | 302 DCHECK(node); |
| 303 return node; | 303 return node; |
| 304 } | 304 } |
| 305 | 305 |
| 306 // At this time, the only item which ever gets disabled is "Open All |
| 307 // Bookmarks". |
| 308 - (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item { |
| 309 SEL action = [item action]; |
| 310 if ((action == @selector(openAllBookmarks:)) && |
| 311 (![buttons_ count])) { |
| 312 return NO; |
| 313 } |
| 314 return YES; |
| 315 } |
| 316 |
| 306 - (IBAction)openBookmark:(id)sender { | 317 - (IBAction)openBookmark:(id)sender { |
| 307 BookmarkNode* node = [self nodeFromButton:sender]; | 318 BookmarkNode* node = [self nodeFromButton:sender]; |
| 308 [urlDelegate_ openBookmarkURL:node->GetURL() | 319 [urlDelegate_ openBookmarkURL:node->GetURL() |
| 309 disposition:event_utils::WindowOpenDispositionFromNSEvent( | 320 disposition:event_utils::WindowOpenDispositionFromNSEvent( |
| 310 [NSApp currentEvent])]; | 321 [NSApp currentEvent])]; |
| 311 } | 322 } |
| 312 | 323 |
| 313 // Given a NSMenuItem tag, return the appropriate bookmark node id. | 324 // Given a NSMenuItem tag, return the appropriate bookmark node id. |
| 314 - (int64)nodeIdFromMenuTag:(int32)tag { | 325 - (int64)nodeIdFromMenuTag:(int32)tag { |
| 315 return menuTagMap_[tag]; | 326 return menuTagMap_[tag]; |
| (...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 903 | 914 |
| 904 - (NSButton*)offTheSideButton { | 915 - (NSButton*)offTheSideButton { |
| 905 return offTheSideButton_; | 916 return offTheSideButton_; |
| 906 } | 917 } |
| 907 | 918 |
| 908 - (NSButton*)otherBookmarksButton { | 919 - (NSButton*)otherBookmarksButton { |
| 909 return otherBookmarksButton_.get(); | 920 return otherBookmarksButton_.get(); |
| 910 } | 921 } |
| 911 | 922 |
| 912 @end | 923 @end |
| OLD | NEW |