Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "ui/message_center/cocoa/popup_controller.h" | 5 #import "ui/message_center/cocoa/popup_controller.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #import "base/mac/foundation_util.h" | 9 #import "base/mac/foundation_util.h" |
| 10 #import "base/mac/sdk_forward_declarations.h" | 10 #import "base/mac/sdk_forward_declarations.h" |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 24 // |boundsAnimation_|. | 24 // |boundsAnimation_|. |
| 25 - (void)setBoundsAnimation:(NSViewAnimation*)animation; | 25 - (void)setBoundsAnimation:(NSViewAnimation*)animation; |
| 26 | 26 |
| 27 // Constructs an NSViewAnimation from |dictionary|, which should be a view | 27 // Constructs an NSViewAnimation from |dictionary|, which should be a view |
| 28 // animation dictionary. | 28 // animation dictionary. |
| 29 - (NSViewAnimation*)animationWithDictionary:(NSDictionary*)dictionary; | 29 - (NSViewAnimation*)animationWithDictionary:(NSDictionary*)dictionary; |
| 30 @end | 30 @end |
| 31 | 31 |
| 32 // Window Subclass ///////////////////////////////////////////////////////////// | 32 // Window Subclass ///////////////////////////////////////////////////////////// |
| 33 | 33 |
| 34 @interface MCPopupWindow : NSWindow { | 34 @interface MCPopupWindow : NSPanel { |
| 35 // The cumulative X and Y scrollingDeltas since the -scrollWheel: event began. | 35 // The cumulative X and Y scrollingDeltas since the -scrollWheel: event began. |
| 36 NSPoint totalScrollDelta_; | 36 NSPoint totalScrollDelta_; |
| 37 } | 37 } |
| 38 @end | 38 @end |
| 39 | 39 |
| 40 @implementation MCPopupWindow | 40 @implementation MCPopupWindow |
| 41 | 41 |
| 42 - (void)scrollWheel:(NSEvent*)event { | 42 - (void)scrollWheel:(NSEvent*)event { |
| 43 // Gesture swiping only exists on 10.7+. | 43 // Gesture swiping only exists on 10.7+. |
| 44 if (![event respondsToSelector:@selector(phase)]) | 44 if (![event respondsToSelector:@selector(phase)]) |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 | 91 |
| 92 @end | 92 @end |
| 93 | 93 |
| 94 //////////////////////////////////////////////////////////////////////////////// | 94 //////////////////////////////////////////////////////////////////////////////// |
| 95 | 95 |
| 96 @implementation MCPopupController | 96 @implementation MCPopupController |
| 97 | 97 |
| 98 - (id)initWithNotification:(const message_center::Notification*)notification | 98 - (id)initWithNotification:(const message_center::Notification*)notification |
| 99 messageCenter:(message_center::MessageCenter*)messageCenter | 99 messageCenter:(message_center::MessageCenter*)messageCenter |
| 100 popupCollection:(MCPopupCollection*)popupCollection { | 100 popupCollection:(MCPopupCollection*)popupCollection { |
| 101 base::scoped_nsobject<MCPopupWindow> window( | 101 base::scoped_nsobject<MCPopupWindow> window([[MCPopupWindow alloc] |
| 102 [[MCPopupWindow alloc] initWithContentRect:ui::kWindowSizeDeterminedLater | 102 initWithContentRect:ui::kWindowSizeDeterminedLater |
| 103 styleMask:NSBorderlessWindowMask | 103 styleMask:NSNonactivatingPanelMask |
| 104 backing:NSBackingStoreBuffered | 104 backing:NSBackingStoreBuffered |
| 105 defer:NO]); | 105 defer:NO]); |
| 106 if ((self = [super initWithWindow:window])) { | 106 if ((self = [super initWithWindow:window])) { |
| 107 messageCenter_ = messageCenter; | 107 messageCenter_ = messageCenter; |
| 108 popupCollection_ = popupCollection; | 108 popupCollection_ = popupCollection; |
| 109 notificationController_.reset( | 109 notificationController_.reset( |
| 110 [[MCNotificationController alloc] initWithNotification:notification | 110 [[MCNotificationController alloc] initWithNotification:notification |
| 111 messageCenter:messageCenter_]); | 111 messageCenter:messageCenter_]); |
| 112 isClosing_ = NO; | |
| 113 bounds_ = [[notificationController_ view] frame]; | 112 bounds_ = [[notificationController_ view] frame]; |
| 114 | 113 |
| 115 [window setReleasedWhenClosed:NO]; | 114 [window setFloatingPanel:YES]; |
| 116 | 115 [window setBecomesKeyOnlyIfNeeded:YES]; |
|
tapted
2016/10/11 03:55:44
ah-ha! So If I comment out this line, then crbug.c
| |
| 117 [window setLevel:NSFloatingWindowLevel]; | |
| 118 [window setExcludedFromWindowsMenu:YES]; | |
| 119 [window | 116 [window |
| 120 setCollectionBehavior:NSWindowCollectionBehaviorCanJoinAllSpaces | | 117 setCollectionBehavior:NSWindowCollectionBehaviorCanJoinAllSpaces | |
| 121 NSWindowCollectionBehaviorIgnoresCycle | | |
| 122 NSWindowCollectionBehaviorFullScreenAuxiliary]; | 118 NSWindowCollectionBehaviorFullScreenAuxiliary]; |
| 123 | 119 |
| 124 [window setHasShadow:YES]; | 120 [window setHasShadow:YES]; |
| 125 [window setContentView:[notificationController_ view]]; | 121 [window setContentView:[notificationController_ view]]; |
| 126 | 122 |
| 127 trackingArea_.reset( | 123 trackingArea_.reset( |
| 128 [[CrTrackingArea alloc] initWithRect:NSZeroRect | 124 [[CrTrackingArea alloc] initWithRect:NSZeroRect |
| 129 options:NSTrackingInVisibleRect | | 125 options:NSTrackingInVisibleRect | |
| 130 NSTrackingMouseEnteredAndExited | | 126 NSTrackingMouseEnteredAndExited | |
| 131 NSTrackingActiveAlways | 127 NSTrackingActiveAlways |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 291 | 287 |
| 292 - (void)mouseEntered:(NSEvent*)event { | 288 - (void)mouseEntered:(NSEvent*)event { |
| 293 messageCenter_->PausePopupTimers(); | 289 messageCenter_->PausePopupTimers(); |
| 294 } | 290 } |
| 295 | 291 |
| 296 - (void)mouseExited:(NSEvent*)event { | 292 - (void)mouseExited:(NSEvent*)event { |
| 297 messageCenter_->RestartPopupTimers(); | 293 messageCenter_->RestartPopupTimers(); |
| 298 } | 294 } |
| 299 | 295 |
| 300 @end | 296 @end |
| OLD | NEW |