| 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 #include <vector> | 6 #include <vector> |
| 7 #import "chrome/browser/ui/cocoa/draggable_button.h" | 7 #import "chrome/browser/ui/cocoa/draggable_button.h" |
| 8 #import "chrome/browser/ui/cocoa/themed_window.h" | 8 #import "chrome/browser/ui/cocoa/themed_window.h" |
| 9 #include "ui/base/window_open_disposition.h" | 9 #include "ui/base/window_open_disposition.h" |
| 10 | 10 |
| 11 @class BookmarkBarFolderController; | 11 @class BookmarkBarFolderController; |
| 12 @class BookmarkButton; | 12 @class BookmarkButton; |
| 13 @class BrowserWindowController; | 13 @class BrowserWindowController; |
| 14 class Profile; | 14 class Profile; |
| 15 | 15 |
| 16 namespace bookmarks { | 16 namespace bookmarks { |
| 17 class BookmarkModel; | 17 class BookmarkModel; |
| 18 class BookmarkNode; | 18 class BookmarkNode; |
| 19 } | 19 } |
| 20 | 20 |
| 21 // Protocol for a BookmarkButton's delegate, responsible for doing | 21 // Protocol for a BookmarkButton's delegate, responsible for doing |
| 22 // things on behalf of a bookmark button. | 22 // things on behalf of a bookmark button. |
| 23 @protocol BookmarkButtonDelegate | 23 @protocol BookmarkButtonDelegate |
| 24 | 24 |
| 25 // Fill the given pasteboard with appropriate data when the given button is | 25 // Returns a pasteboard item that has all bookmark information. |
| 26 // dragged. Since the delegate has no way of providing pasteboard data later, | 26 - (NSPasteboardItem*)pasteboardItemForDragOfButton:(BookmarkButton*)button; |
| 27 // all data must actually be put into the pasteboard and not merely promised. | |
| 28 - (void)fillPasteboard:(NSPasteboard*)pboard | |
| 29 forDragOfButton:(BookmarkButton*)button; | |
| 30 | 27 |
| 31 // Bookmark buttons pass mouseEntered: and mouseExited: events to | 28 // Bookmark buttons pass mouseEntered: and mouseExited: events to |
| 32 // their delegate. This allows the delegate to decide (for example) | 29 // their delegate. This allows the delegate to decide (for example) |
| 33 // which one, if any, should perform a hover-open. | 30 // which one, if any, should perform a hover-open. |
| 34 - (void)mouseEnteredButton:(id)button event:(NSEvent*)event; | 31 - (void)mouseEnteredButton:(id)button event:(NSEvent*)event; |
| 35 - (void)mouseExitedButton:(id)button event:(NSEvent*)event; | 32 - (void)mouseExitedButton:(id)button event:(NSEvent*)event; |
| 36 | 33 |
| 37 // Returns YES if a drag operation should lock the fullscreen overlay bar | 34 // Returns YES if a drag operation should lock the fullscreen overlay bar |
| 38 // visibility before starting. For example, dragging a bookmark button should | 35 // visibility before starting. For example, dragging a bookmark button should |
| 39 // not lock the overlay if the bookmark bar is currently showing in detached | 36 // not lock the overlay if the bookmark bar is currently showing in detached |
| 40 // mode on the NTP. | 37 // mode on the NTP. |
| 41 - (BOOL)dragShouldLockBarVisibility; | 38 - (BOOL)dragShouldLockBarVisibility; |
| 42 | 39 |
| 43 // Returns the top-level window for this button. | 40 // Returns the top-level window for this button. |
| 44 - (NSWindow*)browserWindow; | 41 - (NSWindow*)browserWindow; |
| 45 | 42 |
| 46 // Returns YES if the bookmark button can be dragged to the trash, NO otherwise. | 43 // Returns YES if the bookmark button can be dragged to the trash, NO otherwise. |
| 47 - (BOOL)canDragBookmarkButtonToTrash:(BookmarkButton*)button; | 44 - (BOOL)canDragBookmarkButtonToTrash:(BookmarkButton*)button; |
| 48 | 45 |
| 49 // This is called after the user has dropped the bookmark button on the trash. | 46 // This is called after the user has dropped the bookmark button on the trash. |
| 50 // The delegate can use this event to delete the bookmark. | 47 // The delegate can use this event to delete the bookmark. |
| 51 - (void)didDragBookmarkToTrash:(BookmarkButton*)button; | 48 - (void)didDragBookmarkToTrash:(BookmarkButton*)button; |
| 52 | 49 |
| 53 // This is called after the drag has finished, for any reason. | 50 // This is called after the drag has finished, for any reason. |
| 54 // We particularly need this so we can hide bookmark folder menus and stop | 51 // We particularly need this so we can hide bookmark folder menus and stop |
| 55 // doing that hover thing. | 52 // doing that hover thing. |
| 56 - (void)bookmarkDragDidEnd:(BookmarkButton*)button | 53 - (void)bookmarkDragDidEnd:(BookmarkButton*)button |
| 57 operation:(NSDragOperation)operation; | 54 operation:(NSDragOperation)operation; |
| 58 | 55 |
| 56 @optional |
| 57 // Called when a pasteboard drag is about to begin. |
| 58 - (void)willBeginPasteboardDrag; |
| 59 |
| 59 @end | 60 @end |
| 60 | 61 |
| 61 | 62 |
| 62 // Protocol to be implemented by controllers that logically own | 63 // Protocol to be implemented by controllers that logically own |
| 63 // bookmark buttons. The controller may be either an NSViewController | 64 // bookmark buttons. The controller may be either an NSViewController |
| 64 // or NSWindowController. The BookmarkButton doesn't use this | 65 // or NSWindowController. The BookmarkButton doesn't use this |
| 65 // protocol directly; it is used when BookmarkButton controllers talk | 66 // protocol directly; it is used when BookmarkButton controllers talk |
| 66 // to each other. | 67 // to each other. |
| 67 // | 68 // |
| 68 // Other than the top level owner (the bookmark bar), all bookmark | 69 // Other than the top level owner (the bookmark bar), all bookmark |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 + (BookmarkButton*)draggedButton; | 247 + (BookmarkButton*)draggedButton; |
| 247 | 248 |
| 248 | 249 |
| 249 @end // @interface BookmarkButton | 250 @end // @interface BookmarkButton |
| 250 | 251 |
| 251 | 252 |
| 252 @interface BookmarkButton(TestingAPI) | 253 @interface BookmarkButton(TestingAPI) |
| 253 - (void)beginDrag:(NSEvent*)event; | 254 - (void)beginDrag:(NSEvent*)event; |
| 254 @end | 255 @end |
| 255 | 256 |
| OLD | NEW |