15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2010 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_FOLDER_TARGET_CONTROLLER_H_
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_FOLDER_TARGET_CONTROLLER_H_
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#import <Cocoa/Cocoa.h>
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)@class BookmarkButton;
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)@protocol BookmarkButtonControllerProtocol;
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class BookmarkNode;
135d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)class Profile;
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Target (in the target/action sense) of a bookmark folder button.
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Since ObjC doesn't have multiple inheritance we use has-a instead
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// of is-a to share behavior between the BookmarkBarFolderController
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// (NSWindowController) and the BookmarkBarController
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// (NSViewController).
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This class is unit tested in the context of a BookmarkBarController.
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)@interface BookmarkFolderTarget : NSObject {
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The owner of the bookmark folder button
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  id<BookmarkButtonControllerProtocol> controller_;  // weak
255d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  Profile* profile_;
265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
285d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)- (id)initWithController:(id<BookmarkButtonControllerProtocol>)controller
295d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                 profile:(Profile*)profile;
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Main IBAction for a button click.
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)- (IBAction)openBookmarkFolderFromButton:(id)sender;
335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Fill the given pasteboard with appropriate data when the given button is
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// dragged. Since the delegate has no way of providing pasteboard data later,
365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// all data must actually be put into the pasteboard and not merely promised.
375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)- (void)fillPasteboard:(NSPasteboard*)pboard
385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)       forDragOfButton:(BookmarkButton*)button;
395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)@end
415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// The (internal) |NSPasteboard| type string for bookmark button drags, used for
435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// dragging buttons around the bookmark bar. The data for this type is just a
445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// pointer to the |BookmarkButton| being dragged.
455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)extern NSString* kBookmarkButtonDragType;
465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif  // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_FOLDER_TARGET_CONTROLLER_H_
48