| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_VIEWS_INFO_BUBBLE_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_INFO_BUBBLE_H_ |
| 6 #define CHROME_BROWSER_VIEWS_INFO_BUBBLE_H_ | 6 #define CHROME_BROWSER_VIEWS_INFO_BUBBLE_H_ |
| 7 | 7 |
| 8 #include "third_party/skia/include/core/SkColor.h" | 8 #include "third_party/skia/include/core/SkColor.h" |
| 9 #include "views/accelerator.h" | 9 #include "views/accelerator.h" |
| 10 #include "views/view.h" | 10 #include "views/view.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 // border. It is a separate window so that it can be a layered window, so that | 109 // border. It is a separate window so that it can be a layered window, so that |
| 110 // we can use >1-bit alpha shadow images on the borders, which look nicer than | 110 // we can use >1-bit alpha shadow images on the borders, which look nicer than |
| 111 // the Windows CS_DROPSHADOW shadows. The info bubble window itself cannot be a | 111 // the Windows CS_DROPSHADOW shadows. The info bubble window itself cannot be a |
| 112 // layered window because that prevents it from hosting native child controls. | 112 // layered window because that prevents it from hosting native child controls. |
| 113 class BorderWidget : public views::WidgetWin { | 113 class BorderWidget : public views::WidgetWin { |
| 114 public: | 114 public: |
| 115 BorderWidget(); | 115 BorderWidget(); |
| 116 virtual ~BorderWidget() { } | 116 virtual ~BorderWidget() { } |
| 117 | 117 |
| 118 // Initializes the BrowserWidget making |owner| its owning window. | 118 // Initializes the BrowserWidget making |owner| its owning window. |
| 119 void Init(HWND owner); | 119 void Init(BorderContents* border_contents, HWND owner); |
| 120 | 120 |
| 121 // Given the size of the contained contents (without margins), and the rect | 121 // Given the size of the contained contents (without margins), and the rect |
| 122 // (in screen coordinates) to point to, sets the border window positions and | 122 // (in screen coordinates) to point to, sets the border window positions and |
| 123 // sizes the border window and returns the bounds (in screen coordinates) the | 123 // sizes the border window and returns the bounds (in screen coordinates) the |
| 124 // contents should use. |arrow_location| is prefered arrow location, | 124 // contents should use. |arrow_location| is prefered arrow location, |
| 125 // the function tries to preserve the location and direction, in case of RTL | 125 // the function tries to preserve the location and direction, in case of RTL |
| 126 // arrow location is mirrored. | 126 // arrow location is mirrored. |
| 127 virtual gfx::Rect SizeAndGetBounds(const gfx::Rect& position_relative_to, | 127 virtual gfx::Rect SizeAndGetBounds(const gfx::Rect& position_relative_to, |
| 128 BubbleBorder::ArrowLocation arrow_location, | 128 BubbleBorder::ArrowLocation arrow_location, |
| 129 const gfx::Size& contents_size); | 129 const gfx::Size& contents_size); |
| 130 | 130 |
| 131 protected: | 131 protected: |
| 132 // Instanciates and returns the BorderContents this BorderWidget should use. | |
| 133 // Subclasses can return their own BorderContents implementation. | |
| 134 virtual BorderContents* CreateBorderContents(); | |
| 135 | |
| 136 BorderContents* border_contents_; | 132 BorderContents* border_contents_; |
| 137 | 133 |
| 138 private: | 134 private: |
| 139 // Overridden from WidgetWin: | 135 // Overridden from WidgetWin: |
| 140 virtual LRESULT OnMouseActivate(HWND window, | 136 virtual LRESULT OnMouseActivate(HWND window, |
| 141 UINT hit_test, | 137 UINT hit_test, |
| 142 UINT mouse_message); | 138 UINT mouse_message); |
| 143 | 139 |
| 144 DISALLOW_COPY_AND_ASSIGN(BorderWidget); | 140 DISALLOW_COPY_AND_ASSIGN(BorderWidget); |
| 145 }; | 141 }; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 InfoBubble(); | 193 InfoBubble(); |
| 198 virtual ~InfoBubble() {} | 194 virtual ~InfoBubble() {} |
| 199 | 195 |
| 200 // Creates the InfoBubble. | 196 // Creates the InfoBubble. |
| 201 virtual void Init(views::Widget* parent, | 197 virtual void Init(views::Widget* parent, |
| 202 const gfx::Rect& position_relative_to, | 198 const gfx::Rect& position_relative_to, |
| 203 BubbleBorder::ArrowLocation arrow_location, | 199 BubbleBorder::ArrowLocation arrow_location, |
| 204 views::View* contents, | 200 views::View* contents, |
| 205 InfoBubbleDelegate* delegate); | 201 InfoBubbleDelegate* delegate); |
| 206 | 202 |
| 207 #if defined(OS_WIN) | 203 // Instanciates and returns the BorderContents this InfoBubble should use. |
| 208 // Instanciates and returns the BorderWidget this InfoBubble should use. | 204 // Subclasses can return their own BorderContents implementation. |
| 209 // Subclasses can return their own BorderWidget specialization. | 205 virtual BorderContents* CreateBorderContents(); |
| 210 virtual BorderWidget* CreateBorderWidget(); | |
| 211 #endif | |
| 212 | 206 |
| 213 #if defined(OS_WIN) | 207 #if defined(OS_WIN) |
| 214 // Overridden from WidgetWin: | 208 // Overridden from WidgetWin: |
| 215 virtual void OnActivate(UINT action, BOOL minimized, HWND window); | 209 virtual void OnActivate(UINT action, BOOL minimized, HWND window); |
| 216 #elif defined(OS_LINUX) | 210 #elif defined(OS_LINUX) |
| 217 // Overridden from WidgetGtk: | 211 // Overridden from WidgetGtk: |
| 218 virtual void IsActiveChanged(); | 212 virtual void IsActiveChanged(); |
| 219 #endif | 213 #endif |
| 220 | 214 |
| 221 #if defined(OS_WIN) | 215 #if defined(OS_WIN) |
| (...skipping 21 matching lines...) Expand all Loading... |
| 243 gfx::Rect position_relative_to_; | 237 gfx::Rect position_relative_to_; |
| 244 BubbleBorder::ArrowLocation arrow_location_; | 238 BubbleBorder::ArrowLocation arrow_location_; |
| 245 | 239 |
| 246 views::View* contents_; | 240 views::View* contents_; |
| 247 | 241 |
| 248 | 242 |
| 249 DISALLOW_COPY_AND_ASSIGN(InfoBubble); | 243 DISALLOW_COPY_AND_ASSIGN(InfoBubble); |
| 250 }; | 244 }; |
| 251 | 245 |
| 252 #endif // CHROME_BROWSER_VIEWS_INFO_BUBBLE_H_ | 246 #endif // CHROME_BROWSER_VIEWS_INFO_BUBBLE_H_ |
| OLD | NEW |