summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/bookmark_button.h
diff options
context:
space:
mode:
authormrossetti@chromium.org <mrossetti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-29 18:24:32 +0000
committermrossetti@chromium.org <mrossetti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-29 18:24:32 +0000
commit94d2135c70fc622226a72fd970ed1d3dd0428b6d (patch)
tree5189dc8b8ff562288411b831a8eae399fcc02f2f /chrome/browser/cocoa/bookmark_button.h
parent54cfd69da88df660a056ababe8f9ed8aff8d8e9b (diff)
downloadchromium_src-94d2135c70fc622226a72fd970ed1d3dd0428b6d.zip
chromium_src-94d2135c70fc622226a72fd970ed1d3dd0428b6d.tar.gz
chromium_src-94d2135c70fc622226a72fd970ed1d3dd0428b6d.tar.bz2
Add and implement cut/copy/paste to the bookmark bar and folder context menus.Prevent dropping bookmark folders onto their children to avoid creating cycles and crashing. Keep folder menu windows open after a cut/copy/paste/delete and drop operation. Add test helpers for easing comparison of bookmark model changes.
BUG=41217,36614,32064, 41404 Add and implement cut/copy/paste to the bookmark bar and folder context menus.Prevent dropping bookmark folders onto their children to avoid creating cycles and crashing. Keep folder menu windows open after a cut/copy/paste/delete and drop operation. TEST=1) Present the context menu for the bookmark bar in various places and insure that the cut/copy/paste menu items are shown and properly enabled or disabled. 2) Present the context menu for a folder menu in various places and insure that the cut/copy/paste menu items are shown and properly enabled or disabled. 3) Perform cut/copy/paste/delete operations in a folder menu and subfolder menu and verify that the menu remains presented after the operation completes. 4) Drag a bookmark item from the bar to another location on the bar and verify that the button no longer shows up in the old location but does show up in the new location. 5) Drag a bookmark item from the bar to be within a folder located _after_ the item being dragged. Verify the bar no longer shows the bookmark item. Verify the folder does show the bookmark item. Verify that the folder window has shifted to the left so that it remains aligned with it corresponding bar folder indicator. 6) Drag a bookmark item from the bar to be within a folder located _before_ the item being dragged. Verify the bar no longer shows the bookmark item. Verify the folder does show the bookmark item. Verify that the folder window has _not_ shifted to the left and that it remains aligned with it corresponding bar folder indicator. 7) Drag a bookmark around within the same folder and verify that the folder window does not move. 8) Drag a bookmark item from a folder to the bar in a position _after_ the folder form which the item comes. The folder menu window should close. 9) Drag a bookmark item from a folder to a different folder and verify that the original folder closes and the new folder remains open. 10) Drag an item from a parent folder to a child folder and verify that both folders remain open. Verify that the subfolder remains aligned to its associated folder icon in the parent folder. 11) Drag an item from a child folder to a parent folder. Verify that the child folder closes and the parent folder remains open. 12) Try dragging a parent folder onto a child folder and verify that the drag is not allowed to complete. 13) Hover over a folder item in a folder menu window. Verify that the folder opens up a subview menu window. Now drag the original folder (the one being hovered over) and verify that its subfolder menu automatically closes. 14) Slowly shrink window width until "off the side" menu appears; make sure it appears as soon as the last button gets removed. Now slowly grow window and make sure it goes away at the right time. 15) Add enough bookmarks to the bookmark bar to nearly fill the width of the window. Verify that the off-the-side chevron is not showing. Slowly shrink the width of the window until the off-the-side-chevron appears. Verify that the right-most bookmark button has disappeared and does not draw over the top of the chevron. Continue to shrink the window and verify that bookmark buttons disappear. View the contents of the chevron and verify that the bookmark buttons which previously appeared on the bar now appear in the chevron. Slowly grow the window and verify that bookmark buttons reappear without drawing over the top of the chevron. Verify that those bookmark buttons no longer appear in the chevron when it is popped up. Continue growing the window until all bookmark buttons appear in the bar and the chevron disappears. 16) Shrink the window so that the off-the-side chevron appears and contains three or more bookmarks. Pop open the chevron. Drag bookmarks up and down in the chevron menu and verify that moves and copies are performed. Drag a bar bookmark into the chevron and verify that the chevron pops up and allows the drag. Verify that the bar and chevron contents rearrange such that buttons on the bar fill but do not overflow the bar. Drag a chevron bookmark out onto the bar. Once again verify that the bar and chevron buttons rearrange such that the bar is full but not overflowing. Review URL: http://codereview.chromium.org/1742003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45965 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/bookmark_button.h')
-rw-r--r--chrome/browser/cocoa/bookmark_button.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/bookmark_button.h b/chrome/browser/cocoa/bookmark_button.h
index cb62053..62acadc 100644
--- a/chrome/browser/cocoa/bookmark_button.h
+++ b/chrome/browser/cocoa/bookmark_button.h
@@ -46,6 +46,7 @@ class ThemeProvider;
// or NSWindowController. The BookmarkButton doesn't use this
// protocol directly; it is used when BookmarkButton controllers talk
// to each other.
+//
// Other than the top level owner (the bookmark bar), all bookmark
// button controllers have a parent controller.
@protocol BookmarkButtonControllerProtocol
@@ -116,6 +117,35 @@ class ThemeProvider;
- (void)openAll:(const BookmarkNode*)node
disposition:(WindowOpenDisposition)disposition;
+// There are several operations which may affect the contents of a bookmark
+// button controller after it has been created, primary of which are
+// cut/paste/delete and drag/drop. Such changes may involve coordinating
+// the bookmark button contents of two controllers (such as when a bookmark is
+// dragged from one folder to another). The bookmark bar controller
+// coordinates in response to notifications propogated by the bookmark model
+// through BookmarkBarBridge calls. The following three functions are
+// implemented by the controllers and are dispatched by the bookmark bar
+// controller in response to notifications coming in from the BookmarkBarBridge.
+
+// Add a button for the given node to the bar or folder menu. This is safe
+// to call when a folder menu window is open as that window will be updated.
+// And index of -1 means to append to the end (bottom).
+- (void)addButtonForNode:(const BookmarkNode*)node
+ atIndex:(NSInteger)buttonIndex;
+
+// Move a button from one place in the menu to another. This is safe
+// to call when a folder menu window is open as that window will be updated.
+- (void)moveButtonFromIndex:(NSInteger)fromIndex toIndex:(NSInteger)toIndex;
+
+// Remove the bookmark button at the given index. Show the poof animation
+// if |animate:| is YES. It may be obvious, but this is safe
+// to call when a folder menu window is open as that window will be updated.
+- (void)removeButton:(NSInteger)buttonIndex animate:(BOOL)poof;
+
+// Determine the controller containing the button representing |node|, if any.
+- (id<BookmarkButtonControllerProtocol>)controllerForNode:
+ (const BookmarkNode*)node;
+
@end // @protocol BookmarkButtonControllerProtocol