| 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 "base/observer_list.h" | 9 #include "base/observer_list.h" |
| 10 #include "views/bubble/bubble_border.h" | 10 #include "views/bubble/bubble_border.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 // another window is activated. You can explicitly close the bubble by | 105 // another window is activated. You can explicitly close the bubble by |
| 106 // invoking Close(). | 106 // invoking Close(). |
| 107 // |arrow_location| specifies preferred bubble alignment. | 107 // |arrow_location| specifies preferred bubble alignment. |
| 108 // You may provide an optional |delegate| to: | 108 // You may provide an optional |delegate| to: |
| 109 // - Be notified when the Bubble is closed. | 109 // - Be notified when the Bubble is closed. |
| 110 // - Prevent the Bubble from being closed when the Escape key is | 110 // - Prevent the Bubble from being closed when the Escape key is |
| 111 // pressed (the default behavior). | 111 // pressed (the default behavior). |
| 112 static Bubble* Show(views::Widget* parent, | 112 static Bubble* Show(views::Widget* parent, |
| 113 const gfx::Rect& position_relative_to, | 113 const gfx::Rect& position_relative_to, |
| 114 views::BubbleBorder::ArrowLocation arrow_location, | 114 views::BubbleBorder::ArrowLocation arrow_location, |
| 115 views::BubbleBorder::BubbleAlignment alignment, |
| 115 views::View* contents, | 116 views::View* contents, |
| 116 BubbleDelegate* delegate); | 117 BubbleDelegate* delegate); |
| 117 | 118 |
| 118 #if defined(OS_CHROMEOS) | 119 #if defined(OS_CHROMEOS) |
| 119 // Shows the Bubble without grabbing the focus. Doesn't set the Escape | 120 // Shows the Bubble without grabbing the focus. Doesn't set the Escape |
| 120 // accelerator so user code is responsible for closing the bubble on pressing | 121 // accelerator so user code is responsible for closing the bubble on pressing |
| 121 // the Esc key. Others are the same as above. TYPE_POPUP widget is used | 122 // the Esc key. Others are the same as above. TYPE_POPUP widget is used |
| 122 // to achieve the focusless effect. If |show_while_screen_is_locked| is true, | 123 // to achieve the focusless effect. If |show_while_screen_is_locked| is true, |
| 123 // a property is set telling the window manager to continue showing the bubble | 124 // a property is set telling the window manager to continue showing the bubble |
| 124 // even while the screen is locked. | 125 // even while the screen is locked. |
| 125 static Bubble* ShowFocusless( | 126 static Bubble* ShowFocusless( |
| 126 views::Widget* parent, | 127 views::Widget* parent, |
| 127 const gfx::Rect& position_relative_to, | 128 const gfx::Rect& position_relative_to, |
| 128 views::BubbleBorder::ArrowLocation arrow_location, | 129 views::BubbleBorder::ArrowLocation arrow_location, |
| 130 views::BubbleBorder::BubbleAlignment alignment, |
| 129 views::View* contents, | 131 views::View* contents, |
| 130 BubbleDelegate* delegate, | 132 BubbleDelegate* delegate, |
| 131 bool show_while_screen_is_locked); | 133 bool show_while_screen_is_locked); |
| 132 #endif | 134 #endif |
| 133 | 135 |
| 134 // Resizes and potentially moves the Bubble to best accommodate the | 136 // Resizes and potentially moves the Bubble to best accommodate the |
| 135 // contents preferred size. | 137 // contents preferred size. |
| 136 void SizeToContents(); | 138 void SizeToContents(); |
| 137 | 139 |
| 138 // Whether the Bubble should fade away when it closes. Generally speaking, | 140 // Whether the Bubble should fade away when it closes. Generally speaking, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 #if defined(OS_CHROMEOS) | 176 #if defined(OS_CHROMEOS) |
| 175 Bubble(views::Widget::InitParams::Type type, | 177 Bubble(views::Widget::InitParams::Type type, |
| 176 bool show_while_screen_is_locked); | 178 bool show_while_screen_is_locked); |
| 177 #endif | 179 #endif |
| 178 virtual ~Bubble(); | 180 virtual ~Bubble(); |
| 179 | 181 |
| 180 // Creates the Bubble. | 182 // Creates the Bubble. |
| 181 virtual void InitBubble(views::Widget* parent, | 183 virtual void InitBubble(views::Widget* parent, |
| 182 const gfx::Rect& position_relative_to, | 184 const gfx::Rect& position_relative_to, |
| 183 views::BubbleBorder::ArrowLocation arrow_location, | 185 views::BubbleBorder::ArrowLocation arrow_location, |
| 186 views::BubbleBorder::BubbleAlignment alignment, |
| 184 views::View* contents, | 187 views::View* contents, |
| 185 BubbleDelegate* delegate); | 188 BubbleDelegate* delegate); |
| 186 | 189 |
| 187 // Instantiates and returns the BorderContents this Bubble should use. | 190 // Instantiates and returns the BorderContents this Bubble should use. |
| 188 // Subclasses can return their own BorderContents implementation. | 191 // Subclasses can return their own BorderContents implementation. |
| 189 virtual BorderContents* CreateBorderContents(); | 192 virtual BorderContents* CreateBorderContents(); |
| 190 | 193 |
| 191 #if defined(USE_AURA) | 194 #if defined(USE_AURA) |
| 192 // Overridden from NativeWidgetAura: | 195 // Overridden from NativeWidgetAura: |
| 193 // TODO(beng): OnActivate(); | 196 // TODO(beng): OnActivate(); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 views::View* contents_; | 272 views::View* contents_; |
| 270 | 273 |
| 271 bool accelerator_registered_; | 274 bool accelerator_registered_; |
| 272 | 275 |
| 273 ObserverList<Observer> observer_list_; | 276 ObserverList<Observer> observer_list_; |
| 274 | 277 |
| 275 DISALLOW_COPY_AND_ASSIGN(Bubble); | 278 DISALLOW_COPY_AND_ASSIGN(Bubble); |
| 276 }; | 279 }; |
| 277 | 280 |
| 278 #endif // CHROME_BROWSER_UI_VIEWS_BUBBLE_BUBBLE_H_ | 281 #endif // CHROME_BROWSER_UI_VIEWS_BUBBLE_BUBBLE_H_ |
| OLD | NEW |