| 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 #ifndef CHROME_BROWSER_COCOA_BOOKMARK_EDITOR_BASE_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_COCOA_BOOKMARK_EDITOR_BASE_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_COCOA_BOOKMARK_EDITOR_BASE_CONTROLLER_H_ | 6 #define CHROME_BROWSER_COCOA_BOOKMARK_EDITOR_BASE_CONTROLLER_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #import "base/cocoa_protocols_mac.h" | 10 #import "base/cocoa_protocols_mac.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 // An array of BookmarkFolderInfo where each item describes a folder in the | 39 // An array of BookmarkFolderInfo where each item describes a folder in the |
| 40 // BookmarkNode structure. | 40 // BookmarkNode structure. |
| 41 scoped_nsobject<NSArray> folderTreeArray_; | 41 scoped_nsobject<NSArray> folderTreeArray_; |
| 42 // Bound to the table view giving a path to the current selections, of which | 42 // Bound to the table view giving a path to the current selections, of which |
| 43 // there should only ever be one. | 43 // there should only ever be one. |
| 44 scoped_nsobject<NSArray> tableSelectionPaths_; | 44 scoped_nsobject<NSArray> tableSelectionPaths_; |
| 45 // C++ bridge object that observes the BookmarkModel for me. | 45 // C++ bridge object that observes the BookmarkModel for me. |
| 46 scoped_ptr<BookmarkEditorBaseControllerBridge> observer_; | 46 scoped_ptr<BookmarkEditorBaseControllerBridge> observer_; |
| 47 } | 47 } |
| 48 | 48 |
| 49 @property (copy) NSString* initialName; | 49 @property (nonatomic, copy) NSString* initialName; |
| 50 @property (copy) NSString* displayName; | 50 @property (nonatomic, copy) NSString* displayName; |
| 51 @property (assign) BOOL okEnabled; | 51 @property (nonatomic, assign) BOOL okEnabled; |
| 52 @property (retain, readonly) NSArray* folderTreeArray; | 52 @property (nonatomic, retain, readonly) NSArray* folderTreeArray; |
| 53 @property (copy) NSArray* tableSelectionPaths; | 53 @property (nonatomic, copy) NSArray* tableSelectionPaths; |
| 54 | 54 |
| 55 // Designated initializer. Derived classes should call through to this init. | 55 // Designated initializer. Derived classes should call through to this init. |
| 56 - (id)initWithParentWindow:(NSWindow*)parentWindow | 56 - (id)initWithParentWindow:(NSWindow*)parentWindow |
| 57 nibName:(NSString*)nibName | 57 nibName:(NSString*)nibName |
| 58 profile:(Profile*)profile | 58 profile:(Profile*)profile |
| 59 parent:(const BookmarkNode*)parent | 59 parent:(const BookmarkNode*)parent |
| 60 configuration:(BookmarkEditor::Configuration)configuration; | 60 configuration:(BookmarkEditor::Configuration)configuration; |
| 61 | 61 |
| 62 // Run the bookmark editor as a modal sheet. Does not block. | 62 // Run the bookmark editor as a modal sheet. Does not block. |
| 63 - (void)runAsModalSheet; | 63 - (void)runAsModalSheet; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 // but not yet committed to the bookmark structure), and an NSArray of | 113 // but not yet committed to the bookmark structure), and an NSArray of |
| 114 // child folder BookmarkFolderInfo's following this same structure. | 114 // child folder BookmarkFolderInfo's following this same structure. |
| 115 @interface BookmarkFolderInfo : NSObject { | 115 @interface BookmarkFolderInfo : NSObject { |
| 116 @private | 116 @private |
| 117 NSString* folderName_; | 117 NSString* folderName_; |
| 118 const BookmarkNode* folderNode_; // weak | 118 const BookmarkNode* folderNode_; // weak |
| 119 NSMutableArray* children_; | 119 NSMutableArray* children_; |
| 120 BOOL newFolder_; | 120 BOOL newFolder_; |
| 121 } | 121 } |
| 122 | 122 |
| 123 @property (copy, readwrite) NSString* folderName; | 123 @property (nonatomic, copy) NSString* folderName; |
| 124 @property (assign, readwrite) const BookmarkNode* folderNode; | 124 @property (nonatomic, assign) const BookmarkNode* folderNode; |
| 125 @property (retain, readwrite) NSMutableArray* children; | 125 @property (nonatomic, retain) NSMutableArray* children; |
| 126 @property (assign, readwrite) BOOL newFolder; | 126 @property (nonatomic, assign) BOOL newFolder; |
| 127 | 127 |
| 128 // Convenience creator for adding a new folder to the editor's bookmark | 128 // Convenience creator for adding a new folder to the editor's bookmark |
| 129 // structure. This folder will be added to the bookmark model when the | 129 // structure. This folder will be added to the bookmark model when the |
| 130 // user accepts the dialog. |folderName| must be provided. | 130 // user accepts the dialog. |folderName| must be provided. |
| 131 + (id)bookmarkFolderInfoWithFolderName:(NSString*)folderName; | 131 + (id)bookmarkFolderInfoWithFolderName:(NSString*)folderName; |
| 132 | 132 |
| 133 // Designated initializer. |folderName| must be provided. For folders which | 133 // Designated initializer. |folderName| must be provided. For folders which |
| 134 // already exist in the bookmark model, |folderNode| and |children| (if any | 134 // already exist in the bookmark model, |folderNode| and |children| (if any |
| 135 // children are already attached to this folder) must be provided and | 135 // children are already attached to this folder) must be provided and |
| 136 // |newFolder| should be NO. For folders which the user has added during | 136 // |newFolder| should be NO. For folders which the user has added during |
| 137 // this session and which have not been committed yet, |newFolder| should be | 137 // this session and which have not been committed yet, |newFolder| should be |
| 138 // YES and |folderNode| and |children| should be NULL/nil. | 138 // YES and |folderNode| and |children| should be NULL/nil. |
| 139 - (id)initWithFolderName:(NSString*)folderName | 139 - (id)initWithFolderName:(NSString*)folderName |
| 140 folderNode:(const BookmarkNode*)folderNode | 140 folderNode:(const BookmarkNode*)folderNode |
| 141 children:(NSMutableArray*)children | 141 children:(NSMutableArray*)children |
| 142 newFolder:(BOOL)newFolder; | 142 newFolder:(BOOL)newFolder; |
| 143 | 143 |
| 144 // Convenience creator used during construction of the editor's bookmark | 144 // Convenience creator used during construction of the editor's bookmark |
| 145 // structure. |folderName| and |folderNode| must be provided. |children| | 145 // structure. |folderName| and |folderNode| must be provided. |children| |
| 146 // is optional. Private: exposed here for unit testing purposes. | 146 // is optional. Private: exposed here for unit testing purposes. |
| 147 + (id)bookmarkFolderInfoWithFolderName:(NSString*)folderName | 147 + (id)bookmarkFolderInfoWithFolderName:(NSString*)folderName |
| 148 folderNode:(const BookmarkNode*)folderNode | 148 folderNode:(const BookmarkNode*)folderNode |
| 149 children:(NSMutableArray*)children; | 149 children:(NSMutableArray*)children; |
| 150 | 150 |
| 151 @end | 151 @end |
| 152 | 152 |
| 153 @interface BookmarkEditorBaseController(TestingAPI) | 153 @interface BookmarkEditorBaseController(TestingAPI) |
| 154 | 154 |
| 155 @property (readonly) BOOL okButtonEnabled; | 155 @property (nonatomic, readonly) BOOL okButtonEnabled; |
| 156 | 156 |
| 157 // Create any newly added folders. New folders are nodes in folderTreeArray | 157 // Create any newly added folders. New folders are nodes in folderTreeArray |
| 158 // which are marked as being new (i.e. their kFolderTreeNewFolderKey | 158 // which are marked as being new (i.e. their kFolderTreeNewFolderKey |
| 159 // dictionary item is YES). This is called by -[ok:]. | 159 // dictionary item is YES). This is called by -[ok:]. |
| 160 - (void)createNewFolders; | 160 - (void)createNewFolders; |
| 161 | 161 |
| 162 // Select the given bookmark node within the tree view. | 162 // Select the given bookmark node within the tree view. |
| 163 - (void)selectTestNodeInBrowser:(const BookmarkNode*)node; | 163 - (void)selectTestNodeInBrowser:(const BookmarkNode*)node; |
| 164 | 164 |
| 165 // Return the dictionary for the folder selected in the tree. | 165 // Return the dictionary for the folder selected in the tree. |
| 166 - (BookmarkFolderInfo*)selectedFolder; | 166 - (BookmarkFolderInfo*)selectedFolder; |
| 167 | 167 |
| 168 @end | 168 @end |
| 169 | 169 |
| 170 #endif // CHROME_BROWSER_COCOA_BOOKMARK_EDITOR_BASE_CONTROLLER_H_ | 170 #endif // CHROME_BROWSER_COCOA_BOOKMARK_EDITOR_BASE_CONTROLLER_H_ |
| OLD | NEW |