blob: 4c03c98ed9d8b07bb780d0e8194e331a0d78a913 [file] [log] [blame]
[email protected]ee01535e2009-07-21 23:57:191// 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
3// found in the LICENSE file.
4
5#ifndef CHROME_BROWSER_COCOA_BOOKMARK_EDITOR_CONTROLLER_H_
6#define CHROME_BROWSER_COCOA_BOOKMARK_EDITOR_CONTROLLER_H_
7
8#import <Cocoa/Cocoa.h>
9
[email protected]e798e1922009-09-17 20:43:0610#import "base/cocoa_protocols_mac.h"
[email protected]ee01535e2009-07-21 23:57:1911#include "base/scoped_ptr.h"
12#include "base/scoped_nsobject.h"
13#include "chrome/browser/bookmarks/bookmark_editor.h"
14
[email protected]fbc93b362009-10-29 22:10:3215@class BookmarkTreeBrowserCell;
16
[email protected]ee01535e2009-07-21 23:57:1917// A controller for the bookmark editor, opened with Edit... from the
18// context menu of a bookmark button.
[email protected]e798e1922009-09-17 20:43:0619@interface BookmarkEditorController : NSWindowController<NSTextFieldDelegate> {
[email protected]ee01535e2009-07-21 23:57:1920 @private
21 IBOutlet NSTextField* nameField_;
22 IBOutlet NSTextField* urlField_;
[email protected]fbc93b362009-10-29 22:10:3223 IBOutlet NSBrowser* folderBrowser_;
[email protected]12e25ac2009-08-05 17:28:3924 IBOutlet NSButton* okButton_;
[email protected]ee01535e2009-07-21 23:57:1925 IBOutlet NSButton* newFolderButton_;
26
27 NSWindow* parentWindow_;
28 Profile* profile_; // weak
29 const BookmarkNode* parentNode_; // weak; owned by the model
30 const BookmarkNode* node_; // weak; owned by the model
31 BookmarkEditor::Configuration configuration_;
32 scoped_ptr<BookmarkEditor::Handler> handler_; // we take ownership
33
34 scoped_nsobject<NSString> initialName_;
35 scoped_nsobject<NSString> initialUrl_;
[email protected]fbc93b362009-10-29 22:10:3236 scoped_nsobject<BookmarkTreeBrowserCell> currentEditCell_;
[email protected]ee01535e2009-07-21 23:57:1937}
38
39- (id)initWithParentWindow:(NSWindow*)parentWindow
40 profile:(Profile*)profile
41 parent:(const BookmarkNode*)parent
42 node:(const BookmarkNode*)node
43 configuration:(BookmarkEditor::Configuration)configuration
44 handler:(BookmarkEditor::Handler*)handler;
45
[email protected]7b2b9942009-08-20 21:24:2946// Run the bookmark editor as a modal sheet. Does not block.
47- (void)runAsModalSheet;
48
[email protected]fbc93b362009-10-29 22:10:3249// Create a new folder at the end of the selected parent folder, give it
50// an untitled name, and put it into editing mode.
[email protected]ee01535e2009-07-21 23:57:1951- (IBAction)newFolder:(id)sender;
[email protected]fbc93b362009-10-29 22:10:3252
53// Actions for the buttons at the bottom of the window.
[email protected]ee01535e2009-07-21 23:57:1954- (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;
[email protected]12e25ac2009-08-05 17:28:3961@property (readonly) BOOL okButtonEnabled;
[email protected]9912cd82009-10-22 17:59:0862- (void)selectTestNodeInBrowser:(const BookmarkNode*)node;
[email protected]ee01535e2009-07-21 23:57:1963@end
64
[email protected]ee01535e2009-07-21 23:57:1965#endif /* CHROME_BROWSER_COCOA_BOOKMARK_EDITOR_CONTROLLER_H_ */