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