| 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 #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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 - (NSIndexPath*)selectionPathForNode:(const BookmarkNode*)node; | 52 - (NSIndexPath*)selectionPathForNode:(const BookmarkNode*)node; |
| 53 | 53 |
| 54 @end | 54 @end |
| 55 | 55 |
| 56 // static; implemented for each platform. Update this function for new | 56 // static; implemented for each platform. Update this function for new |
| 57 // classes derived from BookmarkEditorBaseController. | 57 // classes derived from BookmarkEditorBaseController. |
| 58 void BookmarkEditor::Show(gfx::NativeWindow parent_hwnd, | 58 void BookmarkEditor::Show(gfx::NativeWindow parent_hwnd, |
| 59 Profile* profile, | 59 Profile* profile, |
| 60 const BookmarkNode* parent, | 60 const BookmarkNode* parent, |
| 61 const EditDetails& details, | 61 const EditDetails& details, |
| 62 Configuration configuration, | 62 Configuration configuration) { |
| 63 Handler* handler) { | |
| 64 BookmarkEditorBaseController* controller = nil; | 63 BookmarkEditorBaseController* controller = nil; |
| 64 // TODO(viettrungluu): get rid of |handler:| below and elsewhere. |
| 65 if (details.type == EditDetails::NEW_FOLDER) { | 65 if (details.type == EditDetails::NEW_FOLDER) { |
| 66 controller = [[BookmarkAllTabsController alloc] | 66 controller = [[BookmarkAllTabsController alloc] |
| 67 initWithParentWindow:parent_hwnd | 67 initWithParentWindow:parent_hwnd |
| 68 profile:profile | 68 profile:profile |
| 69 parent:parent | 69 parent:parent |
| 70 configuration:configuration | 70 configuration:configuration |
| 71 handler:handler]; | 71 handler:NULL]; |
| 72 } else { | 72 } else { |
| 73 controller = [[BookmarkEditorController alloc] | 73 controller = [[BookmarkEditorController alloc] |
| 74 initWithParentWindow:parent_hwnd | 74 initWithParentWindow:parent_hwnd |
| 75 profile:profile | 75 profile:profile |
| 76 parent:parent | 76 parent:parent |
| 77 node:details.existing_node | 77 node:details.existing_node |
| 78 configuration:configuration | 78 configuration:configuration |
| 79 handler:handler]; | 79 handler:NULL]; |
| 80 } | 80 } |
| 81 [controller runAsModalSheet]; | 81 [controller runAsModalSheet]; |
| 82 } | 82 } |
| 83 | 83 |
| 84 // Adapter to tell BookmarkEditorBaseController when bookmarks change. | 84 // Adapter to tell BookmarkEditorBaseController when bookmarks change. |
| 85 class BookmarkEditorBaseControllerBridge : public BookmarkModelObserver { | 85 class BookmarkEditorBaseControllerBridge : public BookmarkModelObserver { |
| 86 public: | 86 public: |
| 87 BookmarkEditorBaseControllerBridge(BookmarkEditorBaseController* controller) | 87 BookmarkEditorBaseControllerBridge(BookmarkEditorBaseController* controller) |
| 88 : controller_(controller), | 88 : controller_(controller), |
| 89 importing_(false) | 89 importing_(false) |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 } | 605 } |
| 606 | 606 |
| 607 // Implementing isEqual: allows the NSTreeController to preserve the selection | 607 // Implementing isEqual: allows the NSTreeController to preserve the selection |
| 608 // and open/shut state of outline items when the data changes. | 608 // and open/shut state of outline items when the data changes. |
| 609 - (BOOL)isEqual:(id)other { | 609 - (BOOL)isEqual:(id)other { |
| 610 return [other isKindOfClass:[BookmarkFolderInfo class]] && | 610 return [other isKindOfClass:[BookmarkFolderInfo class]] && |
| 611 folderNode_ == [(BookmarkFolderInfo*)other folderNode]; | 611 folderNode_ == [(BookmarkFolderInfo*)other folderNode]; |
| 612 } | 612 } |
| 613 | 613 |
| 614 @end | 614 @end |
| OLD | NEW |