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