Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(332)

Side by Side Diff: chrome/browser/ui/cocoa/chrome_browser_window.mm

Issue 9230011: Better fix for Lion dictionary popover cmd-W bug. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/ui/cocoa/chrome_browser_window.h" 5 #import "chrome/browser/ui/cocoa/chrome_browser_window.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/app/chrome_command_ids.h"
9 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
10 #import "chrome/browser/ui/cocoa/themed_window.h" 8 #import "chrome/browser/ui/cocoa/themed_window.h"
11 #include "ui/base/theme_provider.h" 9 #include "ui/base/theme_provider.h"
12 10
13 @implementation ChromeBrowserWindow 11 @implementation ChromeBrowserWindow
14 12
15 - (void)underlaySurfaceAdded { 13 - (void)underlaySurfaceAdded {
16 DCHECK_GE(underlaySurfaceCount_, 0); 14 DCHECK_GE(underlaySurfaceCount_, 0);
17 ++underlaySurfaceCount_; 15 ++underlaySurfaceCount_;
18 16
19 // We're having the OpenGL surface render under the window, so the window 17 // We're having the OpenGL surface render under the window, so the window
(...skipping 24 matching lines...) Expand all
44 return [delegate themedWindowStyle]; 42 return [delegate themedWindowStyle];
45 } 43 }
46 44
47 - (NSPoint)themePatternPhase { 45 - (NSPoint)themePatternPhase {
48 id delegate = [self delegate]; 46 id delegate = [self delegate];
49 if (![delegate respondsToSelector:@selector(themePatternPhase)]) 47 if (![delegate respondsToSelector:@selector(themePatternPhase)])
50 return NSMakePoint(0, 0); 48 return NSMakePoint(0, 0);
51 return [delegate themePatternPhase]; 49 return [delegate themePatternPhase];
52 } 50 }
53 51
54 - (BOOL)performCloseShouldRouteToCommandDispatch:(id)sender {
55 return [[self delegate] respondsToSelector:@selector(commandDispatch:)] &&
56 [sender isKindOfClass:[NSMenuItem class]] &&
57 [sender tag] == IDC_CLOSE_TAB;
58 }
59
60 - (void)performClose:(id)sender {
61 // Route -performClose: to -commandDispatch: on the delegate when coming from
62 // the "close tab" menu item. This is done here, rather than simply connecting
63 // the menu item to -commandDispatch: in IB because certain parts of AppKit,
64 // such as the Lion dictionary pop up, expect Cmd-W to send -performClose:.
65 // See http://crbug.com/104931 for details.
66 if ([self performCloseShouldRouteToCommandDispatch:sender]) {
67 id delegate = [self delegate];
68 [delegate commandDispatch:sender];
69 return;
70 }
71
72 [super performClose:sender];
73 }
74
75 @end 52 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/chrome_browser_window.h ('k') | chrome/browser/ui/cocoa/chrome_browser_window_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698