OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/notifications/balloon_view.h" | 5 #include "chrome/browser/ui/cocoa/notifications/balloon_view.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/memory/scoped_nsobject.h" | 10 #include "base/memory/scoped_nsobject.h" |
11 #import "chrome/browser/ui/cocoa/notifications/balloon_controller.h" | 11 #import "chrome/browser/ui/cocoa/notifications/balloon_controller.h" |
12 #import "third_party/GTM/AppKit/GTMNSBezierPath+RoundRect.h" | 12 #import "third_party/GTM/AppKit/GTMNSBezierPath+RoundRect.h" |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 const int kRoundedCornerSize = 6; | 16 const int kRoundedCornerSize = 6; |
17 | 17 |
18 } // namespace | 18 } // namespace |
19 | 19 |
20 @implementation BalloonWindow | 20 @implementation BalloonWindow |
21 - (id)initWithContentRect:(NSRect)contentRect | 21 - (id)initWithContentRect:(NSRect)contentRect |
22 styleMask:(unsigned int)aStyle | 22 styleMask:(NSUInteger)aStyle |
23 backing:(NSBackingStoreType)bufferingType | 23 backing:(NSBackingStoreType)bufferingType |
24 defer:(BOOL)flag { | 24 defer:(BOOL)flag { |
25 self = [super initWithContentRect:contentRect | 25 self = [super initWithContentRect:contentRect |
26 styleMask:NSBorderlessWindowMask | 26 styleMask:NSBorderlessWindowMask |
27 backing:NSBackingStoreBuffered | 27 backing:NSBackingStoreBuffered |
28 defer:NO]; | 28 defer:NO]; |
29 // Using NSModalPanelWindowLevel (8) rather then NSStatusWindowLevel (25) | 29 // Using NSModalPanelWindowLevel (8) rather then NSStatusWindowLevel (25) |
30 // ensures notification balloons on top of regular windows, but below | 30 // ensures notification balloons on top of regular windows, but below |
31 // popup menus which are at NSPopUpMenuWindowLevel (101) and Spotlight | 31 // popup menus which are at NSPopUpMenuWindowLevel (101) and Spotlight |
32 // drop-out, which is at NSStatusWindowLevel-2 (23) for OSX 10.6/7. | 32 // drop-out, which is at NSStatusWindowLevel-2 (23) for OSX 10.6/7. |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 - (void)mouseDown:(NSEvent*)event { | 92 - (void)mouseDown:(NSEvent*)event { |
93 [NSApp preventWindowOrdering]; | 93 [NSApp preventWindowOrdering]; |
94 // Continue bubbling the event up the chain of responders. | 94 // Continue bubbling the event up the chain of responders. |
95 [super mouseDown:event]; | 95 [super mouseDown:event]; |
96 } | 96 } |
97 | 97 |
98 - (BOOL)acceptsFirstMouse:(NSEvent*)event { | 98 - (BOOL)acceptsFirstMouse:(NSEvent*)event { |
99 return YES; | 99 return YES; |
100 } | 100 } |
101 @end | 101 @end |
OLD | NEW |