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_strip_view.h" | 5 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" |
6 | 6 |
7 #include <cmath> // floor | 7 #include <cmath> // floor |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/mac/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 return YES; | 220 return YES; |
221 } | 221 } |
222 | 222 |
223 // We accept first mouse so clicks onto close/zoom/miniaturize buttons and | 223 // We accept first mouse so clicks onto close/zoom/miniaturize buttons and |
224 // title bar double-clicks are properly detected even when the window is in the | 224 // title bar double-clicks are properly detected even when the window is in the |
225 // background. | 225 // background. |
226 - (BOOL)acceptsFirstMouse:(NSEvent*)event { | 226 - (BOOL)acceptsFirstMouse:(NSEvent*)event { |
227 return YES; | 227 return YES; |
228 } | 228 } |
229 | 229 |
| 230 // When displaying a modal sheet, interaction with the tabs (e.g. middle-click |
| 231 // to close a tab) should be blocked. -[NSWindow sendEvent] blocks left-click, |
| 232 // but not others. To prevent clicks going to subviews, absorb them here. This |
| 233 // is also done in FastResizeView, but TabStripView is in the title bar, so is |
| 234 // not contained in a FastResizeView. |
| 235 - (NSView*)hitTest:(NSPoint)aPoint { |
| 236 if ([[self window] attachedSheet]) |
| 237 return self; |
| 238 return [super hitTest:aPoint]; |
| 239 } |
| 240 |
230 // Trap double-clicks and make them miniaturize the browser window. | 241 // Trap double-clicks and make them miniaturize the browser window. |
231 - (void)mouseUp:(NSEvent*)event { | 242 - (void)mouseUp:(NSEvent*)event { |
232 // Bail early if double-clicks are disabled. | 243 // Bail early if double-clicks are disabled. |
233 if (![self doubleClickMinimizesWindow]) { | 244 if (![self doubleClickMinimizesWindow]) { |
234 [super mouseUp:event]; | 245 [super mouseUp:event]; |
235 return; | 246 return; |
236 } | 247 } |
237 | 248 |
238 NSInteger clickCount = [event clickCount]; | 249 NSInteger clickCount = [event clickCount]; |
239 NSTimeInterval timestamp = [event timestamp]; | 250 NSTimeInterval timestamp = [event timestamp]; |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 } else { | 429 } else { |
419 [visualEffectView setState:NSVisualEffectStateFollowsWindowActiveState]; | 430 [visualEffectView setState:NSVisualEffectStateFollowsWindowActiveState]; |
420 } | 431 } |
421 } | 432 } |
422 | 433 |
423 - (void)windowDidChangeActive { | 434 - (void)windowDidChangeActive { |
424 [self setNeedsDisplay:YES]; | 435 [self setNeedsDisplay:YES]; |
425 } | 436 } |
426 | 437 |
427 @end | 438 @end |
OLD | NEW |