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_BUBBLE_BUBBLE_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_BUBBLE_BUBBLE_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_BUBBLE_BUBBLE_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_BUBBLE_BUBBLE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "chrome/browser/ui/views/bubble/bubble_border.h" | 9 #include "chrome/browser/ui/views/bubble/bubble_border.h" |
10 #include "ui/base/animation/animation_delegate.h" | 10 #include "ui/base/animation/animation_delegate.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 // - Be notified when the Bubble is closed. | 91 // - Be notified when the Bubble is closed. |
92 // - Prevent the Bubble from being closed when the Escape key is | 92 // - Prevent the Bubble from being closed when the Escape key is |
93 // pressed (the default behavior). | 93 // pressed (the default behavior). |
94 static Bubble* Show(views::Widget* parent, | 94 static Bubble* Show(views::Widget* parent, |
95 const gfx::Rect& position_relative_to, | 95 const gfx::Rect& position_relative_to, |
96 BubbleBorder::ArrowLocation arrow_location, | 96 BubbleBorder::ArrowLocation arrow_location, |
97 views::View* contents, | 97 views::View* contents, |
98 BubbleDelegate* delegate); | 98 BubbleDelegate* delegate); |
99 | 99 |
100 #if defined(OS_CHROMEOS) | 100 #if defined(OS_CHROMEOS) |
101 // Shows the Bubble without grabbing the focus. Others are the same as | 101 // Shows the Bubble without grabbing the focus. Doesn't set the Escape |
102 // above. TYPE_POPUP widget is used to achieve the focusless effect. | 102 // accelerator so user code is responsible for closing the bubble on pressing |
103 // If |show_while_screen_is_locked| is true, a property is set telling the | 103 // the Esc key. Others are the same as above. TYPE_POPUP widget is used |
104 // window manager to continue showing the bubble even while the screen is | 104 // to achieve the focusless effect. If |show_while_screen_is_locked| is true, |
105 // locked. | 105 // a property is set telling the window manager to continue showing the bubble |
| 106 // even while the screen is locked. |
106 static Bubble* ShowFocusless(views::Widget* parent, | 107 static Bubble* ShowFocusless(views::Widget* parent, |
107 const gfx::Rect& position_relative_to, | 108 const gfx::Rect& position_relative_to, |
108 BubbleBorder::ArrowLocation arrow_location, | 109 BubbleBorder::ArrowLocation arrow_location, |
109 views::View* contents, | 110 views::View* contents, |
110 BubbleDelegate* delegate, | 111 BubbleDelegate* delegate, |
111 bool show_while_screen_is_locked); | 112 bool show_while_screen_is_locked); |
112 #endif | 113 #endif |
113 | 114 |
114 // Resizes and potentially moves the Bubble to best accommodate the | 115 // Resizes and potentially moves the Bubble to best accommodate the |
115 // contents preferred size. | 116 // contents preferred size. |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 void DoClose(bool closed_by_escape); | 184 void DoClose(bool closed_by_escape); |
184 | 185 |
185 // Animates to a visible state. | 186 // Animates to a visible state. |
186 void FadeIn(); | 187 void FadeIn(); |
187 // Animates to a hidden state. | 188 // Animates to a hidden state. |
188 void FadeOut(); | 189 void FadeOut(); |
189 | 190 |
190 // Animates to a visible/hidden state (visible if |fade_in| is true). | 191 // Animates to a visible/hidden state (visible if |fade_in| is true). |
191 void Fade(bool fade_in); | 192 void Fade(bool fade_in); |
192 | 193 |
| 194 void RegisterEscapeAccelerator(); |
| 195 void UnregisterEscapeAccelerator(); |
| 196 |
193 // Overridden from AcceleratorTarget: | 197 // Overridden from AcceleratorTarget: |
194 virtual bool AcceleratorPressed(const views::Accelerator& accelerator); | 198 virtual bool AcceleratorPressed(const views::Accelerator& accelerator); |
195 | 199 |
196 // The delegate, if any. | 200 // The delegate, if any. |
197 BubbleDelegate* delegate_; | 201 BubbleDelegate* delegate_; |
198 | 202 |
199 // The animation used to fade the bubble out. | 203 // The animation used to fade the bubble out. |
200 scoped_ptr<ui::SlideAnimation> animation_; | 204 scoped_ptr<ui::SlideAnimation> animation_; |
201 | 205 |
202 // The current visibility status of the bubble. | 206 // The current visibility status of the bubble. |
(...skipping 10 matching lines...) Expand all Loading... |
213 // Should we set a property telling the window manager to show this window | 217 // Should we set a property telling the window manager to show this window |
214 // onscreen even when the screen is locked? | 218 // onscreen even when the screen is locked? |
215 bool show_while_screen_is_locked_; | 219 bool show_while_screen_is_locked_; |
216 #endif | 220 #endif |
217 | 221 |
218 gfx::Rect position_relative_to_; | 222 gfx::Rect position_relative_to_; |
219 BubbleBorder::ArrowLocation arrow_location_; | 223 BubbleBorder::ArrowLocation arrow_location_; |
220 | 224 |
221 views::View* contents_; | 225 views::View* contents_; |
222 | 226 |
| 227 bool accelerator_registered_; |
| 228 |
223 DISALLOW_COPY_AND_ASSIGN(Bubble); | 229 DISALLOW_COPY_AND_ASSIGN(Bubble); |
224 }; | 230 }; |
225 | 231 |
226 #endif // CHROME_BROWSER_UI_VIEWS_BUBBLE_BUBBLE_H_ | 232 #endif // CHROME_BROWSER_UI_VIEWS_BUBBLE_BUBBLE_H_ |
OLD | NEW |