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