| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 ASH_DISPLAY_DISPLAY_LAYOUT_STORE_H_ | 5 #ifndef ASH_DISPLAY_DISPLAY_LAYOUT_STORE_H_ |
| 6 #define ASH_DISPLAY_DISPLAY_LAYOUT_STORE_H_ | 6 #define ASH_DISPLAY_DISPLAY_LAYOUT_STORE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 | 11 |
| 12 #include "ash/ash_export.h" | 12 #include "ash/ash_export.h" |
| 13 #include "ash/display/display_layout.h" | 13 #include "ash/display/display_layout.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 | 15 |
| 16 namespace ash { | 16 namespace ash { |
| 17 | 17 |
| 18 class ASH_EXPORT DisplayLayoutStore { | 18 class ASH_EXPORT DisplayLayoutStore { |
| 19 public: | 19 public: |
| 20 DisplayLayoutStore(); | 20 DisplayLayoutStore(); |
| 21 ~DisplayLayoutStore(); | 21 ~DisplayLayoutStore(); |
| 22 | 22 |
| 23 const DisplayLayout& default_display_layout() const { | 23 const DisplayLayout& default_display_layout() const { |
| 24 return default_display_layout_; | 24 return default_display_layout_; |
| 25 } | 25 } |
| 26 void SetDefaultDisplayLayout(const DisplayLayout& layout); | 26 void SetDefaultDisplayLayout(const DisplayLayout& layout); |
| 27 | 27 |
| 28 // Registeres the display layout info for the specified display(s). | 28 // Registeres the display layout info for the specified display(s). |
| 29 void RegisterLayoutForDisplayIdPair(int64_t id1, | 29 void RegisterLayoutForDisplayIdList(int64_t id1, |
| 30 int64_t id2, | 30 int64_t id2, |
| 31 const DisplayLayout& layout); | 31 const DisplayLayout& layout); |
| 32 | 32 |
| 33 // If no layout is registered, it creatas new layout using | 33 // If no layout is registered, it creatas new layout using |
| 34 // |default_display_layout_|. | 34 // |default_display_layout_|. |
| 35 DisplayLayout GetRegisteredDisplayLayout(const DisplayIdPair& pair); | 35 DisplayLayout GetRegisteredDisplayLayout(const DisplayIdList& list); |
| 36 | 36 |
| 37 // Returns the display layout for the display id pair | 37 // Returns the display layout for the display id list |
| 38 // with display swapping applied. That is, this returns | 38 // with display swapping applied. That is, this returns |
| 39 // flipped layout if the displays are swapped. | 39 // flipped layout if the displays are swapped. |
| 40 DisplayLayout ComputeDisplayLayoutForDisplayIdPair( | 40 DisplayLayout ComputeDisplayLayoutForDisplayIdList( |
| 41 const DisplayIdPair& display_pair); | 41 const DisplayIdList& display_list); |
| 42 | 42 |
| 43 // Update the multi display state in the display layout for | 43 // Update the multi display state in the display layout for |
| 44 // |display_pair|. This creates new display layout if no layout is | 44 // |display_list|. This creates new display layout if no layout is |
| 45 // registered for |display_pair|. | 45 // registered for |display_list|. |
| 46 void UpdateMultiDisplayState(const DisplayIdPair& display_pair, | 46 void UpdateMultiDisplayState(const DisplayIdList& display_list, |
| 47 bool mirrored, | 47 bool mirrored, |
| 48 bool default_unified); | 48 bool default_unified); |
| 49 | 49 |
| 50 // Update the |primary_id| in the display layout for | 50 // Update the |primary_id| in the display layout for |
| 51 // |display_pair|. This creates new display layout if no layout is | 51 // |display_list|. This creates new display layout if no layout is |
| 52 // registered for |display_pair|. | 52 // registered for |display_list|. |
| 53 void UpdatePrimaryDisplayId(const DisplayIdPair& display_pair, | 53 void UpdatePrimaryDisplayId(const DisplayIdList& display_list, |
| 54 int64_t display_id); | 54 int64_t display_id); |
| 55 | 55 |
| 56 private: | 56 private: |
| 57 // Creates new layout for display pair from |default_display_layout_|. | 57 // Creates new layout for display list from |default_display_layout_|. |
| 58 DisplayLayout CreateDisplayLayout(const DisplayIdPair& display_pair); | 58 DisplayLayout CreateDisplayLayout(const DisplayIdList& display_list); |
| 59 | 59 |
| 60 // The default display layout. | 60 // The default display layout. |
| 61 DisplayLayout default_display_layout_; | 61 DisplayLayout default_display_layout_; |
| 62 | 62 |
| 63 // Display layout per pair of devices. | 63 // Display layout per list of devices. |
| 64 std::map<DisplayIdPair, DisplayLayout> paired_layouts_; | 64 std::map<DisplayIdList, DisplayLayout> layouts_; |
| 65 | 65 |
| 66 DISALLOW_COPY_AND_ASSIGN(DisplayLayoutStore); | 66 DISALLOW_COPY_AND_ASSIGN(DisplayLayoutStore); |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 } // namespace ash | 69 } // namespace ash |
| 70 | 70 |
| 71 #endif // ASH_DISPLAY_DISPLAY_LAYOUT_STORE_H_ | 71 #endif // ASH_DISPLAY_DISPLAY_LAYOUT_STORE_H_ |
| OLD | NEW |