Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
|
oshima
2016/04/07 19:54:21
I think we don't update when just moving the file,
robliao
2016/04/07 20:10:21
The format was wrong, so I'll keep the change.
oshima
2016/04/07 20:59:28
That was the valid format back then. just fyi.
robliao
2016/04/07 21:13:49
Good to know. Thanks for the info!
| |
| 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 ASH_DISPLAY_DISPLAY_LAYOUT_H_ | 5 #ifndef UI_DISPLAY_MANAGER_DISPLAY_LAYOUT_H_ |
| 6 #define ASH_DISPLAY_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 <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "ash/ash_export.h" | |
| 14 #include "base/macros.h" | 13 #include "base/macros.h" |
| 15 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/strings/string_piece.h" | 15 #include "base/strings/string_piece.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 gfx { | 23 namespace gfx { |
| 24 class Display; | 24 class Display; |
| 25 } | 25 } |
| 26 | 26 |
| 27 namespace ash { | 27 namespace display { |
| 28 | 28 |
| 29 // An identifier used to manage display layout in DisplayManager / | 29 // An identifier used to manage display layout in DisplayManager / |
| 30 // DisplayLayoutStore. | 30 // DisplayLayoutStore. |
| 31 using DisplayIdList = std::vector<int64_t>; | 31 using DisplayIdList = std::vector<int64_t>; |
| 32 | 32 |
| 33 using DisplayList = std::vector<gfx::Display>; | 33 using DisplayList = std::vector<gfx::Display>; |
| 34 | 34 |
| 35 // DisplayPlacement specifies where the display (D) is placed relative | 35 // DisplayPlacement specifies where the display (D) is placed relative |
| 36 // to parent (P) display. In the following example, the display (D) | 36 // to parent (P) display. In the following example, the display (D) |
| 37 // given by |display_id| is placed at the left side of the parent | 37 // given by |display_id| is placed at the left side of the parent |
| 38 // display (P) given by |parent_display_id|, with a negative offset. | 38 // display (P) given by |parent_display_id|, with a negative offset. |
| 39 // | 39 // |
| 40 // + +--------+ | 40 // + +--------+ |
| 41 // offset | | | | 41 // offset | | | |
| 42 // + | D +--------+ | 42 // + | D +--------+ |
| 43 // | | | | 43 // | | | |
| 44 // +--------+ P | | 44 // +--------+ P | |
| 45 // | | | 45 // | | |
| 46 // +--------+ | 46 // +--------+ |
| 47 // | 47 // |
| 48 struct ASH_EXPORT DisplayPlacement { | 48 struct DISPLAY_EXPORT DisplayPlacement { |
| 49 // The id of the display this placement will be applied to. | 49 // The id of the display this placement will be applied to. |
| 50 int64_t display_id; | 50 int64_t display_id; |
| 51 | 51 |
| 52 // The parent display id to which the above display is placed. | 52 // The parent display id to which the above display is placed. |
| 53 int64_t parent_display_id; | 53 int64_t parent_display_id; |
| 54 | 54 |
| 55 // To which side the parent display the display is positioned. | 55 // To which side the parent display the display is positioned. |
| 56 enum Position { TOP, RIGHT, BOTTOM, LEFT }; | 56 enum Position { TOP, RIGHT, BOTTOM, LEFT }; |
| 57 Position position; | 57 Position position; |
| 58 | 58 |
| 59 // The offset of the position of the secondary display. The offset is | 59 // The offset of the position of the secondary display. The offset is |
| 60 // based on the top/left edge of the primary display. | 60 // based on the top/left edge of the primary display. |
| 61 int offset; | 61 int offset; |
| 62 | 62 |
| 63 DisplayPlacement(Position position, int offset); | 63 DisplayPlacement(Position position, int offset); |
| 64 DisplayPlacement(); | 64 DisplayPlacement(); |
| 65 DisplayPlacement(const DisplayPlacement& placement); | 65 DisplayPlacement(const DisplayPlacement& placement); |
| 66 | 66 |
| 67 DisplayPlacement& Swap(); | 67 DisplayPlacement& Swap(); |
| 68 | 68 |
| 69 std::string ToString() const; | 69 std::string ToString() const; |
| 70 | 70 |
| 71 static std::string PositionToString(Position position); | 71 static std::string PositionToString(Position position); |
| 72 static bool StringToPosition(const base::StringPiece& string, | 72 static bool StringToPosition(const base::StringPiece& string, |
| 73 Position* position); | 73 Position* position); |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 class ASH_EXPORT DisplayLayout final { | 76 class DISPLAY_EXPORT DisplayLayout final { |
| 77 public: | 77 public: |
| 78 DisplayLayout(); | 78 DisplayLayout(); |
| 79 ~DisplayLayout(); | 79 ~DisplayLayout(); |
| 80 | 80 |
| 81 // Validates the layout object. | 81 // Validates the layout object. |
| 82 static bool Validate(const DisplayIdList& list, const DisplayLayout& layout); | 82 static bool Validate(const DisplayIdList& list, const DisplayLayout& layout); |
| 83 | 83 |
| 84 std::vector<DisplayPlacement> placement_list; | 84 std::vector<DisplayPlacement> placement_list; |
| 85 | 85 |
| 86 // True if displays are mirrored. | 86 // True if displays are mirrored. |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 102 std::string ToString() const; | 102 std::string ToString() const; |
| 103 | 103 |
| 104 // Returns the DisplayPlacement entry matching |display_id| if it exists, | 104 // Returns the DisplayPlacement entry matching |display_id| if it exists, |
| 105 // otherwise returns a DisplayPlacement with an invalid display id. | 105 // otherwise returns a DisplayPlacement with an invalid display id. |
| 106 DisplayPlacement FindPlacementById(int64_t display_id) const; | 106 DisplayPlacement FindPlacementById(int64_t display_id) const; |
| 107 | 107 |
| 108 private: | 108 private: |
| 109 DISALLOW_COPY_AND_ASSIGN(DisplayLayout); | 109 DISALLOW_COPY_AND_ASSIGN(DisplayLayout); |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 } // namespace ash | 112 } // namespace display |
| 113 | 113 |
| 114 #endif | 114 #endif // UI_DISPLAY_MANAGER_DISPLAY_LAYOUT_H_ |
| OLD | NEW |