blob: 9dc177d2f7c4746591b4f6e368f9aaca14bc5519 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_COCOA_STATUS_BUBBLE_MAC_H_
#define CHROME_BROWSER_COCOA_STATUS_BUBBLE_MAC_H_
#include <string>
#import <Cocoa/Cocoa.h>
#include "chrome/browser/status_bubble.h"
class GURL;
class StatusBubbleMacTest;
class StatusBubbleMac : public StatusBubble {
public:
StatusBubbleMac(NSWindow* parent, id delegate);
virtual ~StatusBubbleMac();
// StatusBubble implementation.
virtual void SetStatus(const std::wstring& status);
virtual void SetURL(const GURL& url, const std::wstring& languages);
virtual void Hide();
virtual void MouseMoved();
virtual void UpdateDownloadShelfVisibility(bool visible);
// Mac-specific method: Update the size and position of the status bubble to
// match the parent window. Safe to call even when the status bubble does not
// exist.
void UpdateSizeAndPosition();
private:
friend class StatusBubbleMacTest;
void SetStatus(NSString* status, bool is_url);
// Construct the window/widget if it does not already exist. (Safe to call if
// it does.)
void Create();
void FadeIn();
void FadeOut();
// Calculate the appropriate frame for the status bubble window.
NSRect CalculateWindowFrame();
// The window we attach ourselves to.
NSWindow* parent_; // WEAK
// The object that we query about our vertical offset for positioning.
id delegate_; // WEAK
// The window we own.
NSWindow* window_;
// The status text we want to display when there are no URLs to display.
NSString* status_text_;
// The url we want to display when there is no status text to display.
NSString* url_text_;
// How vertically offset the bubble is from its root position.
int offset_;
};
// Delegate interface that allows the StatusBubble to query its delegate about
// the vertical offset (if any) that should be applied to the StatusBubble's
// position.
@interface NSObject(StatusBubbleDelegate)
- (float)verticalOffsetForStatusBubble;
@end
#endif // #ifndef CHROME_BROWSER_COCOA_STATUS_BUBBLE_MAC_H_
|