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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #import <Cocoa/Cocoa.h> | 11 #import <Cocoa/Cocoa.h> |
12 #import <QuartzCore/QuartzCore.h> | 12 #import <QuartzCore/QuartzCore.h> |
13 | 13 |
| 14 #include "base/compiler_specific.h" |
14 #include "base/string16.h" | 15 #include "base/string16.h" |
15 #include "base/task.h" | 16 #include "base/task.h" |
16 #include "chrome/browser/ui/status_bubble.h" | 17 #include "chrome/browser/ui/status_bubble.h" |
17 #include "googleurl/src/gurl.h" | 18 #include "googleurl/src/gurl.h" |
18 | 19 |
19 class GURL; | |
20 class StatusBubbleMacTest; | 20 class StatusBubbleMacTest; |
21 | 21 |
22 class StatusBubbleMac : public StatusBubble { | 22 class StatusBubbleMac : public StatusBubble { |
23 public: | 23 public: |
24 // The various states that a status bubble may be in. Public for delegate | 24 // The various states that a status bubble may be in. Public for delegate |
25 // access (for testing). | 25 // access (for testing). |
26 enum StatusBubbleState { | 26 enum StatusBubbleState { |
27 kBubbleHidden, // Fully hidden | 27 kBubbleHidden, // Fully hidden |
28 kBubbleShowingTimer, // Waiting to fade in | 28 kBubbleShowingTimer, // Waiting to fade in |
29 kBubbleShowingFadeIn, // In a fade-in transition | 29 kBubbleShowingFadeIn, // In a fade-in transition |
30 kBubbleShown, // Fully visible | 30 kBubbleShown, // Fully visible |
31 kBubbleHidingTimer, // Waiting to fade out | 31 kBubbleHidingTimer, // Waiting to fade out |
32 kBubbleHidingFadeOut // In a fade-out transition | 32 kBubbleHidingFadeOut // In a fade-out transition |
33 }; | 33 }; |
34 | 34 |
35 StatusBubbleMac(NSWindow* parent, id delegate); | 35 StatusBubbleMac(NSWindow* parent, id delegate); |
36 virtual ~StatusBubbleMac(); | 36 virtual ~StatusBubbleMac(); |
37 | 37 |
38 // StatusBubble implementation. | 38 // StatusBubble implementation. |
39 virtual void SetStatus(const string16& status); | 39 virtual void SetStatus(const string16& status) OVERRIDE; |
40 virtual void SetURL(const GURL& url, const string16& languages); | 40 virtual void SetURL(const GURL& url, const std::string& languages) OVERRIDE; |
41 virtual void Hide(); | 41 virtual void Hide() OVERRIDE; |
42 virtual void MouseMoved(const gfx::Point& location, bool left_content); | 42 virtual void MouseMoved(const gfx::Point& location, |
43 virtual void UpdateDownloadShelfVisibility(bool visible); | 43 bool left_content) OVERRIDE; |
| 44 virtual void UpdateDownloadShelfVisibility(bool visible) OVERRIDE; |
44 | 45 |
45 // Mac-specific method: Update the size and position of the status bubble to | 46 // Mac-specific method: Update the size and position of the status bubble to |
46 // match the parent window. Safe to call even when the status bubble does not | 47 // match the parent window. Safe to call even when the status bubble does not |
47 // exist. | 48 // exist. |
48 void UpdateSizeAndPosition(); | 49 void UpdateSizeAndPosition(); |
49 | 50 |
50 // Mac-specific method: Change the parent window of the status bubble. Safe to | 51 // Mac-specific method: Change the parent window of the status bubble. Safe to |
51 // call even when the status bubble does not exist. | 52 // call even when the status bubble does not exist. |
52 void SwitchParentWindow(NSWindow* parent); | 53 void SwitchParentWindow(NSWindow* parent); |
53 | 54 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 // True if the status bubble has been expanded. If the bubble is in the | 168 // True if the status bubble has been expanded. If the bubble is in the |
168 // expanded state and encounters a new URL, change size immediately, | 169 // expanded state and encounters a new URL, change size immediately, |
169 // with no hover delay. | 170 // with no hover delay. |
170 bool is_expanded_; | 171 bool is_expanded_; |
171 | 172 |
172 // The original, non-elided URL. | 173 // The original, non-elided URL. |
173 GURL url_; | 174 GURL url_; |
174 | 175 |
175 // Needs to be passed to ElideURL if the original URL string is wider than | 176 // Needs to be passed to ElideURL if the original URL string is wider than |
176 // the standard bubble width. | 177 // the standard bubble width. |
177 string16 languages_; | 178 std::string languages_; |
178 | 179 |
179 DISALLOW_COPY_AND_ASSIGN(StatusBubbleMac); | 180 DISALLOW_COPY_AND_ASSIGN(StatusBubbleMac); |
180 }; | 181 }; |
181 | 182 |
182 // Delegate interface | 183 // Delegate interface |
183 @interface NSObject(StatusBubbleDelegate) | 184 @interface NSObject(StatusBubbleDelegate) |
184 // Called to query the delegate about the frame StatusBubble should position | 185 // Called to query the delegate about the frame StatusBubble should position |
185 // itself in. Frame is returned in the parent window coordinates. | 186 // itself in. Frame is returned in the parent window coordinates. |
186 - (NSRect)statusBubbleBaseFrame; | 187 - (NSRect)statusBubbleBaseFrame; |
187 | 188 |
188 // Called from SetState to notify the delegate of state changes. | 189 // Called from SetState to notify the delegate of state changes. |
189 - (void)statusBubbleWillEnterState:(StatusBubbleMac::StatusBubbleState)state; | 190 - (void)statusBubbleWillEnterState:(StatusBubbleMac::StatusBubbleState)state; |
190 @end | 191 @end |
191 | 192 |
192 #endif // CHROME_BROWSER_UI_COCOA_STATUS_BUBBLE_MAC_H_ | 193 #endif // CHROME_BROWSER_UI_COCOA_STATUS_BUBBLE_MAC_H_ |
OLD | NEW |