| 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 #include "ui/display/display_layout_builder.h" | 5 #include "ui/display/display_layout_builder.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ui/display/display.h" |
| 10 |
| 9 namespace display { | 11 namespace display { |
| 10 | 12 |
| 11 DisplayLayoutBuilder::DisplayLayoutBuilder(const DisplayLayout& layout) | 13 DisplayLayoutBuilder::DisplayLayoutBuilder(const DisplayLayout& layout) |
| 12 : layout_(layout.Copy()) {} | 14 : layout_(layout.Copy()) {} |
| 13 | 15 |
| 14 DisplayLayoutBuilder::DisplayLayoutBuilder(int64_t primary_id) | 16 DisplayLayoutBuilder::DisplayLayoutBuilder(int64_t primary_id) |
| 15 : layout_(new DisplayLayout) { | 17 : layout_(new DisplayLayout) { |
| 16 layout_->primary_id = primary_id; | 18 layout_->primary_id = primary_id; |
| 17 } | 19 } |
| 18 | 20 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 DisplayPlacement::Position position, | 61 DisplayPlacement::Position position, |
| 60 int offset) { | 62 int offset) { |
| 61 layout_->placement_list.clear(); | 63 layout_->placement_list.clear(); |
| 62 AddDisplayPlacement(secondary_id, layout_->primary_id, position, offset); | 64 AddDisplayPlacement(secondary_id, layout_->primary_id, position, offset); |
| 63 return *this; | 65 return *this; |
| 64 } | 66 } |
| 65 | 67 |
| 66 std::unique_ptr<DisplayLayout> DisplayLayoutBuilder::Build() { | 68 std::unique_ptr<DisplayLayout> DisplayLayoutBuilder::Build() { |
| 67 std::sort(layout_->placement_list.begin(), layout_->placement_list.end(), | 69 std::sort(layout_->placement_list.begin(), layout_->placement_list.end(), |
| 68 [](const DisplayPlacement& a, const DisplayPlacement& b) { | 70 [](const DisplayPlacement& a, const DisplayPlacement& b) { |
| 69 return a.display_id < b.display_id; | 71 return CompareDisplayIds(a.display_id, b.display_id); |
| 70 }); | 72 }); |
| 71 return std::move(layout_); | 73 return std::move(layout_); |
| 72 } | 74 } |
| 73 | 75 |
| 74 } // namespace display | 76 } // namespace display |
| OLD | NEW |