| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/cocoa/bookmark_editor_base_controller.h" | 7 #import "chrome/browser/cocoa/bookmark_editor_base_controller.h" |
| 8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
| 9 #include "app/l10n_util_mac.h" | 9 #include "app/l10n_util_mac.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 DCHECK([path length] == stackSize); | 388 DCHECK([path length] == stackSize); |
| 389 return path; | 389 return path; |
| 390 } | 390 } |
| 391 | 391 |
| 392 - (NSMutableArray*)addChildFoldersFromNode:(const BookmarkNode*)node { | 392 - (NSMutableArray*)addChildFoldersFromNode:(const BookmarkNode*)node { |
| 393 NSMutableArray* childFolders = nil; | 393 NSMutableArray* childFolders = nil; |
| 394 int childCount = node->GetChildCount(); | 394 int childCount = node->GetChildCount(); |
| 395 for (int i = 0; i < childCount; ++i) { | 395 for (int i = 0; i < childCount; ++i) { |
| 396 const BookmarkNode* childNode = node->GetChild(i); | 396 const BookmarkNode* childNode = node->GetChild(i); |
| 397 if (childNode->type() != BookmarkNode::URL) { | 397 if (childNode->type() != BookmarkNode::URL) { |
| 398 NSString* childName = base::SysWideToNSString(childNode->GetTitle()); | 398 NSString* childName = |
| 399 base::SysUTF16ToNSString(childNode->GetTitleAsString16()); |
| 399 NSMutableArray* children = [self addChildFoldersFromNode:childNode]; | 400 NSMutableArray* children = [self addChildFoldersFromNode:childNode]; |
| 400 BookmarkFolderInfo* folderInfo = | 401 BookmarkFolderInfo* folderInfo = |
| 401 [BookmarkFolderInfo bookmarkFolderInfoWithFolderName:childName | 402 [BookmarkFolderInfo bookmarkFolderInfoWithFolderName:childName |
| 402 folderNode:childNode | 403 folderNode:childNode |
| 403 children:children]; | 404 children:children]; |
| 404 if (!childFolders) | 405 if (!childFolders) |
| 405 childFolders = [NSMutableArray arrayWithObject:folderInfo]; | 406 childFolders = [NSMutableArray arrayWithObject:folderInfo]; |
| 406 else | 407 else |
| 407 [childFolders addObject:folderInfo]; | 408 [childFolders addObject:folderInfo]; |
| 408 } | 409 } |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 } | 595 } |
| 595 | 596 |
| 596 // Implementing isEqual: allows the NSTreeController to preserve the selection | 597 // Implementing isEqual: allows the NSTreeController to preserve the selection |
| 597 // and open/shut state of outline items when the data changes. | 598 // and open/shut state of outline items when the data changes. |
| 598 - (BOOL)isEqual:(id)other { | 599 - (BOOL)isEqual:(id)other { |
| 599 return [other isKindOfClass:[BookmarkFolderInfo class]] && | 600 return [other isKindOfClass:[BookmarkFolderInfo class]] && |
| 600 folderNode_ == [(BookmarkFolderInfo*)other folderNode]; | 601 folderNode_ == [(BookmarkFolderInfo*)other folderNode]; |
| 601 } | 602 } |
| 602 | 603 |
| 603 @end | 604 @end |
| OLD | NEW |