OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_AUTOFILL_POPUP_VIEW_COMMON_H_ | 5 #ifndef CHROME_BROWSER_UI_AUTOFILL_POPUP_VIEW_COMMON_H_ |
6 #define CHROME_BROWSER_UI_AUTOFILL_POPUP_VIEW_COMMON_H_ | 6 #define CHROME_BROWSER_UI_AUTOFILL_POPUP_VIEW_COMMON_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "ui/gfx/native_widget_types.h" | 9 #include "ui/gfx/native_widget_types.h" |
10 | 10 |
11 namespace gfx { | 11 namespace gfx { |
12 class Display; | 12 class Display; |
13 class Point; | 13 class Point; |
14 class Rect; | 14 class Rect; |
15 } | 15 } |
16 | 16 |
| 17 namespace display { |
| 18 using Display = gfx::Display; |
| 19 } |
| 20 |
17 namespace autofill { | 21 namespace autofill { |
18 | 22 |
19 // Provides utility functions for popup-style views. | 23 // Provides utility functions for popup-style views. |
20 class PopupViewCommon { | 24 class PopupViewCommon { |
21 public: | 25 public: |
22 // Returns the bounds that the popup should be placed at, given the desired | 26 // Returns the bounds that the popup should be placed at, given the desired |
23 // width and height. By default this places the popup below |element_bounds| | 27 // width and height. By default this places the popup below |element_bounds| |
24 // but it will be placed above if there isn't enough space. | 28 // but it will be placed above if there isn't enough space. |
25 gfx::Rect CalculatePopupBounds(int desired_width, | 29 gfx::Rect CalculatePopupBounds(int desired_width, |
26 int desired_height, | 30 int desired_height, |
27 const gfx::Rect& element_bounds, | 31 const gfx::Rect& element_bounds, |
28 gfx::NativeView container_view, | 32 gfx::NativeView container_view, |
29 bool is_rtl); | 33 bool is_rtl); |
30 | 34 |
31 protected: | 35 protected: |
32 // A helper function to get the display closest to the given point (virtual | 36 // A helper function to get the display closest to the given point (virtual |
33 // for testing). | 37 // for testing). |
34 virtual gfx::Display GetDisplayNearestPoint(const gfx::Point& point, | 38 virtual display::Display GetDisplayNearestPoint( |
35 gfx::NativeView container_view); | 39 const gfx::Point& point, |
| 40 gfx::NativeView container_view); |
36 }; | 41 }; |
37 | 42 |
38 } // namespace autofill | 43 } // namespace autofill |
39 | 44 |
40 #endif // CHROME_BROWSER_UI_AUTOFILL_POPUP_VIEW_COMMON_H_ | 45 #endif // CHROME_BROWSER_UI_AUTOFILL_POPUP_VIEW_COMMON_H_ |
OLD | NEW |