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_VIEWS_STATUS_BUBBLE_VIEWS_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_STATUS_BUBBLE_VIEWS_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_STATUS_BUBBLE_VIEWS_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_STATUS_BUBBLE_VIEWS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/compiler_specific.h" |
10 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
11 #include "base/string16.h" | 12 #include "base/string16.h" |
12 #include "base/task.h" | 13 #include "base/task.h" |
13 #include "chrome/browser/ui/status_bubble.h" | 14 #include "chrome/browser/ui/status_bubble.h" |
14 #include "googleurl/src/gurl.h" | 15 #include "googleurl/src/gurl.h" |
15 #include "ui/gfx/rect.h" | 16 #include "ui/gfx/rect.h" |
16 | 17 |
17 class GURL; | |
18 namespace gfx { | 18 namespace gfx { |
19 class Point; | 19 class Point; |
20 } | 20 } |
21 namespace views { | 21 namespace views { |
22 class View; | 22 class View; |
23 class Widget; | 23 class Widget; |
24 } | 24 } |
25 | 25 |
26 // StatusBubble displays a bubble of text that fades in, hovers over the | 26 // StatusBubble displays a bubble of text that fades in, hovers over the |
27 // browser chrome and fades away when not needed. It is primarily designed | 27 // browser chrome and fades away when not needed. It is primarily designed |
(...skipping 20 matching lines...) Expand all Loading... |
48 // the font and kTotalVerticalPadding. | 48 // the font and kTotalVerticalPadding. |
49 gfx::Size GetPreferredSize(); | 49 gfx::Size GetPreferredSize(); |
50 | 50 |
51 // Set the bounds of the bubble relative to |base_view_|. | 51 // Set the bounds of the bubble relative to |base_view_|. |
52 void SetBounds(int x, int y, int w, int h); | 52 void SetBounds(int x, int y, int w, int h); |
53 | 53 |
54 // Set bubble to new width. | 54 // Set bubble to new width. |
55 void SetBubbleWidth(int width); | 55 void SetBubbleWidth(int width); |
56 | 56 |
57 // Overridden from StatusBubble: | 57 // Overridden from StatusBubble: |
58 virtual void SetStatus(const string16& status); | 58 virtual void SetStatus(const string16& status) OVERRIDE; |
59 virtual void SetURL(const GURL& url, const string16& languages); | 59 virtual void SetURL(const GURL& url, const std::string& languages) OVERRIDE; |
60 virtual void Hide(); | 60 virtual void Hide() OVERRIDE; |
61 virtual void MouseMoved(const gfx::Point& location, bool left_content); | 61 virtual void MouseMoved(const gfx::Point& location, |
62 virtual void UpdateDownloadShelfVisibility(bool visible); | 62 bool left_content) OVERRIDE; |
| 63 virtual void UpdateDownloadShelfVisibility(bool visible) OVERRIDE; |
63 | 64 |
64 private: | 65 private: |
65 class StatusView; | 66 class StatusView; |
66 class StatusViewExpander; | 67 class StatusViewExpander; |
67 | 68 |
68 // Initializes the popup and view. | 69 // Initializes the popup and view. |
69 void Init(); | 70 void Init(); |
70 | 71 |
71 // Attempt to move the status bubble out of the way of the cursor, allowing | 72 // Attempt to move the status bubble out of the way of the cursor, allowing |
72 // users to see links in the region normally occupied by the status bubble. | 73 // users to see links in the region normally occupied by the status bubble. |
(...skipping 18 matching lines...) Expand all Loading... |
91 // The status text we want to display when there are no URLs to display. | 92 // The status text we want to display when there are no URLs to display. |
92 string16 status_text_; | 93 string16 status_text_; |
93 | 94 |
94 // The url we want to display when there is no status text to display. | 95 // The url we want to display when there is no status text to display. |
95 string16 url_text_; | 96 string16 url_text_; |
96 | 97 |
97 // The original, non-elided URL. | 98 // The original, non-elided URL. |
98 GURL url_; | 99 GURL url_; |
99 | 100 |
100 // Used to elide the original URL again when we expand it. | 101 // Used to elide the original URL again when we expand it. |
101 string16 languages_; | 102 std::string languages_; |
102 | 103 |
103 // Position relative to the base_view_. | 104 // Position relative to the base_view_. |
104 gfx::Point original_position_; | 105 gfx::Point original_position_; |
105 // original_position_ adjusted according to the current RTL. | 106 // original_position_ adjusted according to the current RTL. |
106 gfx::Point position_; | 107 gfx::Point position_; |
107 gfx::Size size_; | 108 gfx::Size size_; |
108 | 109 |
109 // How vertically offset the bubble is from its root position_. | 110 // How vertically offset the bubble is from its root position_. |
110 int offset_; | 111 int offset_; |
111 | 112 |
(...skipping 15 matching lines...) Expand all Loading... |
127 // change size immediately, with no hover. | 128 // change size immediately, with no hover. |
128 bool is_expanded_; | 129 bool is_expanded_; |
129 | 130 |
130 // Times expansion of status bubble when URL is too long for standard width. | 131 // Times expansion of status bubble when URL is too long for standard width. |
131 ScopedRunnableMethodFactory<StatusBubbleViews> expand_timer_factory_; | 132 ScopedRunnableMethodFactory<StatusBubbleViews> expand_timer_factory_; |
132 | 133 |
133 DISALLOW_COPY_AND_ASSIGN(StatusBubbleViews); | 134 DISALLOW_COPY_AND_ASSIGN(StatusBubbleViews); |
134 }; | 135 }; |
135 | 136 |
136 #endif // CHROME_BROWSER_UI_VIEWS_STATUS_BUBBLE_VIEWS_H_ | 137 #endif // CHROME_BROWSER_UI_VIEWS_STATUS_BUBBLE_VIEWS_H_ |
OLD | NEW |