| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_COCOA_STATUS_BUBBLE_MAC_H_ | 5 #ifndef CHROME_BROWSER_COCOA_STATUS_BUBBLE_MAC_H_ |
| 6 #define CHROME_BROWSER_COCOA_STATUS_BUBBLE_MAC_H_ | 6 #define CHROME_BROWSER_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> |
| 11 | 11 |
| 12 #include "chrome/browser/status_bubble.h" | 12 #include "chrome/browser/status_bubble.h" |
| 13 | 13 |
| 14 class GURL; | 14 class GURL; |
| 15 class StatusBubbleMacTest; | 15 class StatusBubbleMacTest; |
| 16 | 16 |
| 17 class StatusBubbleMac : public StatusBubble { | 17 class StatusBubbleMac : public StatusBubble { |
| 18 public: | 18 public: |
| 19 StatusBubbleMac(NSWindow* parent); | 19 StatusBubbleMac(NSWindow* parent, id delegate); |
| 20 virtual ~StatusBubbleMac(); | 20 virtual ~StatusBubbleMac(); |
| 21 | 21 |
| 22 // StatusBubble implementation. | 22 // StatusBubble implementation. |
| 23 virtual void SetStatus(const std::wstring& status); | 23 virtual void SetStatus(const std::wstring& status); |
| 24 virtual void SetURL(const GURL& url, const std::wstring& languages); | 24 virtual void SetURL(const GURL& url, const std::wstring& languages); |
| 25 virtual void Hide(); | 25 virtual void Hide(); |
| 26 virtual void MouseMoved(); | 26 virtual void MouseMoved(); |
| 27 virtual void UpdateDownloadShelfVisibility(bool visible); | 27 virtual void UpdateDownloadShelfVisibility(bool visible); |
| 28 | 28 |
| 29 private: | 29 private: |
| 30 friend class StatusBubbleMacTest; | 30 friend class StatusBubbleMacTest; |
| 31 | 31 |
| 32 void SetStatus(NSString* status, bool is_url); | 32 void SetStatus(NSString* status, bool is_url); |
| 33 | 33 |
| 34 // Construct the window/widget if it does not already exist. (Safe to call if | 34 // Construct the window/widget if it does not already exist. (Safe to call if |
| 35 // it does.) | 35 // it does.) |
| 36 void Create(); | 36 void Create(); |
| 37 | 37 |
| 38 void FadeIn(); | 38 void FadeIn(); |
| 39 void FadeOut(); | 39 void FadeOut(); |
| 40 | 40 |
| 41 // The window we attach ourselves to. | 41 // The window we attach ourselves to. |
| 42 NSWindow* parent_; // WEAK | 42 NSWindow* parent_; // WEAK |
| 43 | 43 |
| 44 // The object that we query about our vertical offset for positioning. |
| 45 id delegate_; // WEAK |
| 46 |
| 44 // The window we own. | 47 // The window we own. |
| 45 NSWindow* window_; | 48 NSWindow* window_; |
| 46 | 49 |
| 47 // The status text we want to display when there are no URLs to display. | 50 // The status text we want to display when there are no URLs to display. |
| 48 NSString* status_text_; | 51 NSString* status_text_; |
| 49 | 52 |
| 50 // The url we want to display when there is no status text to display. | 53 // The url we want to display when there is no status text to display. |
| 51 NSString* url_text_; | 54 NSString* url_text_; |
| 52 | 55 |
| 53 // How vertically offset the bubble is from its root position. | 56 // How vertically offset the bubble is from its root position. |
| 54 int offset_; | 57 int offset_; |
| 58 |
| 59 // Is the download shelf visible. |
| 60 bool is_download_shelf_visible_; |
| 55 }; | 61 }; |
| 56 | 62 |
| 63 // Delegate interface that allows the StatusBubble to query its delegate about |
| 64 // the vertical offset (if any) that should be applied to the StatusBubble's |
| 65 // position. |
| 66 @interface NSObject(StatusBubbleDelegate) |
| 67 - (float)verticalOffsetForStatusBubble; |
| 68 @end |
| 69 |
| 57 #endif // #ifndef CHROME_BROWSER_COCOA_STATUS_BUBBLE_MAC_H_ | 70 #endif // #ifndef CHROME_BROWSER_COCOA_STATUS_BUBBLE_MAC_H_ |
| OLD | NEW |