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