| 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_COLLECTION_H_ | 5 #ifndef UI_MESSAGE_CENTER_COCOA_POPUP_COLLECTION_H_ |
| 6 #define UI_MESSAGE_CENTER_COCOA_POPUP_COLLECTION_H_ | 6 #define UI_MESSAGE_CENTER_COCOA_POPUP_COLLECTION_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #include <set> | 10 #include <set> |
| 11 | 11 |
| 12 #include "base/mac/scoped_block.h" | 12 #include "base/mac/scoped_block.h" |
| 13 #import "base/memory/scoped_nsobject.h" | 13 #import "base/mac/scoped_nsobject.h" |
| 14 #import "base/memory/scoped_ptr.h" | 14 #import "base/memory/scoped_ptr.h" |
| 15 #include "ui/message_center/message_center_export.h" | 15 #include "ui/message_center/message_center_export.h" |
| 16 | 16 |
| 17 namespace message_center { | 17 namespace message_center { |
| 18 class MessageCenter; | 18 class MessageCenter; |
| 19 class MessageCenterObserver; | 19 class MessageCenterObserver; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace message_center { | 22 namespace message_center { |
| 23 typedef void(^AnimationEndedCallback)(); | 23 typedef void(^AnimationEndedCallback)(); |
| 24 } | 24 } |
| 25 | 25 |
| 26 // A popup collection interfaces with the MessageCenter as an observer. It will | 26 // A popup collection interfaces with the MessageCenter as an observer. It will |
| 27 // arrange notifications on the screen as popups, starting in the upper-right | 27 // arrange notifications on the screen as popups, starting in the upper-right |
| 28 // corner, going to the bottom of the screen. This class maintains ownership of | 28 // corner, going to the bottom of the screen. This class maintains ownership of |
| 29 // the Cocoa controllers and windows of the notifications. | 29 // the Cocoa controllers and windows of the notifications. |
| 30 MESSAGE_CENTER_EXPORT | 30 MESSAGE_CENTER_EXPORT |
| 31 @interface MCPopupCollection : NSObject { | 31 @interface MCPopupCollection : NSObject { |
| 32 @private | 32 @private |
| 33 // The message center that is responsible for the notifications. Weak, global. | 33 // The message center that is responsible for the notifications. Weak, global. |
| 34 message_center::MessageCenter* messageCenter_; | 34 message_center::MessageCenter* messageCenter_; |
| 35 | 35 |
| 36 // MessageCenterObserver implementation. | 36 // MessageCenterObserver implementation. |
| 37 scoped_ptr<message_center::MessageCenterObserver> observer_; | 37 scoped_ptr<message_center::MessageCenterObserver> observer_; |
| 38 | 38 |
| 39 // Array of all on-screen popup notifications. | 39 // Array of all on-screen popup notifications. |
| 40 scoped_nsobject<NSMutableArray> popups_; | 40 base::scoped_nsobject<NSMutableArray> popups_; |
| 41 | 41 |
| 42 // Array of all on-screen popup notifications that are being faded out | 42 // Array of all on-screen popup notifications that are being faded out |
| 43 // for removal. | 43 // for removal. |
| 44 scoped_nsobject<NSMutableArray> popupsBeingRemoved_; | 44 base::scoped_nsobject<NSMutableArray> popupsBeingRemoved_; |
| 45 | 45 |
| 46 // For testing only. If not a zero rect, this is the screen size to use | 46 // For testing only. If not a zero rect, this is the screen size to use |
| 47 // for laying out popups. | 47 // for laying out popups. |
| 48 NSRect testingScreenFrame_; | 48 NSRect testingScreenFrame_; |
| 49 | 49 |
| 50 // The duration of the popup animation, in the number of seconds. | 50 // The duration of the popup animation, in the number of seconds. |
| 51 NSTimeInterval popupAnimationDuration_; | 51 NSTimeInterval popupAnimationDuration_; |
| 52 | 52 |
| 53 // Set of notification IDs for those popups to be updated when all existing | 53 // Set of notification IDs for those popups to be updated when all existing |
| 54 // animations end. | 54 // animations end. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 // to a very small value to expedite the test running. | 92 // to a very small value to expedite the test running. |
| 93 - (void)setAnimationDuration:(NSTimeInterval)duration; | 93 - (void)setAnimationDuration:(NSTimeInterval)duration; |
| 94 | 94 |
| 95 // Setter for testingAnimationEndedCallback_. The testing code could set it | 95 // Setter for testingAnimationEndedCallback_. The testing code could set it |
| 96 // to get called back when the animation ends. | 96 // to get called back when the animation ends. |
| 97 - (void)setAnimationEndedCallback: | 97 - (void)setAnimationEndedCallback: |
| 98 (message_center::AnimationEndedCallback)callback; | 98 (message_center::AnimationEndedCallback)callback; |
| 99 @end | 99 @end |
| 100 | 100 |
| 101 #endif // UI_MESSAGE_CENTER_COCOA_POPUP_COLLECTION_H_ | 101 #endif // UI_MESSAGE_CENTER_COCOA_POPUP_COLLECTION_H_ |
| OLD | NEW |