| 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 #include "chrome/browser/ui/cocoa/floating_bar_backing_view.h" | 5 #include "chrome/browser/ui/cocoa/floating_bar_backing_view.h" |
| 6 | 6 |
| 7 #include "base/mac/mac_util.h" | 7 #include "base/mac/mac_util.h" |
| 8 #import "chrome/browser/ui/cocoa/framed_browser_window.h" | 8 #import "chrome/browser/ui/cocoa/framed_browser_window.h" |
| 9 | 9 |
| 10 @implementation FloatingBarBackingView | 10 @implementation FloatingBarBackingView |
| 11 | 11 |
| 12 - (void)drawRect:(NSRect)rect { | 12 - (void)drawRect:(NSRect)rect { |
| 13 NSWindow* window = [self window]; | 13 NSWindow* window = [self window]; |
| 14 BOOL isMainWindow = [window isMainWindow]; | 14 BOOL isMainWindow = [window isMainWindow]; |
| 15 | 15 |
| 16 if (isMainWindow) | 16 if (isMainWindow) |
| 17 [[NSColor windowFrameColor] set]; | 17 [[NSColor windowFrameColor] set]; |
| 18 else | 18 else |
| 19 [[NSColor windowBackgroundColor] set]; | 19 [[NSColor windowBackgroundColor] set]; |
| 20 NSRectFill(rect); | 20 NSRectFill(rect); |
| 21 | 21 |
| 22 // TODO(rohitrao): Don't assume -22 here. | |
| 23 [FramedBrowserWindow drawWindowThemeInDirtyRect:rect | 22 [FramedBrowserWindow drawWindowThemeInDirtyRect:rect |
| 24 forView:self | 23 forView:self |
| 25 bounds:[self bounds] | 24 bounds:[self bounds] |
| 26 offset:NSMakePoint(0, -22) | |
| 27 forceBlackBackground:YES]; | 25 forceBlackBackground:YES]; |
| 28 | 26 |
| 29 } | 27 } |
| 30 | 28 |
| 31 // Eat all mouse events (and do *not* pass them on to the next responder!). | 29 // Eat all mouse events (and do *not* pass them on to the next responder!). |
| 32 - (void)mouseDown:(NSEvent*)event {} | 30 - (void)mouseDown:(NSEvent*)event {} |
| 33 - (void)rightMouseDown:(NSEvent*)event {} | 31 - (void)rightMouseDown:(NSEvent*)event {} |
| 34 - (void)otherMouseDown:(NSEvent*)event {} | 32 - (void)otherMouseDown:(NSEvent*)event {} |
| 35 - (void)rightMouseUp:(NSEvent*)event {} | 33 - (void)rightMouseUp:(NSEvent*)event {} |
| 36 - (void)otherMouseUp:(NSEvent*)event {} | 34 - (void)otherMouseUp:(NSEvent*)event {} |
| 37 - (void)mouseMoved:(NSEvent*)event {} | 35 - (void)mouseMoved:(NSEvent*)event {} |
| 38 - (void)mouseDragged:(NSEvent*)event {} | 36 - (void)mouseDragged:(NSEvent*)event {} |
| 39 - (void)rightMouseDragged:(NSEvent*)event {} | 37 - (void)rightMouseDragged:(NSEvent*)event {} |
| 40 - (void)otherMouseDragged:(NSEvent*)event {} | 38 - (void)otherMouseDragged:(NSEvent*)event {} |
| 41 | 39 |
| 42 // Eat this too, except that ... | 40 // Eat this too, except that ... |
| 43 - (void)mouseUp:(NSEvent*)event { | 41 - (void)mouseUp:(NSEvent*)event { |
| 44 // a double-click in the blank area should try to minimize, to be consistent | 42 // a double-click in the blank area should try to minimize, to be consistent |
| 45 // with double-clicks on the contiguous tab strip area. (It'll fail and beep.) | 43 // with double-clicks on the contiguous tab strip area. (It'll fail and beep.) |
| 46 if ([event clickCount] == 2 && | 44 if ([event clickCount] == 2 && |
| 47 base::mac::ShouldWindowsMiniaturizeOnDoubleClick()) | 45 base::mac::ShouldWindowsMiniaturizeOnDoubleClick()) |
| 48 [[self window] performMiniaturize:self]; | 46 [[self window] performMiniaturize:self]; |
| 49 } | 47 } |
| 50 | 48 |
| 51 @end // @implementation FloatingBarBackingView | 49 @end // @implementation FloatingBarBackingView |
| OLD | NEW |