summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authormaf@chromium.org <maf@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-23 19:55:05 +0000
committermaf@chromium.org <maf@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-23 19:55:05 +0000
commita09b784fff53a779da22cbcf99323dec339de6ac (patch)
tree2731a46433a6bed0a94f93b0b6f1e1049584b4c4 /chrome
parent918777f66ed648e747058d895b8875ab14856950 (diff)
downloadchromium_src-a09b784fff53a779da22cbcf99323dec339de6ac.zip
chromium_src-a09b784fff53a779da22cbcf99323dec339de6ac.tar.gz
chromium_src-a09b784fff53a779da22cbcf99323dec339de6ac.tar.bz2
Make BookmarkButton always inform its delegate when a drag has completed, via a new delegate method.
Make delegates respond to that method and stop showing bookmark hover menus. BUG=58965 TEST=Follow the nice detailed repro steps in the bug and notice they no longer work. Hah! Review URL: http://codereview.chromium.org/6538109 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75777 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm5
-rw-r--r--chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm5
-rw-r--r--chrome/browser/ui/cocoa/bookmarks/bookmark_button.h5
-rw-r--r--chrome/browser/ui/cocoa/bookmarks/bookmark_button.mm4
-rw-r--r--chrome/browser/ui/cocoa/bookmarks/bookmark_button_unittest.mm3
5 files changed, 22 insertions, 0 deletions
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm
index 2a41ae5..ce31f84 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm
@@ -2064,6 +2064,11 @@ static BOOL ValueInRangeInclusive(CGFloat low, CGFloat value, CGFloat high) {
}
}
+- (void)bookmarkDragDidEnd:(BookmarkButton*)button {
+ [self closeFolderAndStopTrackingMenus];
+}
+
+
#pragma mark BookmarkButtonControllerProtocol
// Close all bookmark folders. "Folder" here is the fake menu for
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm
index 3362886..74a8d22 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm
@@ -1277,6 +1277,11 @@ static BOOL ValueInRangeInclusive(CGFloat low, CGFloat value, CGFloat high) {
}
}
+- (void)bookmarkDragDidEnd:(BookmarkButton*)button {
+ [barController_ bookmarkDragDidEnd:button];
+}
+
+
#pragma mark BookmarkButtonControllerProtocol
// Recursively close all bookmark folders.
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_button.h b/chrome/browser/ui/cocoa/bookmarks/bookmark_button.h
index 6525e8e..e09c620 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_button.h
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_button.h
@@ -50,6 +50,11 @@ class ThemeProvider;
// The delegate can use this event to delete the bookmark.
- (void)didDragBookmarkToTrash:(BookmarkButton*)button;
+// This is called after the drag has finished, for any reason.
+// We particularly need this so we can hide bookmark folder menus and stop
+// doing that hover thing.
+- (void)bookmarkDragDidEnd:(BookmarkButton*)button;
+
@end
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_button.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_button.mm
index 885e5c8..dba0f6b 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_button.mm
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_button.mm
@@ -179,6 +179,10 @@ NSString* const kBookmarkPulseFlagKey = @"BookmarkPulseFlagKey";
- (void)draggedImage:(NSImage *)anImage
endedAt:(NSPoint)aPoint
operation:(NSDragOperation)operation {
+ // Inform delegate of drag source that we're finished dragging,
+ // so it can close auto-opened bookmark folders etc.
+ [delegate_ bookmarkDragDidEnd:self];
+ // Tell delegate if it should delete us.
if (operation & NSDragOperationDelete) {
dragEndScreenLocation_ = aPoint;
[delegate_ didDragBookmarkToTrash:self];
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_button_unittest.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_button_unittest.mm
index 93bd769..d45132f 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_button_unittest.mm
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_button_unittest.mm
@@ -53,6 +53,9 @@
didDragToTrashCount_++;
}
+- (void)bookmarkDragDidEnd:(BookmarkButton*)button {
+}
+
@end
namespace {