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_TRAY_VIEW_CONTROLLER_H_ | 5 #ifndef UI_MESSAGE_CENTER_COCOA_TRAY_VIEW_CONTROLLER_H_ |
6 #define UI_MESSAGE_CENTER_COCOA_TRAY_VIEW_CONTROLLER_H_ | 6 #define UI_MESSAGE_CENTER_COCOA_TRAY_VIEW_CONTROLLER_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 #include <list> | 10 #include <list> |
11 #include <map> | 11 #include <map> |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 #include "base/mac/scoped_block.h" | 14 #include "base/mac/scoped_block.h" |
15 #import "base/memory/scoped_nsobject.h" | 15 #import "base/mac/scoped_nsobject.h" |
16 #include "ui/message_center/message_center_export.h" | 16 #include "ui/message_center/message_center_export.h" |
17 | 17 |
18 @class HoverImageButton; | 18 @class HoverImageButton; |
19 @class MCNotificationController; | 19 @class MCNotificationController; |
20 @class MCSettingsController; | 20 @class MCSettingsController; |
21 | 21 |
22 namespace message_center { | 22 namespace message_center { |
23 class MessageCenter; | 23 class MessageCenter; |
24 } | 24 } |
25 | 25 |
26 @class HoverImageButton; | 26 @class HoverImageButton; |
27 @class MCClipView; | 27 @class MCClipView; |
28 | 28 |
29 namespace message_center { | 29 namespace message_center { |
30 typedef void(^TrayAnimationEndedCallback)(); | 30 typedef void(^TrayAnimationEndedCallback)(); |
31 } | 31 } |
32 | 32 |
33 // The view controller responsible for the content of the message center tray | 33 // The view controller responsible for the content of the message center tray |
34 // UI. This hosts a scroll view of all the notifications, as well as buttons | 34 // UI. This hosts a scroll view of all the notifications, as well as buttons |
35 // to enter quiet mode and the settings panel. | 35 // to enter quiet mode and the settings panel. |
36 MESSAGE_CENTER_EXPORT | 36 MESSAGE_CENTER_EXPORT |
37 @interface MCTrayViewController : NSViewController<NSAnimationDelegate> { | 37 @interface MCTrayViewController : NSViewController<NSAnimationDelegate> { |
38 @private | 38 @private |
39 // Controller of the notifications, where action messages are forwarded. Weak. | 39 // Controller of the notifications, where action messages are forwarded. Weak. |
40 message_center::MessageCenter* messageCenter_; | 40 message_center::MessageCenter* messageCenter_; |
41 | 41 |
42 // The back button shown while the settings are open. | 42 // The back button shown while the settings are open. |
43 scoped_nsobject<HoverImageButton> backButton_; | 43 base::scoped_nsobject<HoverImageButton> backButton_; |
44 | 44 |
45 // The "Notifications" label at the top. | 45 // The "Notifications" label at the top. |
46 scoped_nsobject<NSTextField> title_; | 46 base::scoped_nsobject<NSTextField> title_; |
47 | 47 |
48 // The scroll view that contains all the notifications in its documentView. | 48 // The scroll view that contains all the notifications in its documentView. |
49 scoped_nsobject<NSScrollView> scrollView_; | 49 base::scoped_nsobject<NSScrollView> scrollView_; |
50 | 50 |
51 // The clip view that manages how scrollView_'s documentView is clipped. | 51 // The clip view that manages how scrollView_'s documentView is clipped. |
52 scoped_nsobject<MCClipView> clipView_; | 52 base::scoped_nsobject<MCClipView> clipView_; |
53 | 53 |
54 // Array of MCNotificationController objects, which the array owns. | 54 // Array of MCNotificationController objects, which the array owns. |
55 scoped_nsobject<NSMutableArray> notifications_; | 55 base::scoped_nsobject<NSMutableArray> notifications_; |
56 | 56 |
57 // Map of notification IDs to weak pointers of the view controllers in | 57 // Map of notification IDs to weak pointers of the view controllers in |
58 // |notifications_|. | 58 // |notifications_|. |
59 std::map<std::string, MCNotificationController*> notificationsMap_; | 59 std::map<std::string, MCNotificationController*> notificationsMap_; |
60 | 60 |
61 // The pause button that enters quiet mode. | 61 // The pause button that enters quiet mode. |
62 scoped_nsobject<HoverImageButton> pauseButton_; | 62 base::scoped_nsobject<HoverImageButton> pauseButton_; |
63 | 63 |
64 // The clear all notifications button. Hidden when there are no notifications. | 64 // The clear all notifications button. Hidden when there are no notifications. |
65 scoped_nsobject<HoverImageButton> clearAllButton_; | 65 base::scoped_nsobject<HoverImageButton> clearAllButton_; |
66 | 66 |
67 // The settings button that shows the settings UI. | 67 // The settings button that shows the settings UI. |
68 scoped_nsobject<HoverImageButton> settingsButton_; | 68 base::scoped_nsobject<HoverImageButton> settingsButton_; |
69 | 69 |
70 // Array of MCNotificationController objects pending removal by the user. | 70 // Array of MCNotificationController objects pending removal by the user. |
71 // The object is owned by the array. | 71 // The object is owned by the array. |
72 scoped_nsobject<NSMutableArray> notificationsPendingRemoval_; | 72 base::scoped_nsobject<NSMutableArray> notificationsPendingRemoval_; |
73 | 73 |
74 // Used to animate multiple notifications simultaneously when they're being | 74 // Used to animate multiple notifications simultaneously when they're being |
75 // removed or repositioned. | 75 // removed or repositioned. |
76 scoped_nsobject<NSViewAnimation> animation_; | 76 base::scoped_nsobject<NSViewAnimation> animation_; |
77 | 77 |
78 // The controller of the settings view. Only set while the view is open. | 78 // The controller of the settings view. Only set while the view is open. |
79 scoped_nsobject<MCSettingsController> settingsController_; | 79 base::scoped_nsobject<MCSettingsController> settingsController_; |
80 | 80 |
81 // The flag which is set when the notification removal animation is still | 81 // The flag which is set when the notification removal animation is still |
82 // in progress and the user clicks "Clear All" button. The clear-all animation | 82 // in progress and the user clicks "Clear All" button. The clear-all animation |
83 // will be delayed till the existing animation completes. | 83 // will be delayed till the existing animation completes. |
84 BOOL clearAllDelayed_; | 84 BOOL clearAllDelayed_; |
85 | 85 |
86 // The flag which is set when the clear-all animation is in progress. | 86 // The flag which is set when the clear-all animation is in progress. |
87 BOOL clearAllInProgress_; | 87 BOOL clearAllInProgress_; |
88 | 88 |
89 // List of weak pointers of the view controllers that are visible in the | 89 // List of weak pointers of the view controllers that are visible in the |
90 // scroll view and waiting to slide off one by one when the user clicks | 90 // scroll view and waiting to slide off one by one when the user clicks |
91 // "Clear All" button. | 91 // "Clear All" button. |
92 std::list<MCNotificationController*> visibleNotificationsPendingClear_; | 92 std::list<MCNotificationController*> visibleNotificationsPendingClear_; |
93 | 93 |
94 // Array of NSViewAnimation objects, which the array owns. | 94 // Array of NSViewAnimation objects, which the array owns. |
95 scoped_nsobject<NSMutableArray> clearAllAnimations_; | 95 base::scoped_nsobject<NSMutableArray> clearAllAnimations_; |
96 | 96 |
97 // The duration of the bounds animation, in the number of seconds. | 97 // The duration of the bounds animation, in the number of seconds. |
98 NSTimeInterval animationDuration_; | 98 NSTimeInterval animationDuration_; |
99 | 99 |
100 // The delay to start animating clearing next notification, in the number of | 100 // The delay to start animating clearing next notification, in the number of |
101 // seconds. | 101 // seconds. |
102 NSTimeInterval animateClearingNextNotificationDelay_; | 102 NSTimeInterval animateClearingNextNotificationDelay_; |
103 | 103 |
104 // For testing only. If set, the callback will be called when the animation | 104 // For testing only. If set, the callback will be called when the animation |
105 // ends. | 105 // ends. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 // it to a very small value to expedite the test running. | 157 // it to a very small value to expedite the test running. |
158 - (void)setAnimateClearingNextNotificationDelay:(NSTimeInterval)delay; | 158 - (void)setAnimateClearingNextNotificationDelay:(NSTimeInterval)delay; |
159 | 159 |
160 // Setter for testingAnimationEndedCallback_. The testing code could set it | 160 // Setter for testingAnimationEndedCallback_. The testing code could set it |
161 // to get called back when the animation ends. | 161 // to get called back when the animation ends. |
162 - (void)setAnimationEndedCallback: | 162 - (void)setAnimationEndedCallback: |
163 (message_center::TrayAnimationEndedCallback)callback; | 163 (message_center::TrayAnimationEndedCallback)callback; |
164 @end | 164 @end |
165 | 165 |
166 #endif // UI_MESSAGE_CENTER_COCOA_TRAY_VIEW_CONTROLLER_H_ | 166 #endif // UI_MESSAGE_CENTER_COCOA_TRAY_VIEW_CONTROLLER_H_ |
OLD | NEW |