| 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_NOTIFICATION_CONTROLLER_H_ | 5 #ifndef UI_MESSAGE_CENTER_COCOA_NOTIFICATION_CONTROLLER_H_ |
| 6 #define UI_MESSAGE_CENTER_COCOA_NOTIFICATION_CONTROLLER_H_ | 6 #define UI_MESSAGE_CENTER_COCOA_NOTIFICATION_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 #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 HoverImageButton; | 20 @class HoverImageButton; |
| 21 | 21 |
| 22 // The base view controller class for notifications. A notification at minimum | 22 // The base view controller class for notifications. A notification at minimum |
| 23 // has an image, title, body, and close button. This controller can be used as | 23 // has an image, title, body, and close button. This controller can be used as |
| 24 // the content for both a popup bubble and a view in the notification tray. | 24 // the content for both a popup bubble and a view in the notification tray. |
| 25 MESSAGE_CENTER_EXPORT | 25 MESSAGE_CENTER_EXPORT |
| 26 @interface MCNotificationController : NSViewController { | 26 @interface MCNotificationController : NSViewController { |
| 27 @protected | 27 @protected |
| 28 // The message object. Weak. | 28 // The message object. Weak. |
| 29 const message_center::Notification* notification_; | 29 const message_center::Notification* notification_; |
| 30 | 30 |
| 31 // A copy of the notification ID. | 31 // A copy of the notification ID. |
| 32 std::string notificationID_; | 32 std::string notificationID_; |
| 33 | 33 |
| 34 // Controller of the notifications, where action messages are forwarded. Weak. | 34 // Controller of the notifications, where action messages are forwarded. Weak. |
| 35 message_center::MessageCenter* messageCenter_; | 35 message_center::MessageCenter* messageCenter_; |
| 36 | 36 |
| 37 // The button that invokes |-close:|, in the upper-right corner. | 37 // The button that invokes |-close:|, in the upper-right corner. |
| 38 scoped_nsobject<HoverImageButton> closeButton_; | 38 base::scoped_nsobject<HoverImageButton> closeButton_; |
| 39 | 39 |
| 40 // The large icon associated with the notification, on the left side. | 40 // The large icon associated with the notification, on the left side. |
| 41 scoped_nsobject<NSImageView> icon_; | 41 base::scoped_nsobject<NSImageView> icon_; |
| 42 | 42 |
| 43 // The title of the message. | 43 // The title of the message. |
| 44 scoped_nsobject<NSTextField> title_; | 44 base::scoped_nsobject<NSTextField> title_; |
| 45 | 45 |
| 46 // Body text of the message. | 46 // Body text of the message. |
| 47 scoped_nsobject<NSTextField> message_; | 47 base::scoped_nsobject<NSTextField> message_; |
| 48 | 48 |
| 49 // Container for optional list item views. | 49 // Container for optional list item views. |
| 50 scoped_nsobject<NSView> listItemView_; | 50 base::scoped_nsobject<NSView> listItemView_; |
| 51 | 51 |
| 52 // Container for optional items at the bottom of the notification. | 52 // Container for optional items at the bottom of the notification. |
| 53 scoped_nsobject<NSView> bottomView_; | 53 base::scoped_nsobject<NSView> bottomView_; |
| 54 } | 54 } |
| 55 | 55 |
| 56 // Creates a new controller for a given notification. | 56 // Creates a new controller for a given notification. |
| 57 - (id)initWithNotification:(const message_center::Notification*)notification | 57 - (id)initWithNotification:(const message_center::Notification*)notification |
| 58 messageCenter:(message_center::MessageCenter*)messageCenter; | 58 messageCenter:(message_center::MessageCenter*)messageCenter; |
| 59 | 59 |
| 60 // If the model object changes, this method will update the views to reflect | 60 // If the model object changes, this method will update the views to reflect |
| 61 // the new model object. Returns the updated frame of the notification. | 61 // the new model object. Returns the updated frame of the notification. |
| 62 - (NSRect)updateNotification:(const message_center::Notification*)notification; | 62 - (NSRect)updateNotification:(const message_center::Notification*)notification; |
| 63 | 63 |
| 64 // Action for clicking on the notification's |closeButton_|. | 64 // Action for clicking on the notification's |closeButton_|. |
| 65 - (void)close:(id)sender; | 65 - (void)close:(id)sender; |
| 66 | 66 |
| 67 // Accessor for the notification. | 67 // Accessor for the notification. |
| 68 - (const message_center::Notification*)notification; | 68 - (const message_center::Notification*)notification; |
| 69 | 69 |
| 70 // Gets the notification ID. This string is owned by the NotificationController | 70 // Gets the notification ID. This string is owned by the NotificationController |
| 71 // rather than the model object, so it's safe to use after the Notification has | 71 // rather than the model object, so it's safe to use after the Notification has |
| 72 // been deleted. | 72 // been deleted. |
| 73 - (const std::string&)notificationID; | 73 - (const std::string&)notificationID; |
| 74 | 74 |
| 75 // Called when the user clicks within the notification view. | 75 // Called when the user clicks within the notification view. |
| 76 - (void)notificationClicked; | 76 - (void)notificationClicked; |
| 77 | 77 |
| 78 @end | 78 @end |
| 79 | 79 |
| 80 #endif // UI_MESSAGE_CENTER_COCOA_NOTIFICATION_CONTROLLER_H_ | 80 #endif // UI_MESSAGE_CENTER_COCOA_NOTIFICATION_CONTROLLER_H_ |
| OLD | NEW |