| 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/manager/display_manager_export.h" |
| 17 | 17 |
| 18 namespace display { | 18 namespace display { |
| 19 class Display; | 19 class Display; |
| 20 | 20 |
| 21 // An identifier used to manage display layout in DisplayManager / | 21 // An identifier used to manage display layout in DisplayManager / |
| 22 // DisplayLayoutStore. | 22 // DisplayLayoutStore. |
| 23 using DisplayIdList = std::vector<int64_t>; | 23 using DisplayIdList = std::vector<int64_t>; |
| 24 | 24 |
| 25 using Displays = std::vector<Display>; | 25 using Displays = std::vector<Display>; |
| 26 | 26 |
| 27 // DisplayPlacement specifies where the display (D) is placed relative to | 27 // DisplayPlacement specifies where the display (D) is placed relative to |
| 28 // parent (P) display. In the following example, D given by |display_id| is | 28 // parent (P) display. In the following example, D given by |display_id| is |
| 29 // placed at the left side of P given by |parent_display_id|, with a negative | 29 // placed at the left side of P given by |parent_display_id|, with a negative |
| 30 // offset and a top-left offset reference. | 30 // offset and a top-left offset reference. |
| 31 // | 31 // |
| 32 // + +--------+ | 32 // + +--------+ |
| 33 // offset | | | | 33 // offset | | | |
| 34 // + | D +--------+ | 34 // + | D +--------+ |
| 35 // | | | | 35 // | | | |
| 36 // +--------+ P | | 36 // +--------+ P | |
| 37 // | | | 37 // | | |
| 38 // +--------+ | 38 // +--------+ |
| 39 // | 39 // |
| 40 struct DISPLAY_EXPORT DisplayPlacement { | 40 struct DISPLAY_MANAGER_EXPORT DisplayPlacement { |
| 41 // The id of the display this placement will be applied to. | 41 // The id of the display this placement will be applied to. |
| 42 int64_t display_id; | 42 int64_t display_id; |
| 43 | 43 |
| 44 // The parent display id to which the above display is placed. | 44 // The parent display id to which the above display is placed. |
| 45 int64_t parent_display_id; | 45 int64_t parent_display_id; |
| 46 | 46 |
| 47 // To which side the parent display the display is positioned. | 47 // To which side the parent display the display is positioned. |
| 48 enum Position { TOP, RIGHT, BOTTOM, LEFT }; | 48 enum Position { TOP, RIGHT, BOTTOM, LEFT }; |
| 49 Position position; | 49 Position position; |
| 50 | 50 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 71 | 71 |
| 72 DisplayPlacement& Swap(); | 72 DisplayPlacement& Swap(); |
| 73 | 73 |
| 74 std::string ToString() const; | 74 std::string ToString() const; |
| 75 | 75 |
| 76 static std::string PositionToString(Position position); | 76 static std::string PositionToString(Position position); |
| 77 static bool StringToPosition(const base::StringPiece& string, | 77 static bool StringToPosition(const base::StringPiece& string, |
| 78 Position* position); | 78 Position* position); |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 class DISPLAY_EXPORT DisplayLayout final { | 81 class DISPLAY_MANAGER_EXPORT DisplayLayout final { |
| 82 public: | 82 public: |
| 83 DisplayLayout(); | 83 DisplayLayout(); |
| 84 ~DisplayLayout(); | 84 ~DisplayLayout(); |
| 85 | 85 |
| 86 // Applies the layout to the displays in |display_list|. | 86 // Applies the layout to the displays in |display_list|. |
| 87 // |updated_ids| (optional) contains the ids for displays whose bounds have | 87 // |updated_ids| (optional) contains the ids for displays whose bounds have |
| 88 // changed. |minimum_offset_overlap| represents the minimum required overlap | 88 // changed. |minimum_offset_overlap| represents the minimum required overlap |
| 89 // between displays. | 89 // between displays. |
| 90 void ApplyToDisplayList(Displays* display_list, | 90 void ApplyToDisplayList(Displays* display_list, |
| 91 std::vector<int64_t>* updated_ids, | 91 std::vector<int64_t>* updated_ids, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 static bool ApplyDisplayPlacement(const DisplayPlacement& placement, | 124 static bool ApplyDisplayPlacement(const DisplayPlacement& placement, |
| 125 Displays* display_list, | 125 Displays* display_list, |
| 126 int minimum_offset_overlap); | 126 int minimum_offset_overlap); |
| 127 | 127 |
| 128 DISALLOW_COPY_AND_ASSIGN(DisplayLayout); | 128 DISALLOW_COPY_AND_ASSIGN(DisplayLayout); |
| 129 }; | 129 }; |
| 130 | 130 |
| 131 } // namespace display | 131 } // namespace display |
| 132 | 132 |
| 133 #endif // UI_DISPLAY_MANAGER_DISPLAY_LAYOUT_H_ | 133 #endif // UI_DISPLAY_MANAGER_DISPLAY_LAYOUT_H_ |
| OLD | NEW |