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/tabs/tab_view.h" | 5 #import "chrome/browser/ui/cocoa/tabs/tab_view.h" |
6 | 6 |
7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/mac/sdk_forward_declarations.h" | 9 #include "base/mac/sdk_forward_declarations.h" |
10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 [super dealloc]; | 193 [super dealloc]; |
194 } | 194 } |
195 | 195 |
196 // Called to obtain the context menu for when the user hits the right mouse | 196 // Called to obtain the context menu for when the user hits the right mouse |
197 // button (or control-clicks). (Note that -rightMouseDown: is *not* called for | 197 // button (or control-clicks). (Note that -rightMouseDown: is *not* called for |
198 // control-click.) | 198 // control-click.) |
199 - (NSMenu*)menu { | 199 - (NSMenu*)menu { |
200 if ([self isClosing]) | 200 if ([self isClosing]) |
201 return nil; | 201 return nil; |
202 | 202 |
203 // Sheets, being window-modal, should block contextual menus. For some reason | |
204 // they do not. Disallow them ourselves. | |
205 if ([[self window] attachedSheet]) | |
206 return nil; | |
207 | |
208 return [controller_ menu]; | 203 return [controller_ menu]; |
209 } | 204 } |
210 | 205 |
211 - (void)resizeSubviewsWithOldSize:(NSSize)oldBoundsSize { | 206 - (void)resizeSubviewsWithOldSize:(NSSize)oldBoundsSize { |
212 [super resizeSubviewsWithOldSize:oldBoundsSize]; | 207 [super resizeSubviewsWithOldSize:oldBoundsSize]; |
213 // Called when our view is resized. If it gets too small, start by hiding | 208 // Called when our view is resized. If it gets too small, start by hiding |
214 // the close button and only show it if tab is selected. Eventually, hide the | 209 // the close button and only show it if tab is selected. Eventually, hide the |
215 // icon as well. | 210 // icon as well. |
216 [controller_ updateVisibility]; | 211 [controller_ updateVisibility]; |
217 } | 212 } |
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
945 NSAffineTransform* transform = [NSAffineTransform transform]; | 940 NSAffineTransform* transform = [NSAffineTransform transform]; |
946 [transform scaleXBy:-1 yBy:1]; | 941 [transform scaleXBy:-1 yBy:1]; |
947 [transform translateXBy:-17.5 yBy:-0.25]; | 942 [transform translateXBy:-17.5 yBy:-0.25]; |
948 [bezierPath transformUsingAffineTransform:transform]; | 943 [bezierPath transformUsingAffineTransform:transform]; |
949 | 944 |
950 [[NSColor whiteColor] set]; | 945 [[NSColor whiteColor] set]; |
951 [bezierPath fill]; | 946 [bezierPath fill]; |
952 } | 947 } |
953 | 948 |
954 @end // @implementation TabView(MaterialDesign) | 949 @end // @implementation TabView(MaterialDesign) |
OLD | NEW |