| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_EDITOR_BASE_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_EDITOR_BASE_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_EDITOR_BASE_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_EDITOR_BASE_CONTROLLER_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 #include "base/mac/scoped_nsobject.h" | 12 #include "base/mac/scoped_nsobject.h" |
| 13 #include "chrome/browser/ui/bookmarks/bookmark_editor.h" | 13 #include "chrome/browser/ui/bookmarks/bookmark_editor.h" |
| 14 #include "components/bookmarks/browser/bookmark_expanded_state_tracker.h" | 14 #include "components/bookmarks/browser/bookmark_expanded_state_tracker.h" |
| 15 #import "ui/base/cocoa/touch_bar_forward_declarations.h" |
| 15 | 16 |
| 16 class BookmarkEditorBaseControllerBridge; | 17 class BookmarkEditorBaseControllerBridge; |
| 17 @class BookmarkTreeBrowserCell; | 18 @class BookmarkTreeBrowserCell; |
| 18 | 19 |
| 19 namespace bookmarks { | 20 namespace bookmarks { |
| 20 class BookmarkModel; | 21 class BookmarkModel; |
| 21 } | 22 } |
| 22 | 23 |
| 23 // A base controller class for bookmark creation and editing dialogs which | 24 // A base controller class for bookmark creation and editing dialogs which |
| 24 // present the current bookmark folder structure in a tree view. Do not | 25 // present the current bookmark folder structure in a tree view. Do not |
| 25 // instantiate this controller directly -- use one of its derived classes. | 26 // instantiate this controller directly -- use one of its derived classes. |
| 26 // NOTE: If a derived class is intended to be dispatched via the | 27 // NOTE: If a derived class is intended to be dispatched via the |
| 27 // BookmarkEditor::Show static function found in the accompanying | 28 // BookmarkEditor::Show static function found in the accompanying |
| 28 // implementation, that function will need to be update. | 29 // implementation, that function will need to be update. |
| 29 @interface BookmarkEditorBaseController | 30 @interface BookmarkEditorBaseController |
| 30 : NSWindowController<NSOutlineViewDelegate> { | 31 : NSWindowController<NSOutlineViewDelegate, NSTouchBarDelegate> { |
| 31 @private | 32 @private |
| 32 IBOutlet NSButton* newFolderButton_; | 33 IBOutlet NSButton* newFolderButton_; |
| 33 IBOutlet NSButton* okButton_; // Used for unit testing only. | 34 IBOutlet NSButton* okButton_; // Used for unit testing only. |
| 34 IBOutlet NSTreeController* folderTreeController_; | 35 IBOutlet NSTreeController* folderTreeController_; |
| 35 IBOutlet NSOutlineView* folderTreeView_; | 36 IBOutlet NSOutlineView* folderTreeView_; |
| 36 | 37 |
| 37 NSWindow* parentWindow_; // weak | 38 NSWindow* parentWindow_; // weak |
| 38 Profile* profile_; // weak | 39 Profile* profile_; // weak |
| 39 const bookmarks::BookmarkNode* parentNode_; // weak; owned by the model | 40 const bookmarks::BookmarkNode* parentNode_; // weak; owned by the model |
| 40 GURL url_; // This and title_ are only used for new urls. | 41 GURL url_; // This and title_ are only used for new urls. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 61 // Designated initializer. Derived classes should call through to this init. | 62 // Designated initializer. Derived classes should call through to this init. |
| 62 // |url| and |title| are only used for BookmarkNode::Type::NEW_URL. | 63 // |url| and |title| are only used for BookmarkNode::Type::NEW_URL. |
| 63 - (id)initWithParentWindow:(NSWindow*)parentWindow | 64 - (id)initWithParentWindow:(NSWindow*)parentWindow |
| 64 nibName:(NSString*)nibName | 65 nibName:(NSString*)nibName |
| 65 profile:(Profile*)profile | 66 profile:(Profile*)profile |
| 66 parent:(const bookmarks::BookmarkNode*)parent | 67 parent:(const bookmarks::BookmarkNode*)parent |
| 67 url:(const GURL&)url | 68 url:(const GURL&)url |
| 68 title:(const base::string16&)title | 69 title:(const base::string16&)title |
| 69 configuration:(BookmarkEditor::Configuration)configuration; | 70 configuration:(BookmarkEditor::Configuration)configuration; |
| 70 | 71 |
| 72 // Override to customize the touch bar. |
| 73 - (NSTouchBar*)makeTouchBar; |
| 74 |
| 71 // Run the bookmark editor as a modal sheet. Does not block. | 75 // Run the bookmark editor as a modal sheet. Does not block. |
| 72 - (void)runAsModalSheet; | 76 - (void)runAsModalSheet; |
| 73 | 77 |
| 74 // Create a new folder at the end of the selected parent folder, give it | 78 // Create a new folder at the end of the selected parent folder, give it |
| 75 // an untitled name, and put it into editing mode. | 79 // an untitled name, and put it into editing mode. |
| 76 - (IBAction)newFolder:(id)sender; | 80 - (IBAction)newFolder:(id)sender; |
| 77 | 81 |
| 78 // The cancel action will dismiss the dialog. Derived classes which | 82 // The cancel action will dismiss the dialog. Derived classes which |
| 79 // override cancel:, must call this after accessing any dialog-related | 83 // override cancel:, must call this after accessing any dialog-related |
| 80 // data. | 84 // data. |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 | 188 |
| 185 // Select the given bookmark node within the tree view. | 189 // Select the given bookmark node within the tree view. |
| 186 - (void)selectTestNodeInBrowser:(const bookmarks::BookmarkNode*)node; | 190 - (void)selectTestNodeInBrowser:(const bookmarks::BookmarkNode*)node; |
| 187 | 191 |
| 188 // Return the dictionary for the folder selected in the tree. | 192 // Return the dictionary for the folder selected in the tree. |
| 189 - (BookmarkFolderInfo*)selectedFolder; | 193 - (BookmarkFolderInfo*)selectedFolder; |
| 190 | 194 |
| 191 @end | 195 @end |
| 192 | 196 |
| 193 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_EDITOR_BASE_CONTROLLER_H_ | 197 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_EDITOR_BASE_CONTROLLER_H_ |
| OLD | NEW |