Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: ui/display/manager/display_manager_utilities.h

Issue 2540313002: Split //ui/display and create //ui/display/manager. (Closed)
Patch Set: Cleanup export header. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/display/manager/display_manager_export.h ('k') | ui/display/manager/managed_display_info.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 UI_DISPLAY_MANAGER_DISPLAY_MANAGER_UTILITIES_H_ 5 #ifndef UI_DISPLAY_MANAGER_DISPLAY_MANAGER_UTILITIES_H_
6 #define UI_DISPLAY_MANAGER_DISPLAY_MANAGER_UTILITIES_H_ 6 #define UI_DISPLAY_MANAGER_DISPLAY_MANAGER_UTILITIES_H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "ui/display/display.h" 10 #include "ui/display/display.h"
11 #include "ui/display/display_export.h" 11 #include "ui/display/display_layout.h"
12 #include "ui/display/manager/display_layout.h" 12 #include "ui/display/manager/display_manager_export.h"
13 #include "ui/display/manager/managed_display_info.h" 13 #include "ui/display/manager/managed_display_info.h"
14 14
15 namespace gfx { 15 namespace gfx {
16 class Point; 16 class Point;
17 class Rect; 17 class Rect;
18 class Size; 18 class Size;
19 } 19 }
20 20
21 namespace display { 21 namespace display {
22 class ManagedDisplayInfo; 22 class ManagedDisplayInfo;
23 class ManagedDisplayMode; 23 class ManagedDisplayMode;
24 24
25 // Creates the display mode list for internal display 25 // Creates the display mode list for internal display
26 // based on |native_mode|. 26 // based on |native_mode|.
27 DISPLAY_EXPORT ManagedDisplayInfo::ManagedDisplayModeList 27 DISPLAY_MANAGER_EXPORT ManagedDisplayInfo::ManagedDisplayModeList
28 CreateInternalManagedDisplayModeList( 28 CreateInternalManagedDisplayModeList(
29 const scoped_refptr<ManagedDisplayMode>& native_mode); 29 const scoped_refptr<ManagedDisplayMode>& native_mode);
30 30
31 // Creates the display mode list for unified display 31 // Creates the display mode list for unified display
32 // based on |native_mode| and |scales|. 32 // based on |native_mode| and |scales|.
33 DISPLAY_EXPORT ManagedDisplayInfo::ManagedDisplayModeList 33 DISPLAY_MANAGER_EXPORT ManagedDisplayInfo::ManagedDisplayModeList
34 CreateUnifiedManagedDisplayModeList( 34 CreateUnifiedManagedDisplayModeList(
35 const scoped_refptr<ManagedDisplayMode>& native_mode, 35 const scoped_refptr<ManagedDisplayMode>& native_mode,
36 const std::set<std::pair<float, float>>& dsf_scale_list); 36 const std::set<std::pair<float, float>>& dsf_scale_list);
37 37
38 // Gets the display mode for |resolution|. Returns false if no display 38 // Gets the display mode for |resolution|. Returns false if no display
39 // mode matches the resolution, or the display is an internal display. 39 // mode matches the resolution, or the display is an internal display.
40 DISPLAY_EXPORT scoped_refptr<ManagedDisplayMode> GetDisplayModeForResolution( 40 DISPLAY_MANAGER_EXPORT scoped_refptr<ManagedDisplayMode>
41 const ManagedDisplayInfo& info, 41 GetDisplayModeForResolution(const ManagedDisplayInfo& info,
42 const gfx::Size& resolution); 42 const gfx::Size& resolution);
43 43
44 // Gets the display mode for the next valid UI scale. Returns false 44 // Gets the display mode for the next valid UI scale. Returns false
45 // if the display is not an internal display. 45 // if the display is not an internal display.
46 DISPLAY_EXPORT scoped_refptr<ManagedDisplayMode> GetDisplayModeForNextUIScale( 46 DISPLAY_MANAGER_EXPORT scoped_refptr<ManagedDisplayMode>
47 const ManagedDisplayInfo& info, 47 GetDisplayModeForNextUIScale(const ManagedDisplayInfo& info, bool up);
48 bool up);
49 48
50 // Gets the display mode for the next valid resolution. Returns false 49 // Gets the display mode for the next valid resolution. Returns false
51 // if the display is an internal display. 50 // if the display is an internal display.
52 DISPLAY_EXPORT scoped_refptr<ManagedDisplayMode> 51 DISPLAY_MANAGER_EXPORT scoped_refptr<ManagedDisplayMode>
53 GetDisplayModeForNextResolution(const ManagedDisplayInfo& info, bool up); 52 GetDisplayModeForNextResolution(const ManagedDisplayInfo& info, bool up);
54 53
55 // Tests if the |info| has display mode that matches |ui_scale|. 54 // Tests if the |info| has display mode that matches |ui_scale|.
56 bool HasDisplayModeForUIScale(const ManagedDisplayInfo& info, float ui_scale); 55 bool HasDisplayModeForUIScale(const ManagedDisplayInfo& info, float ui_scale);
57 56
58 // Computes the bounds that defines the bounds between two displays. 57 // Computes the bounds that defines the bounds between two displays.
59 // Returns false if two displays do not intersect. 58 // Returns false if two displays do not intersect.
60 DISPLAY_EXPORT bool ComputeBoundary(const Display& primary_display, 59 DISPLAY_MANAGER_EXPORT bool ComputeBoundary(
61 const Display& secondary_display, 60 const Display& primary_display,
62 gfx::Rect* primary_edge_in_screen, 61 const Display& secondary_display,
63 gfx::Rect* secondary_edge_in_screen); 62 gfx::Rect* primary_edge_in_screen,
63 gfx::Rect* secondary_edge_in_screen);
64 64
65 // Returns the index in the displays whose bounds contains |point_in_screen|. 65 // Returns the index in the displays whose bounds contains |point_in_screen|.
66 // Returns -1 if no such display exist. 66 // Returns -1 if no such display exist.
67 DISPLAY_EXPORT int FindDisplayIndexContainingPoint( 67 DISPLAY_MANAGER_EXPORT int FindDisplayIndexContainingPoint(
68 const std::vector<Display>& displays, 68 const std::vector<Display>& displays,
69 const gfx::Point& point_in_screen); 69 const gfx::Point& point_in_screen);
70 70
71 // Sorts id list using |CompareDisplayIds| below. 71 // Sorts id list using |CompareDisplayIds| below.
72 DISPLAY_EXPORT void SortDisplayIdList(DisplayIdList* list); 72 DISPLAY_MANAGER_EXPORT void SortDisplayIdList(DisplayIdList* list);
73 73
74 // Default id generator. 74 // Default id generator.
75 class DefaultDisplayIdGenerator { 75 class DefaultDisplayIdGenerator {
76 public: 76 public:
77 int64_t operator()(int64_t id) { return id; } 77 int64_t operator()(int64_t id) { return id; }
78 }; 78 };
79 79
80 // Generate sorted DisplayIdList from iterators. 80 // Generate sorted DisplayIdList from iterators.
81 template <class ForwardIterator, class Generator = DefaultDisplayIdGenerator> 81 template <class ForwardIterator, class Generator = DefaultDisplayIdGenerator>
82 DisplayIdList GenerateDisplayIdList(ForwardIterator first, 82 DisplayIdList GenerateDisplayIdList(ForwardIterator first,
83 ForwardIterator last, 83 ForwardIterator last,
84 Generator generator = Generator()) { 84 Generator generator = Generator()) {
85 DisplayIdList list; 85 DisplayIdList list;
86 while (first != last) { 86 while (first != last) {
87 list.push_back(generator(*first)); 87 list.push_back(generator(*first));
88 ++first; 88 ++first;
89 } 89 }
90 SortDisplayIdList(&list); 90 SortDisplayIdList(&list);
91 return list; 91 return list;
92 } 92 }
93 93
94 // Creates sorted DisplayIdList. 94 // Creates sorted DisplayIdList.
95 DISPLAY_EXPORT DisplayIdList CreateDisplayIdList(const Displays& list); 95 DISPLAY_MANAGER_EXPORT DisplayIdList CreateDisplayIdList(const Displays& list);
96 96
97 DISPLAY_EXPORT std::string DisplayIdListToString(const DisplayIdList& list); 97 DISPLAY_MANAGER_EXPORT std::string DisplayIdListToString(
98 const DisplayIdList& list);
98 99
99 // Returns true if one of following conditions is met. 100 // Returns true if one of following conditions is met.
100 // 1) id1 is internal. 101 // 1) id1 is internal.
101 // 2) output index of id1 < output index of id2 and id2 isn't internal. 102 // 2) output index of id1 < output index of id2 and id2 isn't internal.
102 DISPLAY_EXPORT bool CompareDisplayIds(int64_t id1, int64_t id2); 103 DISPLAY_MANAGER_EXPORT bool CompareDisplayIds(int64_t id1, int64_t id2);
103 104
104 } // namespace display 105 } // namespace display
105 106
106 #endif // UI_DISPLAY_MANAGER_DISPLAY_MANAGER_UTILITIES_H_ 107 #endif // UI_DISPLAY_MANAGER_DISPLAY_MANAGER_UTILITIES_H_
OLDNEW
« no previous file with comments | « ui/display/manager/display_manager_export.h ('k') | ui/display/manager/managed_display_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698