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