| 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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 } | 409 } |
| 410 return childFolders; | 410 return childFolders; |
| 411 } | 411 } |
| 412 | 412 |
| 413 - (void)buildFolderTree { | 413 - (void)buildFolderTree { |
| 414 // Build up a tree of the current folder configuration. | 414 // Build up a tree of the current folder configuration. |
| 415 BookmarkModel* model = profile_->GetBookmarkModel(); | 415 BookmarkModel* model = profile_->GetBookmarkModel(); |
| 416 const BookmarkNode* rootNode = model->root_node(); | 416 const BookmarkNode* rootNode = model->root_node(); |
| 417 NSMutableArray* baseArray = [self addChildFoldersFromNode:rootNode]; | 417 NSMutableArray* baseArray = [self addChildFoldersFromNode:rootNode]; |
| 418 DCHECK(baseArray); | 418 DCHECK(baseArray); |
| 419 [self willChangeValueForKey:@"folderTreeArray"]; |
| 419 folderTreeArray_.reset([baseArray retain]); | 420 folderTreeArray_.reset([baseArray retain]); |
| 421 [self didChangeValueForKey:@"folderTreeArray"]; |
| 420 } | 422 } |
| 421 | 423 |
| 422 - (void)modelChangedPreserveSelection:(BOOL)preserve { | 424 - (void)modelChangedPreserveSelection:(BOOL)preserve { |
| 423 const BookmarkNode* selectedNode = [self selectedNode]; | 425 const BookmarkNode* selectedNode = [self selectedNode]; |
| 424 [self buildFolderTree]; | 426 [self buildFolderTree]; |
| 425 if (preserve && | 427 if (preserve && |
| 426 selectedNode && | 428 selectedNode && |
| 427 configuration_ == BookmarkEditor::SHOW_TREE) | 429 configuration_ == BookmarkEditor::SHOW_TREE) |
| 428 [self selectNodeInBrowser:selectedNode]; | 430 [self selectNodeInBrowser:selectedNode]; |
| 429 } | 431 } |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 } | 590 } |
| 589 | 591 |
| 590 // Implementing isEqual: allows the NSTreeController to preserve the selection | 592 // Implementing isEqual: allows the NSTreeController to preserve the selection |
| 591 // and open/shut state of outline items when the data changes. | 593 // and open/shut state of outline items when the data changes. |
| 592 - (BOOL)isEqual:(id)other { | 594 - (BOOL)isEqual:(id)other { |
| 593 return [other isKindOfClass:[BookmarkFolderInfo class]] && | 595 return [other isKindOfClass:[BookmarkFolderInfo class]] && |
| 594 folderNode_ == [(BookmarkFolderInfo*)other folderNode]; | 596 folderNode_ == [(BookmarkFolderInfo*)other folderNode]; |
| 595 } | 597 } |
| 596 | 598 |
| 597 @end | 599 @end |
| OLD | NEW |