| 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 "ui/display/manager/display_layout.h" | 17 #include "ui/display/manager/display_layout.h" |
| 16 | 18 |
| 17 namespace gfx { | 19 namespace gfx { |
| 18 class Point; | 20 class Point; |
| 19 class Rect; | 21 class Rect; |
| 20 class Size; | 22 class Size; |
| 21 } | 23 } |
| 22 | 24 |
| 23 namespace ash { | 25 namespace ash { |
| 24 class AshWindowTreeHost; | 26 class AshWindowTreeHost; |
| 25 struct DisplayMode; | 27 class DisplayMode; |
| 26 class DisplayInfo; | 28 class DisplayInfo; |
| 27 | 29 |
| 28 // Creates the display mode list for internal display | 30 // Creates the display mode list for internal display |
| 29 // based on |native_mode|. | 31 // based on |native_mode|. |
| 30 ASH_EXPORT std::vector<DisplayMode> CreateInternalDisplayModeList( | 32 ASH_EXPORT DisplayInfo::DisplayModeList CreateInternalDisplayModeList( |
| 31 const DisplayMode& native_mode); | 33 const scoped_refptr<DisplayMode>& native_mode); |
| 32 | 34 |
| 33 // Creates the display mode list for unified display | 35 // Creates the display mode list for unified display |
| 34 // based on |native_mode| and |scales|. | 36 // based on |native_mode| and |scales|. |
| 35 ASH_EXPORT std::vector<DisplayMode> CreateUnifiedDisplayModeList( | 37 ASH_EXPORT DisplayInfo::DisplayModeList CreateUnifiedDisplayModeList( |
| 36 const DisplayMode& native_mode, | 38 const scoped_refptr<DisplayMode>& native_mode, |
| 37 const std::set<std::pair<float, float>>& dsf_scale_list); | 39 const std::set<std::pair<float, float>>& dsf_scale_list); |
| 38 | 40 |
| 39 // Gets the display mode for |resolution|. Returns false if no display | 41 // Gets the display mode for |resolution|. Returns false if no display |
| 40 // mode matches the resolution, or the display is an internal display. | 42 // mode matches the resolution, or the display is an internal display. |
| 41 ASH_EXPORT bool GetDisplayModeForResolution(const DisplayInfo& info, | 43 ASH_EXPORT scoped_refptr<DisplayMode> GetDisplayModeForResolution( |
| 42 const gfx::Size& resolution, | 44 const DisplayInfo& info, |
| 43 DisplayMode* out); | 45 const gfx::Size& resolution); |
| 44 | 46 |
| 45 // Gets the display mode for the next valid UI scale. Returns false | 47 // Gets the display mode for the next valid UI scale. Returns false |
| 46 // if the display is not an internal display. | 48 // if the display is not an internal display. |
| 47 ASH_EXPORT bool GetDisplayModeForNextUIScale(const DisplayInfo& info, | 49 ASH_EXPORT scoped_refptr<DisplayMode> GetDisplayModeForNextUIScale( |
| 48 bool up, | 50 const DisplayInfo& info, |
| 49 DisplayMode* out); | 51 bool up); |
| 50 | 52 |
| 51 // Gets the display mode for the next valid resolution. Returns false | 53 // Gets the display mode for the next valid resolution. Returns false |
| 52 // if the display is an internal display. | 54 // if the display is an internal display. |
| 53 ASH_EXPORT bool GetDisplayModeForNextResolution(const DisplayInfo& info, | 55 ASH_EXPORT scoped_refptr<DisplayMode> GetDisplayModeForNextResolution( |
| 54 bool up, | 56 const DisplayInfo& info, |
| 55 DisplayMode* out); | 57 bool up); |
| 56 | 58 |
| 57 // Sets the UI scale for the |display_id|. Returns false if the | 59 // Sets the UI scale for the |display_id|. Returns false if the |
| 58 // display_id is not an internal display. | 60 // display_id is not an internal display. |
| 59 ASH_EXPORT bool SetDisplayUIScale(int64_t display_id, float scale); | 61 ASH_EXPORT bool SetDisplayUIScale(int64_t display_id, float scale); |
| 60 | 62 |
| 61 // Tests if the |info| has display mode that matches |ui_scale|. | 63 // Tests if the |info| has display mode that matches |ui_scale|. |
| 62 bool HasDisplayModeForUIScale(const DisplayInfo& info, float ui_scale); | 64 bool HasDisplayModeForUIScale(const DisplayInfo& info, float ui_scale); |
| 63 | 65 |
| 64 // Computes the bounds that defines the bounds between two displays. | 66 // Computes the bounds that defines the bounds between two displays. |
| 65 // Returns false if two displays do not intersect. | 67 // Returns false if two displays do not intersect. |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 #if defined(OS_CHROMEOS) | 128 #if defined(OS_CHROMEOS) |
| 127 // Shows the notification message for display related issues. | 129 // Shows the notification message for display related issues. |
| 128 void ShowDisplayErrorNotification(int message_id); | 130 void ShowDisplayErrorNotification(int message_id); |
| 129 #endif | 131 #endif |
| 130 | 132 |
| 131 ASH_EXPORT base::string16 GetDisplayErrorNotificationMessageForTest(); | 133 ASH_EXPORT base::string16 GetDisplayErrorNotificationMessageForTest(); |
| 132 | 134 |
| 133 } // namespace ash | 135 } // namespace ash |
| 134 | 136 |
| 135 #endif // ASH_DISPLAY_DISPLAY_UTIL_H_ | 137 #endif // ASH_DISPLAY_DISPLAY_UTIL_H_ |
| OLD | NEW |