OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
| 7 #import "base/mac/scoped_nsobject.h" |
7 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
8 #import "chrome/browser/ui/cocoa/chrome_event_processing_window.h" | 9 #import "chrome/browser/ui/cocoa/chrome_event_processing_window.h" |
9 | 10 |
10 class AppNotificationBridge; | 11 class AppNotificationBridge; |
| 12 @class WindowAnimationController; |
11 | 13 |
12 namespace info_bubble { | 14 namespace info_bubble { |
13 | 15 |
14 enum AnimationMask { | 16 enum AnimationMask { |
15 kAnimateNone = 0, | 17 kAnimateNone = 0, |
16 kAnimateOrderIn = 1 << 1, | 18 kAnimateOrderIn = 1 << 1, |
17 kAnimateOrderOut = 1 << 2, | 19 kAnimateOrderOut = 1 << 2, |
18 }; | 20 }; |
19 typedef NSUInteger AllowedAnimations; | 21 typedef NSUInteger AllowedAnimations; |
20 | 22 |
21 } // namespace info_bubble | 23 } // namespace info_bubble |
22 | 24 |
23 // A rounded window with an arrow used for example when you click on the STAR | 25 // A rounded window with an arrow used for example when you click on the STAR |
24 // button or that pops up within our first-run UI. | 26 // button or that pops up within our first-run UI. |
25 @interface InfoBubbleWindow : ChromeEventProcessingWindow { | 27 @interface InfoBubbleWindow : ChromeEventProcessingWindow { |
26 @private | 28 @private |
27 // Is self in the process of closing. | |
28 BOOL closing_; | |
29 | |
30 // Specifies if window order in and order out animations are allowed. By | 29 // Specifies if window order in and order out animations are allowed. By |
31 // default both types of animations are allowed. | 30 // default both types of animations are allowed. |
32 info_bubble::AllowedAnimations allowedAnimations_; | 31 info_bubble::AllowedAnimations allowedAnimations_; |
33 | 32 |
34 // If NO the window will never become key. | 33 // If NO the window will never become key. |
35 // Default YES. | 34 // Default YES. |
36 BOOL canBecomeKeyWindow_; | 35 BOOL canBecomeKeyWindow_; |
37 | 36 |
38 // If NO the window will not share key state with its parent. Defaults to YES. | 37 // If NO the window will not share key state with its parent. Defaults to YES. |
39 // Can be set both by external callers, but is also changed internally, in | 38 // Can be set both by external callers, but is also changed internally, in |
40 // response to resignKeyWindow and becomeKeyWindow events. | 39 // response to resignKeyWindow and becomeKeyWindow events. |
41 BOOL allowShareParentKeyState_; | 40 BOOL allowShareParentKeyState_; |
42 | 41 |
43 // Bridge to proxy Chrome notifications to the window. | 42 // Bridge to proxy Chrome notifications to the window. |
44 scoped_ptr<AppNotificationBridge> notificationBridge_; | 43 scoped_ptr<AppNotificationBridge> notificationBridge_; |
| 44 |
| 45 // Controller for closing the window (note: creates a reference cycle during |
| 46 // the close animation). |
| 47 base::scoped_nsobject<WindowAnimationController> animation_controller_; |
45 } | 48 } |
46 | 49 |
47 @property(nonatomic) info_bubble::AllowedAnimations allowedAnimations; | 50 @property(nonatomic) info_bubble::AllowedAnimations allowedAnimations; |
48 @property(nonatomic) BOOL canBecomeKeyWindow; | 51 @property(nonatomic) BOOL canBecomeKeyWindow; |
49 @property(nonatomic) BOOL allowShareParentKeyState; | 52 @property(nonatomic) BOOL allowShareParentKeyState; |
50 | 53 |
| 54 // Start the animation to hide the window, then close it. |
| 55 - (void)animateClose; |
| 56 |
51 // Returns YES if the window is in the process of closing. | 57 // Returns YES if the window is in the process of closing. |
52 // Can't use "windowWillClose" notification because that will be sent | 58 // Can't use "windowWillClose" notification because that will be sent |
53 // after the closing animation has completed. | 59 // after the closing animation has completed. |
54 - (BOOL)isClosing; | 60 - (BOOL)isClosing; |
55 | 61 |
56 @end | 62 @end |
OLD | NEW |