| 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 #import "chrome/browser/cocoa/bookmark_tree_controller.h" | 5 #import "chrome/browser/cocoa/bookmark_tree_controller.h" |
| 6 | 6 |
| 7 #include "app/l10n_util_mac.h" | 7 #include "app/l10n_util_mac.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #import "chrome/browser/cocoa/bookmark_item.h" | 9 #import "chrome/browser/cocoa/bookmark_item.h" |
| 10 #import "chrome/browser/cocoa/bookmark_manager_controller.h" | 10 #import "chrome/browser/cocoa/bookmark_manager_controller.h" |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 return NO; | 143 return NO; |
| 144 } | 144 } |
| 145 if (![outline_ isExpandable:item]) | 145 if (![outline_ isExpandable:item]) |
| 146 return NO; | 146 return NO; |
| 147 [outline_ expandItem:item]; | 147 [outline_ expandItem:item]; |
| 148 DCHECK([outline_ isItemExpanded:item]); | 148 DCHECK([outline_ isItemExpanded:item]); |
| 149 return YES; | 149 return YES; |
| 150 } | 150 } |
| 151 | 151 |
| 152 - (BOOL)revealItem:(BookmarkItem*)item { | 152 - (BOOL)revealItem:(BookmarkItem*)item { |
| 153 if (![self expandItem:[item parent]]) | 153 if ([item parent] && ![self expandItem:[item parent]]) |
| 154 return NO; | 154 return NO; |
| 155 [outline_ scrollRowToVisible:[outline_ rowForItem:item]]; | 155 [outline_ scrollRowToVisible:[outline_ rowForItem:item]]; |
| 156 [self setSelectedItems:[NSArray arrayWithObject:item]]; | 156 [self setSelectedItems:[NSArray arrayWithObject:item]]; |
| 157 return YES; | 157 return YES; |
| 158 } | 158 } |
| 159 | 159 |
| 160 - (BOOL)getInsertionParent:(BookmarkItem**)outParent | 160 - (BOOL)getInsertionParent:(BookmarkItem**)outParent |
| 161 index:(NSUInteger*)outIndex { | 161 index:(NSUInteger*)outIndex { |
| 162 NSArray* selItems = [self actionItems]; | 162 NSArray* selItems = [self actionItems]; |
| 163 NSUInteger numSelected = [selItems count]; | 163 NSUInteger numSelected = [selItems count]; |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 [NSFont smallSystemFontSize]] retain]; | 454 [NSFont smallSystemFontSize]] retain]; |
| 455 static NSFont* sPlainFont = [[NSFont systemFontOfSize: | 455 static NSFont* sPlainFont = [[NSFont systemFontOfSize: |
| 456 [NSFont smallSystemFontSize]] retain]; | 456 [NSFont smallSystemFontSize]] retain]; |
| 457 [cell setFont:[item isFixed] ? sBoldFont : sPlainFont]; | 457 [cell setFont:[item isFixed] ? sBoldFont : sPlainFont]; |
| 458 } | 458 } |
| 459 | 459 |
| 460 // Updates the tree after the data model has changed. | 460 // Updates the tree after the data model has changed. |
| 461 - (void)itemChanged:(id)nodeItem childrenChanged:(BOOL)childrenChanged { | 461 - (void)itemChanged:(id)nodeItem childrenChanged:(BOOL)childrenChanged { |
| 462 if (nodeItem == group_) | 462 if (nodeItem == group_) |
| 463 nodeItem = nil; | 463 nodeItem = nil; |
| 464 NSArray* sel = [self selectedItems]; |
| 464 [outline_ reloadItem:nodeItem reloadChildren:childrenChanged]; | 465 [outline_ reloadItem:nodeItem reloadChildren:childrenChanged]; |
| 466 [self setSelectedItems:sel]; |
| 465 } | 467 } |
| 466 | 468 |
| 467 @end | 469 @end |
| 468 | 470 |
| 469 | 471 |
| 470 @implementation BookmarksOutlineView | 472 @implementation BookmarksOutlineView |
| 471 | 473 |
| 472 - (BookmarkTreeController*)bookmarkController { | 474 - (BookmarkTreeController*)bookmarkController { |
| 473 return (BookmarkTreeController*)[self delegate]; | 475 return (BookmarkTreeController*)[self delegate]; |
| 474 } | 476 } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 } | 523 } |
| 522 } | 524 } |
| 523 [super keyDown:event]; | 525 [super keyDown:event]; |
| 524 } | 526 } |
| 525 | 527 |
| 526 - (NSMenu*)menu { | 528 - (NSMenu*)menu { |
| 527 return [[self bookmarkController] menu]; | 529 return [[self bookmarkController] menu]; |
| 528 } | 530 } |
| 529 | 531 |
| 530 @end | 532 @end |
| OLD | NEW |