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