| 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/memory/scoped_nsobject.h" |
| 13 #include "ui/message_center/message_center_export.h" | 13 #include "ui/message_center/message_center_export.h" |
| 14 | 14 |
| 15 namespace message_center { | 15 namespace message_center { |
| 16 class MessageCenter; | 16 class MessageCenter; |
| 17 class Notification; | 17 class Notification; |
| 18 } | 18 } |
| 19 | 19 |
| 20 @class MCNotificationController; | 20 @class MCNotificationController; |
| 21 | 21 |
| 22 // A window controller that hosts a notification as a popup balloon on the | 22 // A window controller that hosts a notification as a popup balloon on the |
| 23 // user's desktop. Unlike most window controllers, this does not own itself and | 23 // user's desktop. Unlike most window controllers, this does not own itself and |
| 24 // its lifetime must be managed manually. | 24 // its lifetime must be managed manually. |
| 25 MESSAGE_CENTER_EXPORT | 25 MESSAGE_CENTER_EXPORT |
| 26 @interface MCPopupController : NSWindowController { | 26 @interface MCPopupController : NSWindowController { |
| 27 @private | 27 @private |
| 28 // Global message center. Weak. |
| 29 message_center::MessageCenter* messageCenter_; |
| 30 |
| 31 // The view controller that provide's the popup content view. |
| 28 scoped_nsobject<MCNotificationController> notificationController_; | 32 scoped_nsobject<MCNotificationController> notificationController_; |
| 33 |
| 34 // If the swipe-away gesture received NSEventPhaseEnded. |
| 35 BOOL swipeGestureEnded_; |
| 36 |
| 37 // The frame of the popup before any swipe animation started. Used to |
| 38 // calculate the animating position of the window when swiping away. |
| 39 NSRect originalFrame_; |
| 29 } | 40 } |
| 30 | 41 |
| 31 // Designated initializer. | 42 // Designated initializer. |
| 32 - (id)initWithNotification:(const message_center::Notification*)notification | 43 - (id)initWithNotification:(const message_center::Notification*)notification |
| 33 messageCenter:(message_center::MessageCenter*)messageCenter; | 44 messageCenter:(message_center::MessageCenter*)messageCenter; |
| 34 | 45 |
| 35 // Accessor for the view controller. | 46 // Accessor for the view controller. |
| 36 - (MCNotificationController*)notificationController; | 47 - (MCNotificationController*)notificationController; |
| 37 | 48 |
| 38 // Accessor for the notification model object. | 49 // Accessor for the notification model object. |
| 39 - (const message_center::Notification*)notification; | 50 - (const message_center::Notification*)notification; |
| 40 | 51 |
| 41 // Gets the notification ID. This string is owned by the NotificationController | 52 // Gets the notification ID. This string is owned by the NotificationController |
| 42 // rather than the model object, so it's safe to use after the Notification has | 53 // rather than the model object, so it's safe to use after the Notification has |
| 43 // been deleted. | 54 // been deleted. |
| 44 - (const std::string&)notificationID; | 55 - (const std::string&)notificationID; |
| 45 | 56 |
| 46 @end | 57 @end |
| 47 | 58 |
| 48 #endif // UI_MESSAGE_CENTER_COCOA_POPUP_CONTROLLER_H_ | 59 #endif // UI_MESSAGE_CENTER_COCOA_POPUP_CONTROLLER_H_ |
| OLD | NEW |