| 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 #ifndef UI_MESSAGE_CENTER_COCOA_POPUP_CONTROLLER_H_ | 5 #ifndef UI_MESSAGE_CENTER_COCOA_POPUP_CONTROLLER_H_ |
| 6 #define UI_MESSAGE_CENTER_COCOA_POPUP_CONTROLLER_H_ | 6 #define UI_MESSAGE_CENTER_COCOA_POPUP_CONTROLLER_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #import "base/memory/scoped_nsobject.h" | 12 #import "base/mac/scoped_nsobject.h" |
| 13 #import "ui/base/cocoa/tracking_area.h" | 13 #import "ui/base/cocoa/tracking_area.h" |
| 14 #include "ui/message_center/message_center_export.h" | 14 #include "ui/message_center/message_center_export.h" |
| 15 | 15 |
| 16 namespace message_center { | 16 namespace message_center { |
| 17 class MessageCenter; | 17 class MessageCenter; |
| 18 class Notification; | 18 class Notification; |
| 19 } | 19 } |
| 20 | 20 |
| 21 @class MCNotificationController; | 21 @class MCNotificationController; |
| 22 @class MCPopupCollection; | 22 @class MCPopupCollection; |
| 23 | 23 |
| 24 // A window controller that hosts a notification as a popup balloon on the | 24 // A window controller that hosts a notification as a popup balloon on the |
| 25 // user's desktop. The window controller manages its lifetime because the | 25 // user's desktop. The window controller manages its lifetime because the |
| 26 // popup collection will be destructed when the last popup is closed. | 26 // popup collection will be destructed when the last popup is closed. |
| 27 MESSAGE_CENTER_EXPORT | 27 MESSAGE_CENTER_EXPORT |
| 28 @interface MCPopupController : NSWindowController<NSAnimationDelegate> { | 28 @interface MCPopupController : NSWindowController<NSAnimationDelegate> { |
| 29 @private | 29 @private |
| 30 // Global message center. Weak. | 30 // Global message center. Weak. |
| 31 message_center::MessageCenter* messageCenter_; | 31 message_center::MessageCenter* messageCenter_; |
| 32 | 32 |
| 33 // The collection that contains the popup. Weak. | 33 // The collection that contains the popup. Weak. |
| 34 MCPopupCollection* popupCollection_; | 34 MCPopupCollection* popupCollection_; |
| 35 | 35 |
| 36 // The view controller that provide's the popup content view. | 36 // The view controller that provide's the popup content view. |
| 37 scoped_nsobject<MCNotificationController> notificationController_; | 37 base::scoped_nsobject<MCNotificationController> notificationController_; |
| 38 | 38 |
| 39 // If the swipe-away gesture received NSEventPhaseEnded. | 39 // If the swipe-away gesture received NSEventPhaseEnded. |
| 40 BOOL swipeGestureEnded_; | 40 BOOL swipeGestureEnded_; |
| 41 | 41 |
| 42 // The frame of the popup before any swipe animation started. Used to | 42 // The frame of the popup before any swipe animation started. Used to |
| 43 // calculate the animating position of the window when swiping away. | 43 // calculate the animating position of the window when swiping away. |
| 44 NSRect originalFrame_; | 44 NSRect originalFrame_; |
| 45 | 45 |
| 46 // Is the popup currently being closed? | 46 // Is the popup currently being closed? |
| 47 BOOL isClosing_; | 47 BOOL isClosing_; |
| 48 | 48 |
| 49 // The current bounds of the popup frame if no animation is playing. | 49 // The current bounds of the popup frame if no animation is playing. |
| 50 // Otherwise, it is the target bounds of the popup frame. | 50 // Otherwise, it is the target bounds of the popup frame. |
| 51 NSRect bounds_; | 51 NSRect bounds_; |
| 52 | 52 |
| 53 // Used to play animation when the popup shows, changes bounds and closes. | 53 // Used to play animation when the popup shows, changes bounds and closes. |
| 54 scoped_nsobject<NSViewAnimation> boundsAnimation_; | 54 base::scoped_nsobject<NSViewAnimation> boundsAnimation_; |
| 55 | 55 |
| 56 // Used to track the popup for mouse entered and exited events. | 56 // Used to track the popup for mouse entered and exited events. |
| 57 ui::ScopedCrTrackingArea trackingArea_; | 57 ui::ScopedCrTrackingArea trackingArea_; |
| 58 } | 58 } |
| 59 | 59 |
| 60 // Designated initializer. | 60 // Designated initializer. |
| 61 - (id)initWithNotification:(const message_center::Notification*)notification | 61 - (id)initWithNotification:(const message_center::Notification*)notification |
| 62 messageCenter:(message_center::MessageCenter*)messageCenter | 62 messageCenter:(message_center::MessageCenter*)messageCenter |
| 63 popupCollection:(MCPopupCollection*)popupCollection; | 63 popupCollection:(MCPopupCollection*)popupCollection; |
| 64 | 64 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 85 // Returns the window bounds. This is the target bounds to go to if the bounds | 85 // Returns the window bounds. This is the target bounds to go to if the bounds |
| 86 // animation is playing. | 86 // animation is playing. |
| 87 - (NSRect)bounds; | 87 - (NSRect)bounds; |
| 88 | 88 |
| 89 // Changes the window bounds with animation. | 89 // Changes the window bounds with animation. |
| 90 - (void)setBounds:(NSRect)newBounds; | 90 - (void)setBounds:(NSRect)newBounds; |
| 91 | 91 |
| 92 @end | 92 @end |
| 93 | 93 |
| 94 #endif // UI_MESSAGE_CENTER_COCOA_POPUP_CONTROLLER_H_ | 94 #endif // UI_MESSAGE_CENTER_COCOA_POPUP_CONTROLLER_H_ |
| OLD | NEW |