| 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 #ifndef CHROME_BROWSER_COCOA_BOOKMARK_EDITOR_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_COCOA_BOOKMARK_EDITOR_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_COCOA_BOOKMARK_EDITOR_CONTROLLER_H_ | 6 #define CHROME_BROWSER_COCOA_BOOKMARK_EDITOR_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" |
| 11 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
| 12 #include "base/scoped_nsobject.h" | 12 #include "base/scoped_nsobject.h" |
| 13 #include "chrome/browser/bookmarks/bookmark_editor.h" | 13 #include "chrome/browser/bookmarks/bookmark_editor.h" |
| 14 | 14 |
| 15 @class BookmarkTreeBrowserCell; |
| 16 |
| 15 // A controller for the bookmark editor, opened with Edit... from the | 17 // A controller for the bookmark editor, opened with Edit... from the |
| 16 // context menu of a bookmark button. | 18 // context menu of a bookmark button. |
| 17 @interface BookmarkEditorController : NSWindowController<NSTextFieldDelegate> { | 19 @interface BookmarkEditorController : NSWindowController<NSTextFieldDelegate> { |
| 18 @private | 20 @private |
| 19 IBOutlet NSTextField* nameField_; | 21 IBOutlet NSTextField* nameField_; |
| 20 IBOutlet NSTextField* urlField_; | 22 IBOutlet NSTextField* urlField_; |
| 21 IBOutlet NSBrowser* browser_; | 23 IBOutlet NSBrowser* folderBrowser_; |
| 22 IBOutlet NSButton* okButton_; | 24 IBOutlet NSButton* okButton_; |
| 23 IBOutlet NSButton* newFolderButton_; | 25 IBOutlet NSButton* newFolderButton_; |
| 24 | 26 |
| 25 NSWindow* parentWindow_; | 27 NSWindow* parentWindow_; |
| 26 Profile* profile_; // weak | 28 Profile* profile_; // weak |
| 27 const BookmarkNode* parentNode_; // weak; owned by the model | 29 const BookmarkNode* parentNode_; // weak; owned by the model |
| 28 const BookmarkNode* node_; // weak; owned by the model | 30 const BookmarkNode* node_; // weak; owned by the model |
| 29 BookmarkEditor::Configuration configuration_; | 31 BookmarkEditor::Configuration configuration_; |
| 30 scoped_ptr<BookmarkEditor::Handler> handler_; // we take ownership | 32 scoped_ptr<BookmarkEditor::Handler> handler_; // we take ownership |
| 31 | 33 |
| 32 scoped_nsobject<NSString> initialName_; | 34 scoped_nsobject<NSString> initialName_; |
| 33 scoped_nsobject<NSString> initialUrl_; | 35 scoped_nsobject<NSString> initialUrl_; |
| 36 scoped_nsobject<BookmarkTreeBrowserCell> currentEditCell_; |
| 34 } | 37 } |
| 35 | 38 |
| 36 - (id)initWithParentWindow:(NSWindow*)parentWindow | 39 - (id)initWithParentWindow:(NSWindow*)parentWindow |
| 37 profile:(Profile*)profile | 40 profile:(Profile*)profile |
| 38 parent:(const BookmarkNode*)parent | 41 parent:(const BookmarkNode*)parent |
| 39 node:(const BookmarkNode*)node | 42 node:(const BookmarkNode*)node |
| 40 configuration:(BookmarkEditor::Configuration)configuration | 43 configuration:(BookmarkEditor::Configuration)configuration |
| 41 handler:(BookmarkEditor::Handler*)handler; | 44 handler:(BookmarkEditor::Handler*)handler; |
| 42 | 45 |
| 43 // Run the bookmark editor as a modal sheet. Does not block. | 46 // Run the bookmark editor as a modal sheet. Does not block. |
| 44 - (void)runAsModalSheet; | 47 - (void)runAsModalSheet; |
| 45 | 48 |
| 49 // Create a new folder at the end of the selected parent folder, give it |
| 50 // an untitled name, and put it into editing mode. |
| 51 - (IBAction)newFolder:(id)sender; |
| 52 |
| 46 // Actions for the buttons at the bottom of the window. | 53 // Actions for the buttons at the bottom of the window. |
| 47 - (IBAction)newFolder:(id)sender; | |
| 48 - (IBAction)cancel:(id)sender; | 54 - (IBAction)cancel:(id)sender; |
| 49 - (IBAction)ok:(id)sender; | 55 - (IBAction)ok:(id)sender; |
| 50 @end | 56 @end |
| 51 | 57 |
| 52 @interface BookmarkEditorController(TestingAPI) | 58 @interface BookmarkEditorController(TestingAPI) |
| 53 @property (assign) NSString* displayName; | 59 @property (assign) NSString* displayName; |
| 54 @property (assign) NSString* displayURL; | 60 @property (assign) NSString* displayURL; |
| 55 @property (readonly) BOOL okButtonEnabled; | 61 @property (readonly) BOOL okButtonEnabled; |
| 56 - (void)selectTestNodeInBrowser:(const BookmarkNode*)node; | 62 - (void)selectTestNodeInBrowser:(const BookmarkNode*)node; |
| 57 @end | 63 @end |
| 58 | 64 |
| 59 | |
| 60 #endif /* CHROME_BROWSER_COCOA_BOOKMARK_EDITOR_CONTROLLER_H_ */ | 65 #endif /* CHROME_BROWSER_COCOA_BOOKMARK_EDITOR_CONTROLLER_H_ */ |
| 61 | |
| OLD | NEW |