| 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_BORDER_WIDGET_WIN_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_BUBBLE_BORDER_WIDGET_WIN_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_BUBBLE_BORDER_WIDGET_WIN_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_BUBBLE_BORDER_WIDGET_WIN_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 "views/widget/widget_win.h" | 10 #include "views/widget/widget_win.h" |
| 11 | 11 |
| 12 class BorderContents; | 12 class BorderContents; |
| 13 | 13 |
| 14 // This is a window that surrounds the info bubble and paints the margin and | 14 // This is a window that surrounds the info bubble and paints the margin and |
| 15 // border. It is a separate window so that it can be a layered window, so that | 15 // border. It is a separate window so that it can be a layered window, so that |
| 16 // we can use >1-bit alpha shadow images on the borders, which look nicer than | 16 // we can use >1-bit alpha shadow images on the borders, which look nicer than |
| 17 // the Windows CS_DROPSHADOW shadows. The info bubble window itself cannot be a | 17 // the Windows CS_DROPSHADOW shadows. The info bubble window itself cannot be a |
| 18 // layered window because that prevents it from hosting native child controls. | 18 // layered window because that prevents it from hosting native child controls. |
| 19 class BorderWidgetWin : public views::WidgetWin { | 19 class BorderWidgetWin : public views::WidgetWin { |
| 20 public: | 20 public: |
| 21 BorderWidgetWin(); | 21 BorderWidgetWin(); |
| 22 virtual ~BorderWidgetWin() { } | 22 virtual ~BorderWidgetWin() { } |
| 23 | 23 |
| 24 // Initializes the BrowserWidget making |owner| its owning window. | 24 // Initializes the BrowserWidget making |owner| its owning window. |
| 25 void Init(BorderContents* border_contents, HWND owner); | 25 void InitBorderWidgetWin(BorderContents* border_contents, HWND owner); |
| 26 | 26 |
| 27 // Given the size of the contained contents (without margins), and the rect | 27 // Given the size of the contained contents (without margins), and the rect |
| 28 // (in screen coordinates) to point to, sets the border window positions and | 28 // (in screen coordinates) to point to, sets the border window positions and |
| 29 // sizes the border window and returns the bounds (in screen coordinates) the | 29 // sizes the border window and returns the bounds (in screen coordinates) the |
| 30 // contents should use. |arrow_location| is prefered arrow location, | 30 // contents should use. |arrow_location| is prefered arrow location, |
| 31 // the function tries to preserve the location and direction, in case of RTL | 31 // the function tries to preserve the location and direction, in case of RTL |
| 32 // arrow location is mirrored. | 32 // arrow location is mirrored. |
| 33 virtual gfx::Rect SizeAndGetBounds(const gfx::Rect& position_relative_to, | 33 virtual gfx::Rect SizeAndGetBounds(const gfx::Rect& position_relative_to, |
| 34 BubbleBorder::ArrowLocation arrow_location, | 34 BubbleBorder::ArrowLocation arrow_location, |
| 35 const gfx::Size& contents_size); | 35 const gfx::Size& contents_size); |
| 36 | 36 |
| 37 // Simple accessors. | 37 // Simple accessors. |
| 38 BorderContents* border_contents() { return border_contents_; } | 38 BorderContents* border_contents() { return border_contents_; } |
| 39 | 39 |
| 40 protected: | 40 protected: |
| 41 BorderContents* border_contents_; | 41 BorderContents* border_contents_; |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 // Overridden from WidgetWin: | 44 // Overridden from WidgetWin: |
| 45 virtual LRESULT OnMouseActivate(UINT message, | 45 virtual LRESULT OnMouseActivate(UINT message, |
| 46 WPARAM w_param, | 46 WPARAM w_param, |
| 47 LPARAM l_param) OVERRIDE; | 47 LPARAM l_param) OVERRIDE; |
| 48 | 48 |
| 49 DISALLOW_COPY_AND_ASSIGN(BorderWidgetWin); | 49 DISALLOW_COPY_AND_ASSIGN(BorderWidgetWin); |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 #endif // CHROME_BROWSER_UI_VIEWS_BUBBLE_BORDER_WIDGET_WIN_H_ | 52 #endif // CHROME_BROWSER_UI_VIEWS_BUBBLE_BORDER_WIDGET_WIN_H_ |
| OLD | NEW |