| 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 "ui/base/animation/animation_delegate.h" | 10 #include "ui/base/animation/animation_delegate.h" |
| 11 #include "ui/base/models/accelerator.h" | 11 #include "ui/base/models/accelerator.h" |
| 12 #include "ui/views/bubble/bubble_border.h" | 12 #include "ui/views/bubble/bubble_border.h" |
| 13 #include "views/view.h" | 13 #include "views/view.h" |
| 14 | 14 |
| 15 #if defined(USE_AURA) | 15 #if defined(USE_AURA) |
| 16 #include "views/widget/native_widget_aura.h" | 16 #include "views/widget/native_widget_aura.h" |
| 17 #elif defined(OS_WIN) | 17 #elif defined(OS_WIN) |
| 18 #include "views/widget/native_widget_win.h" | 18 #include "views/widget/native_widget_win.h" |
| 19 #elif defined(TOUCH_UI) | |
| 20 #include "views/widget/native_widget_views.h" | |
| 21 #elif defined(TOOLKIT_USES_GTK) | 19 #elif defined(TOOLKIT_USES_GTK) |
| 22 #include "views/widget/native_widget_gtk.h" | 20 #include "views/widget/native_widget_gtk.h" |
| 23 #endif | 21 #endif |
| 24 | 22 |
| 25 // Bubble is used to display an arbitrary view above all other windows. | 23 // Bubble is used to display an arbitrary view above all other windows. |
| 26 // Think of Bubble as a tooltip that allows you to embed an arbitrary view | 24 // Think of Bubble as a tooltip that allows you to embed an arbitrary view |
| 27 // in the tooltip. Additionally the Bubble renders an arrow pointing at | 25 // in the tooltip. Additionally the Bubble renders an arrow pointing at |
| 28 // the region the info bubble is providing the information about. | 26 // the region the info bubble is providing the information about. |
| 29 // | 27 // |
| 30 // To use an Bubble, invoke Show() and it'll take care of the rest. The Bubble | 28 // To use an Bubble, invoke Show() and it'll take care of the rest. The Bubble |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 }; | 69 }; |
| 72 | 70 |
| 73 // TODO(sky): this code is ifdef-tastic. It might be cleaner to refactor the | 71 // TODO(sky): this code is ifdef-tastic. It might be cleaner to refactor the |
| 74 // WidgetFoo subclass into a separate class that calls into Bubble. | 72 // WidgetFoo subclass into a separate class that calls into Bubble. |
| 75 // That way Bubble has no (or very few) ifdefs. | 73 // That way Bubble has no (or very few) ifdefs. |
| 76 class Bubble | 74 class Bubble |
| 77 #if defined(USE_AURA) | 75 #if defined(USE_AURA) |
| 78 : public views::NativeWidgetAura, | 76 : public views::NativeWidgetAura, |
| 79 #elif defined(OS_WIN) | 77 #elif defined(OS_WIN) |
| 80 : public views::NativeWidgetWin, | 78 : public views::NativeWidgetWin, |
| 81 #elif defined(TOUCH_UI) | |
| 82 : public views::NativeWidgetViews, | |
| 83 #elif defined(TOOLKIT_USES_GTK) | 79 #elif defined(TOOLKIT_USES_GTK) |
| 84 : public views::NativeWidgetGtk, | 80 : public views::NativeWidgetGtk, |
| 85 #endif | 81 #endif |
| 86 public ui::AcceleratorTarget, | 82 public ui::AcceleratorTarget, |
| 87 public ui::AnimationDelegate { | 83 public ui::AnimationDelegate { |
| 88 public: | 84 public: |
| 89 class Observer { | 85 class Observer { |
| 90 public: | 86 public: |
| 91 // See BubbleDelegate::BubbleClosing for when this is called. | 87 // See BubbleDelegate::BubbleClosing for when this is called. |
| 92 virtual void OnBubbleClosing() = 0; | 88 virtual void OnBubbleClosing() = 0; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 // Instantiates and returns the BorderContents this Bubble should use. | 182 // Instantiates and returns the BorderContents this Bubble should use. |
| 187 // Subclasses can return their own BorderContents implementation. | 183 // Subclasses can return their own BorderContents implementation. |
| 188 virtual BorderContents* CreateBorderContents(); | 184 virtual BorderContents* CreateBorderContents(); |
| 189 | 185 |
| 190 #if defined(USE_AURA) | 186 #if defined(USE_AURA) |
| 191 // Overridden from NativeWidgetAura: | 187 // Overridden from NativeWidgetAura: |
| 192 virtual void OnLostActive() OVERRIDE; | 188 virtual void OnLostActive() OVERRIDE; |
| 193 #elif defined(OS_WIN) | 189 #elif defined(OS_WIN) |
| 194 // Overridden from NativeWidgetWin: | 190 // Overridden from NativeWidgetWin: |
| 195 virtual void OnActivate(UINT action, BOOL minimized, HWND window); | 191 virtual void OnActivate(UINT action, BOOL minimized, HWND window); |
| 196 #elif defined(TOUCH_UI) | |
| 197 // Overridden from NativeWidgetViews:: | |
| 198 virtual void Deactivate() OVERRIDE; | |
| 199 #elif defined(TOOLKIT_USES_GTK) | 192 #elif defined(TOOLKIT_USES_GTK) |
| 200 // Overridden from NativeWidgetGtk: | 193 // Overridden from NativeWidgetGtk: |
| 201 virtual void OnActiveChanged() OVERRIDE; | 194 virtual void OnActiveChanged() OVERRIDE; |
| 202 #endif | 195 #endif |
| 203 | 196 |
| 204 #if defined(OS_WIN) && !defined(USE_AURA) | 197 #if defined(OS_WIN) && !defined(USE_AURA) |
| 205 // The window used to render the padding, border and arrow. | 198 // The window used to render the padding, border and arrow. |
| 206 BorderWidgetWin* border_; | 199 BorderWidgetWin* border_; |
| 207 #else | 200 #else |
| 208 // The view displaying the border. | 201 // The view displaying the border. |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 views::View* contents_; | 259 views::View* contents_; |
| 267 | 260 |
| 268 bool accelerator_registered_; | 261 bool accelerator_registered_; |
| 269 | 262 |
| 270 ObserverList<Observer> observer_list_; | 263 ObserverList<Observer> observer_list_; |
| 271 | 264 |
| 272 DISALLOW_COPY_AND_ASSIGN(Bubble); | 265 DISALLOW_COPY_AND_ASSIGN(Bubble); |
| 273 }; | 266 }; |
| 274 | 267 |
| 275 #endif // CHROME_BROWSER_UI_VIEWS_BUBBLE_BUBBLE_H_ | 268 #endif // CHROME_BROWSER_UI_VIEWS_BUBBLE_BUBBLE_H_ |
| OLD | NEW |