| OLD | NEW |
| 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_LAYOUT_H_ | 5 #ifndef UI_DISPLAY_MANAGER_DISPLAY_LAYOUT_H_ |
| 6 #define UI_DISPLAY_MANAGER_DISPLAY_LAYOUT_H_ | 6 #define UI_DISPLAY_MANAGER_DISPLAY_LAYOUT_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/strings/string_piece.h" | 15 #include "base/strings/string_piece.h" |
| 16 #include "ui/display/display_export.h" | 16 #include "ui/display/display_export.h" |
| 17 | 17 |
| 18 namespace base { | 18 namespace base { |
| 19 class Value; | 19 class Value; |
| 20 template <typename T> class JSONValueConverter; | 20 template <typename T> class JSONValueConverter; |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace display { | 23 namespace display { |
| 24 class Display; | 24 class Display; |
| 25 | 25 |
| 26 // An identifier used to manage display layout in DisplayManager / | 26 // An identifier used to manage display layout in DisplayManager / |
| 27 // DisplayLayoutStore. | 27 // DisplayLayoutStore. |
| 28 using DisplayIdList = std::vector<int64_t>; | 28 using DisplayIdList = std::vector<int64_t>; |
| 29 | 29 |
| 30 using DisplayList = std::vector<Display>; | 30 using Displays = std::vector<Display>; |
| 31 | 31 |
| 32 // DisplayPlacement specifies where the display (D) is placed relative to | 32 // DisplayPlacement specifies where the display (D) is placed relative to |
| 33 // parent (P) display. In the following example, D given by |display_id| is | 33 // parent (P) display. In the following example, D given by |display_id| is |
| 34 // placed at the left side of P given by |parent_display_id|, with a negative | 34 // placed at the left side of P given by |parent_display_id|, with a negative |
| 35 // offset and a top-left offset reference. | 35 // offset and a top-left offset reference. |
| 36 // | 36 // |
| 37 // + +--------+ | 37 // + +--------+ |
| 38 // offset | | | | 38 // offset | | | |
| 39 // + | D +--------+ | 39 // + | D +--------+ |
| 40 // | | | | 40 // | | | |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 85 |
| 86 class DISPLAY_EXPORT DisplayLayout final { | 86 class DISPLAY_EXPORT DisplayLayout final { |
| 87 public: | 87 public: |
| 88 DisplayLayout(); | 88 DisplayLayout(); |
| 89 ~DisplayLayout(); | 89 ~DisplayLayout(); |
| 90 | 90 |
| 91 // Applies the layout to the displays in |display_list|. | 91 // Applies the layout to the displays in |display_list|. |
| 92 // |updated_ids| (optional) contains the ids for displays whose bounds have | 92 // |updated_ids| (optional) contains the ids for displays whose bounds have |
| 93 // changed. |minimum_offset_overlap| represents the minimum required overlap | 93 // changed. |minimum_offset_overlap| represents the minimum required overlap |
| 94 // between displays. | 94 // between displays. |
| 95 void ApplyToDisplayList(DisplayList* display_list, | 95 void ApplyToDisplayList(Displays* display_list, |
| 96 std::vector<int64_t>* updated_ids, | 96 std::vector<int64_t>* updated_ids, |
| 97 int minimum_offset_overlap) const; | 97 int minimum_offset_overlap) const; |
| 98 | 98 |
| 99 // Validates the layout object. | 99 // Validates the layout object. |
| 100 static bool Validate(const DisplayIdList& list, const DisplayLayout& layout); | 100 static bool Validate(const DisplayIdList& list, const DisplayLayout& layout); |
| 101 | 101 |
| 102 std::vector<DisplayPlacement> placement_list; | 102 std::vector<DisplayPlacement> placement_list; |
| 103 | 103 |
| 104 // True if displays are mirrored. | 104 // True if displays are mirrored. |
| 105 bool mirrored; | 105 bool mirrored; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 120 std::string ToString() const; | 120 std::string ToString() const; |
| 121 | 121 |
| 122 // Returns the DisplayPlacement entry matching |display_id| if it exists, | 122 // Returns the DisplayPlacement entry matching |display_id| if it exists, |
| 123 // otherwise returns a DisplayPlacement with an invalid display id. | 123 // otherwise returns a DisplayPlacement with an invalid display id. |
| 124 DisplayPlacement FindPlacementById(int64_t display_id) const; | 124 DisplayPlacement FindPlacementById(int64_t display_id) const; |
| 125 | 125 |
| 126 private: | 126 private: |
| 127 // Apply the display placement to |display_list|. | 127 // Apply the display placement to |display_list|. |
| 128 // Returns true if the display bounds were updated. | 128 // Returns true if the display bounds were updated. |
| 129 static bool ApplyDisplayPlacement(const DisplayPlacement& placement, | 129 static bool ApplyDisplayPlacement(const DisplayPlacement& placement, |
| 130 DisplayList* display_list, | 130 Displays* display_list, |
| 131 int minimum_offset_overlap); | 131 int minimum_offset_overlap); |
| 132 | 132 |
| 133 DISALLOW_COPY_AND_ASSIGN(DisplayLayout); | 133 DISALLOW_COPY_AND_ASSIGN(DisplayLayout); |
| 134 }; | 134 }; |
| 135 | 135 |
| 136 } // namespace display | 136 } // namespace display |
| 137 | 137 |
| 138 #endif // UI_DISPLAY_MANAGER_DISPLAY_LAYOUT_H_ | 138 #endif // UI_DISPLAY_MANAGER_DISPLAY_LAYOUT_H_ |
| OLD | NEW |