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