| 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_menu_cocoa_controller.h" | 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.h" |
| 6 | 6 |
| 7 #include "base/strings/sys_string_conversions.h" | 7 #include "base/strings/sys_string_conversions.h" |
| 8 #include "chrome/app/chrome_command_ids.h" // IDC_BOOKMARK_MENU | 8 #include "chrome/app/chrome_command_ids.h" // IDC_BOOKMARK_MENU |
| 9 #import "chrome/browser/app_controller_mac.h" | 9 #import "chrome/browser/app_controller_mac.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 @implementation BookmarkMenuCocoaController | 36 @implementation BookmarkMenuCocoaController |
| 37 | 37 |
| 38 + (NSString*)menuTitleForNode:(const BookmarkNode*)node { | 38 + (NSString*)menuTitleForNode:(const BookmarkNode*)node { |
| 39 base::string16 title = [MenuController elideMenuTitle:node->GetTitle() | 39 base::string16 title = [MenuController elideMenuTitle:node->GetTitle() |
| 40 toWidth:kMaximumMenuPixelsWide]; | 40 toWidth:kMaximumMenuPixelsWide]; |
| 41 return base::SysUTF16ToNSString(title); | 41 return base::SysUTF16ToNSString(title); |
| 42 } | 42 } |
| 43 | 43 |
| 44 + (NSString*)tooltipForNode:(const BookmarkNode*)node { | 44 + (NSString*)tooltipForNode:(const BookmarkNode*)node { |
| 45 NSString* title = base::SysUTF16ToNSString(node->GetTitle()); | 45 NSString* title = base::SysUTF16ToNSString(node->GetTitle()); |
| 46 if (node->is_folder()) |
| 47 return title; |
| 46 std::string urlString = node->url().possibly_invalid_spec(); | 48 std::string urlString = node->url().possibly_invalid_spec(); |
| 47 NSString* url = base::SysUTF8ToNSString(urlString); | 49 NSString* url = base::SysUTF8ToNSString(urlString); |
| 48 return cocoa_l10n_util::TooltipForURLAndTitle(url, title); | 50 return cocoa_l10n_util::TooltipForURLAndTitle(url, title); |
| 49 } | 51 } |
| 50 | 52 |
| 51 - (id)initWithBridge:(BookmarkMenuBridge*)bridge | 53 - (id)initWithBridge:(BookmarkMenuBridge*)bridge |
| 52 andMenu:(NSMenu*)menu { | 54 andMenu:(NSMenu*)menu { |
| 53 if ((self = [super init])) { | 55 if ((self = [super init])) { |
| 54 bridge_ = bridge; | 56 bridge_ = bridge; |
| 55 DCHECK(bridge_); | 57 DCHECK(bridge_); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 | 156 |
| 155 - (IBAction)openAllBookmarksNewWindow:(id)sender { | 157 - (IBAction)openAllBookmarksNewWindow:(id)sender { |
| 156 [self openAll:[sender tag] withDisposition:NEW_WINDOW]; | 158 [self openAll:[sender tag] withDisposition:NEW_WINDOW]; |
| 157 } | 159 } |
| 158 | 160 |
| 159 - (IBAction)openAllBookmarksIncognitoWindow:(id)sender { | 161 - (IBAction)openAllBookmarksIncognitoWindow:(id)sender { |
| 160 [self openAll:[sender tag] withDisposition:OFF_THE_RECORD]; | 162 [self openAll:[sender tag] withDisposition:OFF_THE_RECORD]; |
| 161 } | 163 } |
| 162 | 164 |
| 163 @end // BookmarkMenuCocoaController | 165 @end // BookmarkMenuCocoaController |
| OLD | NEW |