| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_UI_COCOA_STATUS_BUBBLE_MAC_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_STATUS_BUBBLE_MAC_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_STATUS_BUBBLE_MAC_H_ | 6 #define CHROME_BROWSER_UI_COCOA_STATUS_BUBBLE_MAC_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #import <Cocoa/Cocoa.h> | 10 #import <Cocoa/Cocoa.h> |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 void StartShowing(); | 116 void StartShowing(); |
| 117 void StartHiding(); | 117 void StartHiding(); |
| 118 | 118 |
| 119 // Cancel the expansion timer. | 119 // Cancel the expansion timer. |
| 120 void CancelExpandTimer(); | 120 void CancelExpandTimer(); |
| 121 | 121 |
| 122 // Sets the frame of the status bubble window to |window_frame|, adjusting | 122 // Sets the frame of the status bubble window to |window_frame|, adjusting |
| 123 // for the given mouse position if necessary. Protected for use in tests. | 123 // for the given mouse position if necessary. Protected for use in tests. |
| 124 void SetFrameAvoidingMouse(NSRect window_frame, const gfx::Point& mouse_pos); | 124 void SetFrameAvoidingMouse(NSRect window_frame, const gfx::Point& mouse_pos); |
| 125 | 125 |
| 126 // The factory used to generate weak pointers for the show and hide delay | |
| 127 // timers. | |
| 128 base::WeakPtrFactory<StatusBubbleMac> timer_factory_; | |
| 129 | |
| 130 // The factory used to generate weak pointers for the expansion delay timer. | |
| 131 base::WeakPtrFactory<StatusBubbleMac> expand_timer_factory_; | |
| 132 | |
| 133 // The factory used to generate weak pointers for the CAAnimation completion | |
| 134 // handlers. | |
| 135 base::WeakPtrFactory<StatusBubbleMac> completion_handler_factory_; | |
| 136 | |
| 137 // Calculate the appropriate frame for the status bubble window. If | 126 // Calculate the appropriate frame for the status bubble window. If |
| 138 // |expanded_width|, use entire width of parent frame. | 127 // |expanded_width|, use entire width of parent frame. |
| 139 NSRect CalculateWindowFrame(bool expanded_width); | 128 NSRect CalculateWindowFrame(bool expanded_width); |
| 140 | 129 |
| 141 // Returns the flags to be used to round the corners of the status bubble. | 130 // Returns the flags to be used to round the corners of the status bubble. |
| 142 // Before 10.7, windows have square bottom corners, but in 10.7, the bottom | 131 // Before 10.7, windows have square bottom corners, but in 10.7, the bottom |
| 143 // corners are rounded. This method considers the bubble's placement (as | 132 // corners are rounded. This method considers the bubble's placement (as |
| 144 // proposed in window_frame) relative to its parent window in determining | 133 // proposed in window_frame) relative to its parent window in determining |
| 145 // which flags to return. This function may choose to round any corner, | 134 // which flags to return. This function may choose to round any corner, |
| 146 // including top corners. Note that there may be other reasons that a | 135 // including top corners. Note that there may be other reasons that a |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 // with no hover delay. | 167 // with no hover delay. |
| 179 bool is_expanded_; | 168 bool is_expanded_; |
| 180 | 169 |
| 181 // The original, non-elided URL. | 170 // The original, non-elided URL. |
| 182 GURL url_; | 171 GURL url_; |
| 183 | 172 |
| 184 // Needs to be passed to ElideURL if the original URL string is wider than | 173 // Needs to be passed to ElideURL if the original URL string is wider than |
| 185 // the standard bubble width. | 174 // the standard bubble width. |
| 186 std::string languages_; | 175 std::string languages_; |
| 187 | 176 |
| 177 // The factory used to generate weak pointers for the show and hide delay |
| 178 // timers. |
| 179 base::WeakPtrFactory<StatusBubbleMac> timer_factory_; |
| 180 |
| 181 // The factory used to generate weak pointers for the expansion delay timer. |
| 182 base::WeakPtrFactory<StatusBubbleMac> expand_timer_factory_; |
| 183 |
| 184 // The factory used to generate weak pointers for the CAAnimation completion |
| 185 // handlers. |
| 186 base::WeakPtrFactory<StatusBubbleMac> completion_handler_factory_; |
| 187 |
| 188 DISALLOW_COPY_AND_ASSIGN(StatusBubbleMac); | 188 DISALLOW_COPY_AND_ASSIGN(StatusBubbleMac); |
| 189 }; | 189 }; |
| 190 | 190 |
| 191 // Delegate interface | 191 // Delegate interface |
| 192 @interface NSObject(StatusBubbleDelegate) | 192 @interface NSObject(StatusBubbleDelegate) |
| 193 // Called to query the delegate about the frame StatusBubble should position | 193 // Called to query the delegate about the frame StatusBubble should position |
| 194 // itself in. Frame is returned in the parent window coordinates. | 194 // itself in. Frame is returned in the parent window coordinates. |
| 195 - (NSRect)statusBubbleBaseFrame; | 195 - (NSRect)statusBubbleBaseFrame; |
| 196 | 196 |
| 197 // Called from SetState to notify the delegate of state changes. | 197 // Called from SetState to notify the delegate of state changes. |
| 198 - (void)statusBubbleWillEnterState:(StatusBubbleMac::StatusBubbleState)state; | 198 - (void)statusBubbleWillEnterState:(StatusBubbleMac::StatusBubbleState)state; |
| 199 @end | 199 @end |
| 200 | 200 |
| 201 #endif // CHROME_BROWSER_UI_COCOA_STATUS_BUBBLE_MAC_H_ | 201 #endif // CHROME_BROWSER_UI_COCOA_STATUS_BUBBLE_MAC_H_ |
| OLD | NEW |