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