| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef UI_DISPLAY_MANAGER_DISPLAY_LAYOUT_BUILDER_H_ | |
| 6 #define UI_DISPLAY_MANAGER_DISPLAY_LAYOUT_BUILDER_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 #include "ui/display/display_export.h" | |
| 12 #include "ui/display/manager/display_layout.h" | |
| 13 | |
| 14 namespace display { | |
| 15 | |
| 16 class DisplayLayout; | |
| 17 | |
| 18 // A utility class to create a DisplayLayout instance. | |
| 19 class DISPLAY_EXPORT DisplayLayoutBuilder final { | |
| 20 public: | |
| 21 // Creates a builder that uses a copy of the |layout| as a source. | |
| 22 explicit DisplayLayoutBuilder(const DisplayLayout& layout); | |
| 23 | |
| 24 // Creates a builder with the primary display id. | |
| 25 explicit DisplayLayoutBuilder(int64_t primary_id); | |
| 26 | |
| 27 ~DisplayLayoutBuilder(); | |
| 28 | |
| 29 DisplayLayoutBuilder& SetDefaultUnified(bool default_unified); | |
| 30 | |
| 31 DisplayLayoutBuilder& SetMirrored(bool mirrored); | |
| 32 | |
| 33 DisplayLayoutBuilder& ClearPlacements(); | |
| 34 | |
| 35 // Adds a display placement. | |
| 36 DisplayLayoutBuilder& AddDisplayPlacement(int64_t display_id, | |
| 37 int64_t parent_id, | |
| 38 DisplayPlacement::Position position, | |
| 39 int offset); | |
| 40 | |
| 41 // Adds a display placement. | |
| 42 DisplayLayoutBuilder& AddDisplayPlacement( | |
| 43 const DisplayPlacement& placement); | |
| 44 | |
| 45 // Sets the display placement for the secondary display. | |
| 46 DisplayLayoutBuilder& SetSecondaryPlacement( | |
| 47 int64_t secondary_id, | |
| 48 DisplayPlacement::Position position, | |
| 49 int offset); | |
| 50 | |
| 51 // Returns the DisplayLayout. After this call, the builder becomes invalid. | |
| 52 std::unique_ptr<DisplayLayout> Build(); | |
| 53 | |
| 54 private: | |
| 55 std::unique_ptr<DisplayLayout> layout_; | |
| 56 | |
| 57 DISALLOW_COPY_AND_ASSIGN(DisplayLayoutBuilder); | |
| 58 }; | |
| 59 | |
| 60 } // namespace display | |
| 61 | |
| 62 #endif // UI_DISPLAY_MANAGER_DISPLAY_LAYOUT_BUILDER_H_ | |
| OLD | NEW |