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

Side by Side Diff: ash/display/display_util.h

Issue 1838833002: Move DisplayLayout and DisplayLayoutBuilder From ash To ui/display (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@screenwinmove
Patch Set: Fix comment Created 4 years, 8 months 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 | « ash/display/display_manager_unittest.cc ('k') | ash/display/display_util.cc » ('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 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/display/display_layout.h" 15 #include "ui/display/manager/display_layout.h"
16 16
17 namespace gfx { 17 namespace gfx {
18 class Display; 18 class Display;
19 class Point; 19 class Point;
20 class Rect; 20 class Rect;
21 class Size; 21 class Size;
22 } 22 }
23 23
24 namespace ash { 24 namespace ash {
25 class AshWindowTreeHost; 25 class AshWindowTreeHost;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 const gfx::Point& point_in_screen, 82 const gfx::Point& point_in_screen,
83 bool update_last_location_now); 83 bool update_last_location_now);
84 84
85 // Returns the index in the displays whose bounds contains |point_in_screen|. 85 // Returns the index in the displays whose bounds contains |point_in_screen|.
86 // Returns -1 if no such display exist. 86 // Returns -1 if no such display exist.
87 ASH_EXPORT int FindDisplayIndexContainingPoint( 87 ASH_EXPORT int FindDisplayIndexContainingPoint(
88 const std::vector<gfx::Display>& displays, 88 const std::vector<gfx::Display>& displays,
89 const gfx::Point& point_in_screen); 89 const gfx::Point& point_in_screen);
90 90
91 // Sorts id list using |CompareDisplayIds| below. 91 // Sorts id list using |CompareDisplayIds| below.
92 ASH_EXPORT void SortDisplayIdList(DisplayIdList* list); 92 ASH_EXPORT void SortDisplayIdList(display::DisplayIdList* list);
93 93
94 // Default id generator. 94 // Default id generator.
95 class DefaultDisplayIdGenerator { 95 class DefaultDisplayIdGenerator {
96 public: 96 public:
97 int64_t operator()(int64_t id) { return id; } 97 int64_t operator()(int64_t id) { return id; }
98 }; 98 };
99 99
100 // Generate sorted DisplayIdList from iterators. 100 // Generate sorted display::DisplayIdList from iterators.
101 template <class ForwardIterator, class Generator = DefaultDisplayIdGenerator> 101 template <class ForwardIterator, class Generator = DefaultDisplayIdGenerator>
102 DisplayIdList GenerateDisplayIdList(ForwardIterator first, 102 display::DisplayIdList GenerateDisplayIdList(
103 ForwardIterator last, 103 ForwardIterator first,
104 Generator generator = Generator()) { 104 ForwardIterator last,
105 DisplayIdList list; 105 Generator generator = Generator()) {
106 display::DisplayIdList list;
106 while (first != last) { 107 while (first != last) {
107 list.push_back(generator(*first)); 108 list.push_back(generator(*first));
108 ++first; 109 ++first;
109 } 110 }
110 SortDisplayIdList(&list); 111 SortDisplayIdList(&list);
111 return list; 112 return list;
112 } 113 }
113 114
114 // Creates sorted DisplayIdList. 115 // Creates sorted display::DisplayIdList.
115 ASH_EXPORT DisplayIdList CreateDisplayIdList(const DisplayList& list); 116 ASH_EXPORT display::DisplayIdList CreateDisplayIdList(
117 const display::DisplayList& list);
116 118
117 ASH_EXPORT std::string DisplayIdListToString(const DisplayIdList& list); 119 ASH_EXPORT std::string DisplayIdListToString(
120 const display::DisplayIdList& list);
118 121
119 // Returns true if one of following conditinos is met. 122 // Returns true if one of following conditinos is met.
120 // 1) id1 is internal. 123 // 1) id1 is internal.
121 // 2) output index of id1 < output index of id2 and id2 isn't internal. 124 // 2) output index of id1 < output index of id2 and id2 isn't internal.
122 ASH_EXPORT bool CompareDisplayIds(int64_t id1, int64_t id2); 125 ASH_EXPORT bool CompareDisplayIds(int64_t id1, int64_t id2);
123 126
124 } // namespace ash 127 } // namespace ash
125 128
126 #endif // ASH_DISPLAY_DISPLAY_UTIL_H_ 129 #endif // ASH_DISPLAY_DISPLAY_UTIL_H_
OLDNEW
« no previous file with comments | « ash/display/display_manager_unittest.cc ('k') | ash/display/display_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698