1 // Copyright (c) 2013 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.
5 #ifndef ASH_DISPLAY_DISPLAY_LAYOUT_H_
6 #define ASH_DISPLAY_DISPLAY_LAYOUT_H_
11 #include "ash/ash_export.h"
12 #include "base/basictypes.h"
13 #include "base/compiler_specific.h"
17 template <typename T
> class JSONValueConverter
;
22 typedef std::pair
<int64
, int64
> DisplayIdPair
;
24 struct ASH_EXPORT DisplayLayout
{
25 // Layout options where the secondary display should be positioned.
33 // Factory method to create DisplayLayout from ints. The |mirrored| is
34 // set to false and |primary_id| is set to gfx::Display::kInvalidDisplayId.
35 // Used for persistence and webui.
36 static DisplayLayout
FromInts(int position
, int offsets
);
39 DisplayLayout(Position position
, int offset
);
41 // Returns an inverted display layout.
42 DisplayLayout
Invert() const WARN_UNUSED_RESULT
;
44 // Converter functions to/from base::Value.
45 static bool ConvertFromValue(const base::Value
& value
, DisplayLayout
* layout
);
46 static bool ConvertToValue(const DisplayLayout
& layout
, base::Value
* value
);
48 // This method is used by base::JSONValueConverter, you don't need to call
49 // this directly. Instead consider using converter functions above.
50 static void RegisterJSONConverter(
51 base::JSONValueConverter
<DisplayLayout
>* converter
);
55 // The offset of the position of the secondary display. The offset is
56 // based on the top/left edge of the primary display.
59 // True if displays are mirrored.
62 // True if multi displays should default to unified mode.
65 // The id of the display used as a primary display.
68 // Returns string representation of the layout for debugging/testing.
69 // This includes "unified" only if the unified desktop feature is enabled.
70 std::string
ToString() const;