OLD | NEW |
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" |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 [button setDelegate:self]; | 382 [button setDelegate:self]; |
383 if (node) { | 383 if (node) { |
384 if (node->is_folder()) { | 384 if (node->is_folder()) { |
385 [button setTarget:self]; | 385 [button setTarget:self]; |
386 [button setAction:@selector(openBookmarkFolderFromButton:)]; | 386 [button setAction:@selector(openBookmarkFolderFromButton:)]; |
387 } else { | 387 } else { |
388 // Make the button do something. | 388 // Make the button do something. |
389 [button setTarget:self]; | 389 [button setTarget:self]; |
390 [button setAction:@selector(openBookmark:)]; | 390 [button setAction:@selector(openBookmark:)]; |
391 // Add a tooltip. | 391 // Add a tooltip. |
392 NSString* title = base::SysUTF16ToNSString(node->GetTitle()); | 392 [button setToolTip:[barController_ tooltipForNode:node]]; |
393 std::string urlString = node->GetURL().possibly_invalid_spec(); | |
394 NSString* tooltip = [NSString stringWithFormat:@"%@\n%s", title, | |
395 urlString.c_str()]; | |
396 [button setToolTip:tooltip]; | |
397 [button setAcceptsTrackIn:YES]; | 393 [button setAcceptsTrackIn:YES]; |
398 } | 394 } |
399 } else { | 395 } else { |
400 [button setEnabled:NO]; | 396 [button setEnabled:NO]; |
401 [button setBordered:NO]; | 397 [button setBordered:NO]; |
402 } | 398 } |
403 return button; | 399 return button; |
404 } | 400 } |
405 | 401 |
406 - (id)folderTarget { | 402 - (id)folderTarget { |
(...skipping 1583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1990 | 1986 |
1991 - (void)setIgnoreAnimations:(BOOL)ignore { | 1987 - (void)setIgnoreAnimations:(BOOL)ignore { |
1992 ignoreAnimations_ = ignore; | 1988 ignoreAnimations_ = ignore; |
1993 } | 1989 } |
1994 | 1990 |
1995 - (BookmarkButton*)buttonThatMouseIsIn { | 1991 - (BookmarkButton*)buttonThatMouseIsIn { |
1996 return buttonThatMouseIsIn_; | 1992 return buttonThatMouseIsIn_; |
1997 } | 1993 } |
1998 | 1994 |
1999 @end // BookmarkBarFolderController | 1995 @end // BookmarkBarFolderController |
OLD | NEW |