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 21 matching lines...) Expand all Loading... |
32 kBubbleShown, // Fully visible | 32 kBubbleShown, // Fully visible |
33 kBubbleHidingTimer, // Waiting to fade out | 33 kBubbleHidingTimer, // Waiting to fade out |
34 kBubbleHidingFadeOut // In a fade-out transition | 34 kBubbleHidingFadeOut // In a fade-out transition |
35 }; | 35 }; |
36 | 36 |
37 StatusBubbleMac(NSWindow* parent, id delegate); | 37 StatusBubbleMac(NSWindow* parent, id delegate); |
38 ~StatusBubbleMac() override; | 38 ~StatusBubbleMac() override; |
39 | 39 |
40 // StatusBubble implementation. | 40 // StatusBubble implementation. |
41 void SetStatus(const base::string16& status) override; | 41 void SetStatus(const base::string16& status) override; |
42 void SetURL(const GURL& url, const std::string& languages) override; | 42 void SetURL(const GURL& url) override; |
43 void Hide() override; | 43 void Hide() override; |
44 void MouseMoved(const gfx::Point& location, bool left_content) override; | 44 void MouseMoved(const gfx::Point& location, bool left_content) override; |
45 void UpdateDownloadShelfVisibility(bool visible) override; | 45 void UpdateDownloadShelfVisibility(bool visible) override; |
46 | 46 |
47 // Mac-specific method: Update the size and position of the status bubble to | 47 // Mac-specific method: Update the size and position of the status bubble to |
48 // match the parent window. Safe to call even when the status bubble does not | 48 // match the parent window. Safe to call even when the status bubble does not |
49 // exist. | 49 // exist. |
50 void UpdateSizeAndPosition(); | 50 void UpdateSizeAndPosition(); |
51 | 51 |
52 // Mac-specific method: Change the parent window of the status bubble. Safe to | 52 // Mac-specific method: Change the parent window of the status bubble. Safe to |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 bool immediate_; | 164 bool immediate_; |
165 | 165 |
166 // True if the status bubble has been expanded. If the bubble is in the | 166 // True if the status bubble has been expanded. If the bubble is in the |
167 // expanded state and encounters a new URL, change size immediately, | 167 // expanded state and encounters a new URL, change size immediately, |
168 // with no hover delay. | 168 // with no hover delay. |
169 bool is_expanded_; | 169 bool is_expanded_; |
170 | 170 |
171 // The original, non-elided URL. | 171 // The original, non-elided URL. |
172 GURL url_; | 172 GURL url_; |
173 | 173 |
174 // Needs to be passed to ElideURL if the original URL string is wider than | |
175 // the standard bubble width. | |
176 std::string languages_; | |
177 | |
178 // The factory used to generate weak pointers for the show and hide delay | 174 // The factory used to generate weak pointers for the show and hide delay |
179 // timers. | 175 // timers. |
180 base::WeakPtrFactory<StatusBubbleMac> timer_factory_; | 176 base::WeakPtrFactory<StatusBubbleMac> timer_factory_; |
181 | 177 |
182 // The factory used to generate weak pointers for the expansion delay timer. | 178 // The factory used to generate weak pointers for the expansion delay timer. |
183 base::WeakPtrFactory<StatusBubbleMac> expand_timer_factory_; | 179 base::WeakPtrFactory<StatusBubbleMac> expand_timer_factory_; |
184 | 180 |
185 // The factory used to generate weak pointers for the CAAnimation completion | 181 // The factory used to generate weak pointers for the CAAnimation completion |
186 // handlers. | 182 // handlers. |
187 base::WeakPtrFactory<StatusBubbleMac> completion_handler_factory_; | 183 base::WeakPtrFactory<StatusBubbleMac> completion_handler_factory_; |
188 | 184 |
189 DISALLOW_COPY_AND_ASSIGN(StatusBubbleMac); | 185 DISALLOW_COPY_AND_ASSIGN(StatusBubbleMac); |
190 }; | 186 }; |
191 | 187 |
192 // Delegate interface | 188 // Delegate interface |
193 @interface NSObject(StatusBubbleDelegate) | 189 @interface NSObject(StatusBubbleDelegate) |
194 // Called to query the delegate about the frame StatusBubble should position | 190 // Called to query the delegate about the frame StatusBubble should position |
195 // itself in. Frame is returned in the parent window coordinates. | 191 // itself in. Frame is returned in the parent window coordinates. |
196 - (NSRect)statusBubbleBaseFrame; | 192 - (NSRect)statusBubbleBaseFrame; |
197 | 193 |
198 // Called from SetState to notify the delegate of state changes. | 194 // Called from SetState to notify the delegate of state changes. |
199 - (void)statusBubbleWillEnterState:(StatusBubbleMac::StatusBubbleState)state; | 195 - (void)statusBubbleWillEnterState:(StatusBubbleMac::StatusBubbleState)state; |
200 @end | 196 @end |
201 | 197 |
202 #endif // CHROME_BROWSER_UI_COCOA_STATUS_BUBBLE_MAC_H_ | 198 #endif // CHROME_BROWSER_UI_COCOA_STATUS_BUBBLE_MAC_H_ |
OLD | NEW |