| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 parent:details.parent_node | 109 parent:details.parent_node |
| 110 node:details.existing_node | 110 node:details.existing_node |
| 111 url:details.url | 111 url:details.url |
| 112 title:details.title | 112 title:details.title |
| 113 configuration:configuration]; | 113 configuration:configuration]; |
| 114 } | 114 } |
| 115 [controller runAsModalSheet]; | 115 [controller runAsModalSheet]; |
| 116 } | 116 } |
| 117 | 117 |
| 118 // Adapter to tell BookmarkEditorBaseController when bookmarks change. | 118 // Adapter to tell BookmarkEditorBaseController when bookmarks change. |
| 119 class BookmarkEditorBaseControllerBridge : public BookmarkModelObserver { | 119 class BookmarkEditorBaseControllerBridge |
| 120 : public bookmarks::BookmarkModelObserver { |
| 120 public: | 121 public: |
| 121 BookmarkEditorBaseControllerBridge(BookmarkEditorBaseController* controller) | 122 BookmarkEditorBaseControllerBridge(BookmarkEditorBaseController* controller) |
| 122 : controller_(controller), | 123 : controller_(controller), |
| 123 importing_(false) | 124 importing_(false) |
| 124 { } | 125 { } |
| 125 | 126 |
| 127 // bookmarks::BookmarkModelObserver: |
| 126 void BookmarkModelLoaded(BookmarkModel* model, bool ids_reassigned) override { | 128 void BookmarkModelLoaded(BookmarkModel* model, bool ids_reassigned) override { |
| 127 [controller_ modelChangedPreserveSelection:YES]; | 129 [controller_ modelChangedPreserveSelection:YES]; |
| 128 } | 130 } |
| 129 | 131 |
| 130 void BookmarkNodeMoved(BookmarkModel* model, | 132 void BookmarkNodeMoved(BookmarkModel* model, |
| 131 const BookmarkNode* old_parent, | 133 const BookmarkNode* old_parent, |
| 132 int old_index, | 134 int old_index, |
| 133 const BookmarkNode* new_parent, | 135 const BookmarkNode* new_parent, |
| 134 int new_index) override { | 136 int new_index) override { |
| 135 if (!importing_ && new_parent->GetChild(new_index)->is_folder()) | 137 if (!importing_ && new_parent->GetChild(new_index)->is_folder()) |
| (...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 } | 714 } |
| 713 | 715 |
| 714 // Implementing isEqual: allows the NSTreeController to preserve the selection | 716 // Implementing isEqual: allows the NSTreeController to preserve the selection |
| 715 // and open/shut state of outline items when the data changes. | 717 // and open/shut state of outline items when the data changes. |
| 716 - (BOOL)isEqual:(id)other { | 718 - (BOOL)isEqual:(id)other { |
| 717 return [other isKindOfClass:[BookmarkFolderInfo class]] && | 719 return [other isKindOfClass:[BookmarkFolderInfo class]] && |
| 718 folderNode_ == [(BookmarkFolderInfo*)other folderNode]; | 720 folderNode_ == [(BookmarkFolderInfo*)other folderNode]; |
| 719 } | 721 } |
| 720 | 722 |
| 721 @end | 723 @end |
| OLD | NEW |