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 #include <stack> | 5 #include <stack> |
6 | 6 |
7 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_editor_base_controller.h" | 7 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_editor_base_controller.h" |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 } | 449 } |
450 DCHECK([path length] == stackSize); | 450 DCHECK([path length] == stackSize); |
451 return path; | 451 return path; |
452 } | 452 } |
453 | 453 |
454 - (NSMutableArray*)addChildFoldersFromNode:(const BookmarkNode*)node { | 454 - (NSMutableArray*)addChildFoldersFromNode:(const BookmarkNode*)node { |
455 NSMutableArray* childFolders = nil; | 455 NSMutableArray* childFolders = nil; |
456 int childCount = node->child_count(); | 456 int childCount = node->child_count(); |
457 for (int i = 0; i < childCount; ++i) { | 457 for (int i = 0; i < childCount; ++i) { |
458 const BookmarkNode* childNode = node->GetChild(i); | 458 const BookmarkNode* childNode = node->GetChild(i); |
459 if (childNode->is_folder()) { | 459 if (childNode->is_folder() && childNode->IsVisible()) { |
460 NSString* childName = base::SysUTF16ToNSString(childNode->GetTitle()); | 460 NSString* childName = base::SysUTF16ToNSString(childNode->GetTitle()); |
461 NSMutableArray* children = [self addChildFoldersFromNode:childNode]; | 461 NSMutableArray* children = [self addChildFoldersFromNode:childNode]; |
462 BookmarkFolderInfo* folderInfo = | 462 BookmarkFolderInfo* folderInfo = |
463 [BookmarkFolderInfo bookmarkFolderInfoWithFolderName:childName | 463 [BookmarkFolderInfo bookmarkFolderInfoWithFolderName:childName |
464 folderNode:childNode | 464 folderNode:childNode |
465 children:children]; | 465 children:children]; |
466 if (!childFolders) | 466 if (!childFolders) |
467 childFolders = [NSMutableArray arrayWithObject:folderInfo]; | 467 childFolders = [NSMutableArray arrayWithObject:folderInfo]; |
468 else | 468 else |
469 [childFolders addObject:folderInfo]; | 469 [childFolders addObject:folderInfo]; |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 } | 658 } |
659 | 659 |
660 // Implementing isEqual: allows the NSTreeController to preserve the selection | 660 // Implementing isEqual: allows the NSTreeController to preserve the selection |
661 // and open/shut state of outline items when the data changes. | 661 // and open/shut state of outline items when the data changes. |
662 - (BOOL)isEqual:(id)other { | 662 - (BOOL)isEqual:(id)other { |
663 return [other isKindOfClass:[BookmarkFolderInfo class]] && | 663 return [other isKindOfClass:[BookmarkFolderInfo class]] && |
664 folderNode_ == [(BookmarkFolderInfo*)other folderNode]; | 664 folderNode_ == [(BookmarkFolderInfo*)other folderNode]; |
665 } | 665 } |
666 | 666 |
667 @end | 667 @end |
OLD | NEW |