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