Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Side by Side Diff: chrome/browser/cocoa/bookmark_editor_base_controller.h

Issue 357005: Implement Bookmark All Tabs... using the BookmarkEditorController and determi... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Name: svn:eol-style
+ LF
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_COCOA_BOOKMARK_EDITOR_BASE_CONTROLLER_H_
6 #define CHROME_BROWSER_COCOA_BOOKMARK_EDITOR_BASE_CONTROLLER_H_
7
8 #import <Cocoa/Cocoa.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 class BookmarkModel;
17
18 // A base controller class for bookmark creation and editing dialogs which
19 // present the current bookmark folder structure in a tree view. Do not
20 // instantiate this controller directly -- use one of its derived classes.
21 // NOTE: If your derived classes is intended to be dispatched via the
22 // BookmarkEditor::Show static function found in the accompanying
23 // implementation will need to update that function.
24 @interface BookmarkEditorBaseController :
25 NSWindowController<NSMatrixDelegate, NSTextFieldDelegate> {
26 @private
27 IBOutlet NSBrowser* folderBrowser_;
28 IBOutlet NSButton* newFolderButton_;
29 IBOutlet NSButton* okButton_; // Used for unit testing only.
30
31 NSWindow* parentWindow_;
32 Profile* profile_; // weak
33 const BookmarkNode* parentNode_; // weak; owned by the model
34 BookmarkEditor::Configuration configuration_;
35 scoped_ptr<BookmarkEditor::Handler> handler_; // we take ownership
36 NSString* initialName_;
37 NSString* displayName_; // Bound to a text field in the dialog.
38 BOOL okEnabled_; // Bound to the OK button.
39 }
40
41 @property (copy) NSString* initialName;
42 @property (copy) NSString* displayName;
43 @property (assign) BOOL okEnabled;
44
45 // Designated initializer. Derived classes should call through to this init.
46 - (id)initWithParentWindow:(NSWindow*)parentWindow
47 nibName:(NSString*)nibName
48 profile:(Profile*)profile
49 parent:(const BookmarkNode*)parent
50 configuration:(BookmarkEditor::Configuration)configuration
51 handler:(BookmarkEditor::Handler*)handler;
52
53 // Run the bookmark editor as a modal sheet. Does not block.
54 - (void)runAsModalSheet;
55
56 // Create a new folder at the end of the selected parent folder, give it
57 // an untitled name, and put it into editing mode.
58 - (IBAction)newFolder:(id)sender;
59
60 // Actions for the buttons at the bottom of the window.
61 - (IBAction)cancel:(id)sender;
62
63 // The OK action will record the edited bookmark. The default dismisses
64 // the dialog and should be called by the derived class if overridden.
65 - (IBAction)ok:(id)sender;
66
67 // Methods for use by derived classes only.
68
69 // Determine and returns the rightmost selected/highlighted element (node)
70 // in the bookmark tree view if the tree view is showing, otherwise returns
71 // the original |parentNode_|. If the tree view is showing but nothing is
72 // selected then return the root node. This assumes that leaf nodes (pure
73 // bookmarks) are not being presented.
74 - (const BookmarkNode*)selectedNode;
75
76 // Select/highlight the given node within the browser tree view. If the
77 // node is nil then select the bookmark bar node. Exposed for unit test.
78 - (void)selectNodeInBrowser:(const BookmarkNode*)node;
79
80 // Notify the handler, if any, of a node creation.
81 - (void)NotifyHandlerCreatedNode:(const BookmarkNode*)node;
82
83 // Accessors
84 - (BookmarkModel*)bookmarkModel;
85 - (const BookmarkNode*)parentNode;
86
87 @end
88
89 @interface BookmarkEditorBaseController(TestingAPI)
90 @property (readonly) BOOL okButtonEnabled;
91 - (void)selectTestNodeInBrowser:(const BookmarkNode*)node;
92 + (const BookmarkNode*)folderChildForParent:(const BookmarkNode*)parent
93 withFolderIndex:(NSInteger)index;
94 + (int)indexOfFolderChild:(const BookmarkNode*)child;
95 @end
96
97 #endif /* CHROME_BROWSER_COCOA_BOOKMARK_EDITOR_BASE_CONTROLLER_H_ */
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/bookmark_all_tabs_controller_unittest.mm ('k') | chrome/browser/cocoa/bookmark_editor_base_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698