OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_NAME_FOLDER_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_NAME_FOLDER_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_NAME_FOLDER_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_NAME_FOLDER_CONTROLLER_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 | 12 |
13 class BookmarkModelObserverForCocoa; | 13 class BookmarkModelObserverForCocoa; |
| 14 class Profile; |
| 15 |
| 16 namespace bookmarks { |
14 class BookmarkNode; | 17 class BookmarkNode; |
15 class Profile; | 18 } |
16 | 19 |
17 // A controller for dialog to let the user create a new folder or | 20 // A controller for dialog to let the user create a new folder or |
18 // rename an existing folder. Accessible from a context menu on a | 21 // rename an existing folder. Accessible from a context menu on a |
19 // bookmark button or the bookmark bar. | 22 // bookmark button or the bookmark bar. |
20 @interface BookmarkNameFolderController : NSWindowController { | 23 @interface BookmarkNameFolderController : NSWindowController { |
21 @private | 24 @private |
22 IBOutlet NSTextField* nameField_; | 25 IBOutlet NSTextField* nameField_; |
23 IBOutlet NSButton* okButton_; | 26 IBOutlet NSButton* okButton_; |
24 | 27 |
25 NSWindow* parentWindow_; // weak | 28 NSWindow* parentWindow_; // weak |
26 Profile* profile_; // weak | 29 Profile* profile_; // weak |
27 | 30 |
28 // Weak; owned by the model. Can be NULL (see below). Either node_ | 31 // Weak; owned by the model. Can be NULL (see below). Either node_ |
29 // is non-NULL (renaming a folder), or parent_ is non-NULL (adding a | 32 // is non-NULL (renaming a folder), or parent_ is non-NULL (adding a |
30 // new one). | 33 // new one). |
31 const BookmarkNode* node_; | 34 const bookmarks::BookmarkNode* node_; |
32 const BookmarkNode* parent_; | 35 const bookmarks::BookmarkNode* parent_; |
33 int newIndex_; | 36 int newIndex_; |
34 | 37 |
35 base::scoped_nsobject<NSString> initialName_; | 38 base::scoped_nsobject<NSString> initialName_; |
36 | 39 |
37 // Ping me when things change out from under us. | 40 // Ping me when things change out from under us. |
38 scoped_ptr<BookmarkModelObserverForCocoa> observer_; | 41 scoped_ptr<BookmarkModelObserverForCocoa> observer_; |
39 } | 42 } |
40 | 43 |
41 // Use the 1st initializer for a "rename existing folder" request. | 44 // Use the 1st initializer for a "rename existing folder" request. |
42 // | 45 // |
43 // Use the 2nd initializer for an "add folder" request. If creating a | 46 // Use the 2nd initializer for an "add folder" request. If creating a |
44 // new folder |parent| and |newIndex| specify where to put the new | 47 // new folder |parent| and |newIndex| specify where to put the new |
45 // node. | 48 // node. |
46 - (id)initWithParentWindow:(NSWindow*)window | 49 - (id)initWithParentWindow:(NSWindow*)window |
47 profile:(Profile*)profile | 50 profile:(Profile*)profile |
48 node:(const BookmarkNode*)node; | 51 node:(const bookmarks::BookmarkNode*)node; |
49 - (id)initWithParentWindow:(NSWindow*)window | 52 - (id)initWithParentWindow:(NSWindow*)window |
50 profile:(Profile*)profile | 53 profile:(Profile*)profile |
51 parent:(const BookmarkNode*)parent | 54 parent:(const bookmarks::BookmarkNode*)parent |
52 newIndex:(int)newIndex; | 55 newIndex:(int)newIndex; |
53 - (void)runAsModalSheet; | 56 - (void)runAsModalSheet; |
54 - (IBAction)cancel:(id)sender; | 57 - (IBAction)cancel:(id)sender; |
55 - (IBAction)ok:(id)sender; | 58 - (IBAction)ok:(id)sender; |
56 @end | 59 @end |
57 | 60 |
58 @interface BookmarkNameFolderController(TestingAPI) | 61 @interface BookmarkNameFolderController(TestingAPI) |
59 - (NSString*)folderName; | 62 - (NSString*)folderName; |
60 - (void)setFolderName:(NSString*)name; | 63 - (void)setFolderName:(NSString*)name; |
61 - (NSButton*)okButton; | 64 - (NSButton*)okButton; |
62 @end | 65 @end |
63 | 66 |
64 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_NAME_FOLDER_CONTROLLER_H_ | 67 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_NAME_FOLDER_CONTROLLER_H_ |
OLD | NEW |