1 // Copyright (c) 2010 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_UI_COCOA_BOOKMARKS_BOOKMARK_FOLDER_TARGET_CONTROLLER_H_ 6 #define CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_FOLDER_TARGET_CONTROLLER_H_ 7 #pragma once 8 9 #import <Cocoa/Cocoa.h> 10 11 @class BookmarkButton; 12 @protocol BookmarkButtonControllerProtocol; 13 class BookmarkNode; 14 15 // Target (in the target/action sense) of a bookmark folder button. 16 // Since ObjC doesn't have multiple inheritance we use has-a instead 17 // of is-a to share behavior between the BookmarkBarFolderController 18 // (NSWindowController) and the BookmarkBarController 19 // (NSViewController). 20 // 21 // This class is unit tested in the context of a BookmarkBarController. 22 @interface BookmarkFolderTarget : NSObject { 23 // The owner of the bookmark folder button 24 id<BookmarkButtonControllerProtocol> controller_; // weak 25 } 26 27 - (id)initWithController:(id<BookmarkButtonControllerProtocol>)controller; 28 29 // Main IBAction for a button click. 30 - (IBAction)openBookmarkFolderFromButton:(id)sender; 31 32 // Copies the given bookmark node to the given pasteboard, declaring appropriate 33 // types (to paste a URL with a title). 34 - (void)copyBookmarkNode:(const BookmarkNode*)node 35 toPasteboard:(NSPasteboard*)pboard; 36 37 // Fill the given pasteboard with appropriate data when the given button is 38 // dragged. Since the delegate has no way of providing pasteboard data later, 39 // all data must actually be put into the pasteboard and not merely promised. 40 - (void)fillPasteboard:(NSPasteboard*)pboard 41 forDragOfButton:(BookmarkButton*)button; 42 43 @end 44 45 // The (internal) |NSPasteboard| type string for bookmark button drags, used for 46 // dragging buttons around the bookmark bar. The data for this type is just a 47 // pointer to the |BookmarkButton| being dragged. 48 extern NSString* kBookmarkButtonDragType; 49 50 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_FOLDER_TARGET_CONTROLLER_H_ 51