summaryrefslogtreecommitdiffstats
path: root/ui/app_list
diff options
context:
space:
mode:
authortapted@chromium.org <tapted@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-07 21:41:24 +0000
committertapted@chromium.org <tapted@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-07 21:41:24 +0000
commit60e9143637b518ac1d977c055922321082aaa818 (patch)
tree9a15a1800d62f1c72845904c3ca4a106387515c3 /ui/app_list
parenta0e7e86682f9804b06d59d9163f8118484e30c91 (diff)
downloadchromium_src-60e9143637b518ac1d977c055922321082aaa818.zip
chromium_src-60e9143637b518ac1d977c055922321082aaa818.tar.gz
chromium_src-60e9143637b518ac1d977c055922321082aaa818.tar.bz2
Squelch context menus on the OSX App List when both buttons are pressed.
The apps grid uses [NSView menuForEvent:..] for its menus, so needs to check the button state explicitly to match the behaviour of [NSButton menu] (which isn't used, e.g., because the NSButton doesn't fill the grid cell). This CL adds a check to suppress the menu when the button is in the "lit" state, which occurs when the button is being held down. BUG=328835 TEST=Hold the left, then the right, mouse buttons over a app launcher item. A menu shouldn't appear. Releasing the left button (without moving the mouse cursor) will launch the item. Review URL: https://codereview.chromium.org/93793012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@243391 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/app_list')
-rw-r--r--ui/app_list/cocoa/apps_grid_controller_unittest.mm7
-rw-r--r--ui/app_list/cocoa/apps_grid_view_item.mm4
2 files changed, 11 insertions, 0 deletions
diff --git a/ui/app_list/cocoa/apps_grid_controller_unittest.mm b/ui/app_list/cocoa/apps_grid_controller_unittest.mm
index 2815882..a015246 100644
--- a/ui/app_list/cocoa/apps_grid_controller_unittest.mm
+++ b/ui/app_list/cocoa/apps_grid_controller_unittest.mm
@@ -983,6 +983,13 @@ TEST_F(AppsGridControllerTest, ContextMenus) {
menu = [page menuForEvent:mouse_at_cell_1];
EXPECT_EQ(1, [menu numberOfItems]);
EXPECT_NSEQ(@"Menu For: Item Two", [[menu itemAtIndex:0] title]);
+
+ // Test that a button being held down with the left button does not also show
+ // a context menu.
+ [GetItemViewAt(0) highlight:YES];
+ EXPECT_FALSE([page menuForEvent:mouse_at_cell_0]);
+ [GetItemViewAt(0) highlight:NO];
+ EXPECT_TRUE([page menuForEvent:mouse_at_cell_0]);
}
} // namespace test
diff --git a/ui/app_list/cocoa/apps_grid_view_item.mm b/ui/app_list/cocoa/apps_grid_view_item.mm
index 54273a8..92e5d1b 100644
--- a/ui/app_list/cocoa/apps_grid_view_item.mm
+++ b/ui/app_list/cocoa/apps_grid_view_item.mm
@@ -345,6 +345,10 @@ void ItemModelObserverBridge::ItemPercentDownloadedChanged() {
}
- (NSMenu*)contextMenu {
+ // Don't show the menu if button is already held down, e.g. with a left-click.
+ if ([[[self button] cell] isHighlighted])
+ return nil;
+
[self setSelected:YES];
return observerBridge_->GetContextMenu();
}