OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 ASH_DISPLAY_DISPLAY_UTIL_H_ | 5 #ifndef ASH_DISPLAY_DISPLAY_UTIL_H_ |
6 #define ASH_DISPLAY_DISPLAY_UTIL_H_ | 6 #define ASH_DISPLAY_DISPLAY_UTIL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <set> | 10 #include <set> |
11 #include <utility> | 11 #include <utility> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "ash/ash_export.h" | 14 #include "ash/ash_export.h" |
15 #include "ash/common/display/display_info.h" | |
16 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
17 #include "ui/display/manager/display_layout.h" | 16 #include "ui/display/manager/display_layout.h" |
| 17 #include "ui/display/manager/managed_display_info.h" |
| 18 |
| 19 namespace display { |
| 20 class ManagedDisplayInfo; |
| 21 } |
18 | 22 |
19 namespace gfx { | 23 namespace gfx { |
20 class Point; | 24 class Point; |
21 class Rect; | 25 class Rect; |
22 class Size; | 26 class Size; |
23 } | 27 } |
24 | 28 |
| 29 namespace ui {} |
| 30 |
25 namespace ash { | 31 namespace ash { |
26 class AshWindowTreeHost; | 32 class AshWindowTreeHost; |
27 class ManagedDisplayMode; | 33 class ManagedDisplayMode; |
28 class DisplayInfo; | |
29 | 34 |
30 // Creates the display mode list for internal display | 35 // Creates the display mode list for internal display |
31 // based on |native_mode|. | 36 // based on |native_mode|. |
32 ASH_EXPORT DisplayInfo::ManagedDisplayModeList | 37 ASH_EXPORT display::ManagedDisplayInfo::ManagedDisplayModeList |
33 CreateInternalManagedDisplayModeList( | 38 CreateInternalManagedDisplayModeList( |
34 const scoped_refptr<ManagedDisplayMode>& native_mode); | 39 const scoped_refptr<display::ManagedDisplayMode>& native_mode); |
35 | 40 |
36 // Creates the display mode list for unified display | 41 // Creates the display mode list for unified display |
37 // based on |native_mode| and |scales|. | 42 // based on |native_mode| and |scales|. |
38 ASH_EXPORT DisplayInfo::ManagedDisplayModeList | 43 ASH_EXPORT display::ManagedDisplayInfo::ManagedDisplayModeList |
39 CreateUnifiedManagedDisplayModeList( | 44 CreateUnifiedManagedDisplayModeList( |
40 const scoped_refptr<ManagedDisplayMode>& native_mode, | 45 const scoped_refptr<display::ManagedDisplayMode>& native_mode, |
41 const std::set<std::pair<float, float>>& dsf_scale_list); | 46 const std::set<std::pair<float, float>>& dsf_scale_list); |
42 | 47 |
43 // Gets the display mode for |resolution|. Returns false if no display | 48 // Gets the display mode for |resolution|. Returns false if no display |
44 // mode matches the resolution, or the display is an internal display. | 49 // mode matches the resolution, or the display is an internal display. |
45 ASH_EXPORT scoped_refptr<ManagedDisplayMode> GetDisplayModeForResolution( | 50 ASH_EXPORT scoped_refptr<display::ManagedDisplayMode> |
46 const DisplayInfo& info, | 51 GetDisplayModeForResolution(const display::ManagedDisplayInfo& info, |
47 const gfx::Size& resolution); | 52 const gfx::Size& resolution); |
48 | 53 |
49 // Gets the display mode for the next valid UI scale. Returns false | 54 // Gets the display mode for the next valid UI scale. Returns false |
50 // if the display is not an internal display. | 55 // if the display is not an internal display. |
51 ASH_EXPORT scoped_refptr<ManagedDisplayMode> GetDisplayModeForNextUIScale( | 56 ASH_EXPORT scoped_refptr<display::ManagedDisplayMode> |
52 const DisplayInfo& info, | 57 GetDisplayModeForNextUIScale(const display::ManagedDisplayInfo& info, bool up); |
53 bool up); | |
54 | 58 |
55 // Gets the display mode for the next valid resolution. Returns false | 59 // Gets the display mode for the next valid resolution. Returns false |
56 // if the display is an internal display. | 60 // if the display is an internal display. |
57 ASH_EXPORT scoped_refptr<ManagedDisplayMode> GetDisplayModeForNextResolution( | 61 ASH_EXPORT scoped_refptr<display::ManagedDisplayMode> |
58 const DisplayInfo& info, | 62 GetDisplayModeForNextResolution(const display::ManagedDisplayInfo& info, |
59 bool up); | 63 bool up); |
60 | 64 |
61 // Sets the UI scale for the |display_id|. Returns false if the | 65 // Sets the UI scale for the |display_id|. Returns false if the |
62 // display_id is not an internal display. | 66 // display_id is not an internal display. |
63 ASH_EXPORT bool SetDisplayUIScale(int64_t display_id, float scale); | 67 ASH_EXPORT bool SetDisplayUIScale(int64_t display_id, float scale); |
64 | 68 |
65 // Tests if the |info| has display mode that matches |ui_scale|. | 69 // Tests if the |info| has display mode that matches |ui_scale|. |
66 bool HasDisplayModeForUIScale(const DisplayInfo& info, float ui_scale); | 70 bool HasDisplayModeForUIScale(const display::ManagedDisplayInfo& info, |
| 71 float ui_scale); |
67 | 72 |
68 // Computes the bounds that defines the bounds between two displays. | 73 // Computes the bounds that defines the bounds between two displays. |
69 // Returns false if two displays do not intersect. | 74 // Returns false if two displays do not intersect. |
70 bool ComputeBoundary(const display::Display& primary_display, | 75 bool ComputeBoundary(const display::Display& primary_display, |
71 const display::Display& secondary_display, | 76 const display::Display& secondary_display, |
72 gfx::Rect* primary_edge_in_screen, | 77 gfx::Rect* primary_edge_in_screen, |
73 gfx::Rect* secondary_edge_in_screen); | 78 gfx::Rect* secondary_edge_in_screen); |
74 | 79 |
75 // Creates edge bounds from |bounds_in_screen| that fits the edge | 80 // Creates edge bounds from |bounds_in_screen| that fits the edge |
76 // of the native window for |ash_host|. | 81 // of the native window for |ash_host|. |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 #if defined(OS_CHROMEOS) | 135 #if defined(OS_CHROMEOS) |
131 // Shows the notification message for display related issues. | 136 // Shows the notification message for display related issues. |
132 void ShowDisplayErrorNotification(int message_id); | 137 void ShowDisplayErrorNotification(int message_id); |
133 #endif | 138 #endif |
134 | 139 |
135 ASH_EXPORT base::string16 GetDisplayErrorNotificationMessageForTest(); | 140 ASH_EXPORT base::string16 GetDisplayErrorNotificationMessageForTest(); |
136 | 141 |
137 } // namespace ash | 142 } // namespace ash |
138 | 143 |
139 #endif // ASH_DISPLAY_DISPLAY_UTIL_H_ | 144 #endif // ASH_DISPLAY_DISPLAY_UTIL_H_ |
OLD | NEW |