diff options
author | asvitkine@chromium.org <asvitkine@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-18 20:11:56 +0000 |
---|---|---|
committer | asvitkine@chromium.org <asvitkine@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-18 20:11:56 +0000 |
commit | ebbe94b785d1e18ef34f7cc5db026bbb7cba9adb (patch) | |
tree | 2ea94ce4b815c0f965e6dbe7b59523b18ddf41fb /chrome/app/nibs | |
parent | f2a9e3f812d05f0ac61cbae4b5e911f29913c9b2 (diff) | |
download | chromium_src-ebbe94b785d1e18ef34f7cc5db026bbb7cba9adb.zip chromium_src-ebbe94b785d1e18ef34f7cc5db026bbb7cba9adb.tar.gz chromium_src-ebbe94b785d1e18ef34f7cc5db026bbb7cba9adb.tar.bz2 |
Better fix for Lion dictionary popover cmd-W bug.
This reverts http://crrev.com/117681 and http://crrev.com/104931 and instead uses new 10.7 notifications to change the shortcuts on Close Tab and Close Window items, so that cmd-W does a "Close Window" when the dictionary is open.
The above is also how Safari appears to solve this issue, as can be seen by going to the File menu when the dictionary popover is up.
BUG=104931, 110306, 109061
TEST=1. Open a tab and double 3-finger tap on a word to bring up the
dictionary popup. Hit cmd-W. The popup should close but the tab
should stay open. Hit cmd-W again. The tab should close.
2. Try cmd-shift-W with > 1 tab open. The window should close.
3. Open a window that doesn't have tabs (e.g. Chrome -> About
Chrome). File -> Close Tab should be disabled.
Review URL: http://codereview.chromium.org/9230011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@118131 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/app/nibs')
-rw-r--r-- | chrome/app/nibs/MainMenu.xib | 18 | ||||
-rw-r--r-- | chrome/app/nibs/main_menu_unittest.mm | 60 |
2 files changed, 9 insertions, 69 deletions
diff --git a/chrome/app/nibs/MainMenu.xib b/chrome/app/nibs/MainMenu.xib index 247cd96..09fd8d3 100644 --- a/chrome/app/nibs/MainMenu.xib +++ b/chrome/app/nibs/MainMenu.xib @@ -1450,6 +1450,14 @@ <object class="IBActionConnection" key="connection"> <string key="label">commandDispatch:</string> <reference key="source" ref="1014"/> + <reference key="destination" ref="1059729334"/> + </object> + <int key="connectionID">528</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">commandDispatch:</string> + <reference key="source" ref="1014"/> <reference key="destination" ref="1051826322"/> </object> <int key="connectionID">529</int> @@ -1854,14 +1862,6 @@ </object> <int key="connectionID">697</int> </object> - <object class="IBConnectionRecord"> - <object class="IBActionConnection" key="connection"> - <string key="label">performClose:</string> - <reference key="source" ref="1014"/> - <reference key="destination" ref="1059729334"/> - </object> - <int key="connectionID">698</int> - </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> <object class="NSArray" key="orderedObjects"> @@ -3213,7 +3213,7 @@ </object> </object> <nil key="sourceID"/> - <int key="maxID">698</int> + <int key="maxID">697</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> diff --git a/chrome/app/nibs/main_menu_unittest.mm b/chrome/app/nibs/main_menu_unittest.mm deleted file mode 100644 index ec72d88..0000000 --- a/chrome/app/nibs/main_menu_unittest.mm +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#import <Cocoa/Cocoa.h> - -#include "base/mac/foundation_util.h" -#include "base/memory/scoped_nsobject.h" -#include "chrome/app/chrome_command_ids.h" -#include "testing/platform_test.h" - -class MainMenuTest : public PlatformTest { - public: - // Recursively find the menu item with the given |tag| in |menu|. - NSMenuItem* FindMenuItemWithTag(NSMenu* menu, NSInteger tag) { - NSMenuItem* found = [menu itemWithTag:tag]; - if (found) - return found; - NSMenuItem* item; - for (item in [menu itemArray]) { - if ([item hasSubmenu]) { - found = FindMenuItemWithTag([item submenu], tag); - if (found) - return found; - } - } - return nil; - } -}; - - -TEST_F(MainMenuTest, CloseTabPerformClose) { - scoped_nsobject<NSNib> nib( - [[NSNib alloc] initWithNibNamed:@"MainMenu" - bundle:base::mac::MainAppBundle()]); - EXPECT_TRUE(nib); - - NSArray* objects = nil; - EXPECT_TRUE([nib instantiateNibWithOwner:nil - topLevelObjects:&objects]); - - // Check that "Close Tab" is mapped to -performClose:. This is needed to - // ensure the Lion dictionary pop up gets closed on Cmd-W, if it's open. - // See http://crbug.com/104931 for details. - BOOL found = NO; - for (NSUInteger i = 0; i < [objects count]; ++i) { - if ([[objects objectAtIndex:i] isKindOfClass:[NSMenu class]]) { - NSMenu* menu = [objects objectAtIndex:i]; - NSMenuItem* closeTabItem = FindMenuItemWithTag(menu, IDC_CLOSE_TAB); - if (closeTabItem) { - EXPECT_EQ(@selector(performClose:), [closeTabItem action]); - found = YES; - break; - } - } - } - EXPECT_TRUE(found); - [objects makeObjectsPerformSelector:@selector(release)]; - [NSApp setMainMenu:nil]; -} |