1 // Copyright 2014 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.
5 #ifndef ASH_DISPLAY_DISPLAY_UTIL_H_
6 #define ASH_DISPLAY_DISPLAY_UTIL_H_
10 #include "ash/ash_export.h"
11 #include "ash/display/display_layout.h"
20 class AshWindowTreeHost
;
24 // Creates the display mode list for internal display
25 // based on |native_mode|.
26 ASH_EXPORT
std::vector
<DisplayMode
> CreateInternalDisplayModeList(
27 const DisplayMode
& native_mode
);
29 // Returns next valid UI scale.
30 float GetNextUIScale(const DisplayInfo
& info
, bool up
);
32 // Tests if the |info| has display mode that matches |ui_scale|.
33 bool HasDisplayModeForUIScale(const DisplayInfo
& info
, float ui_scale
);
35 // Computes the bounds that defines the bounds between two displays
36 // based on the layout |position|.
37 void ComputeBoundary(const gfx::Display
& primary_display
,
38 const gfx::Display
& secondary_display
,
39 DisplayLayout::Position position
,
40 gfx::Rect
* primary_edge_in_screen
,
41 gfx::Rect
* secondary_edge_in_screen
);
43 // Creates edge bounds from |bounds_in_screen| that fits the edge
44 // of the native window for |ash_host|.
45 ASH_EXPORT
gfx::Rect
GetNativeEdgeBounds(AshWindowTreeHost
* ash_host
,
46 const gfx::Rect
& bounds_in_screen
);
48 // Moves the cursor to the point inside the |ash_host| that is closest to
49 // the point_in_screen, which may be outside of the root window.
50 // |update_last_loation_now| is used for the test to update the mouse
51 // location synchronously.
52 void MoveCursorTo(AshWindowTreeHost
* ash_host
,
53 const gfx::Point
& point_in_screen
,
54 bool update_last_location_now
);
56 // Returns the index in the displays whose bounds contains |point_in_screen|.
57 // Returns -1 if no such display exist.
58 ASH_EXPORT
int FindDisplayIndexContainingPoint(
59 const std::vector
<gfx::Display
>& displays
,
60 const gfx::Point
& point_in_screen
);
64 #endif // ASH_DISPLAY_DISPLAY_UTIL_H_