OLD | NEW |
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 Loading... |
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 |
OLD | NEW |