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 #include <stdio.h> | 5 #include <stdio.h> |
6 | 6 |
7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/display/display_layout_store.h" | 8 #include "ash/display/display_layout_store.h" |
9 #include "ash/display/display_manager.h" | 9 #include "ash/display/display_manager.h" |
10 #include "ash/display/display_util.h" | 10 #include "ash/display/display_util.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 DisplayLayoutStore::~DisplayLayoutStore() { | 39 DisplayLayoutStore::~DisplayLayoutStore() { |
40 } | 40 } |
41 | 41 |
42 void DisplayLayoutStore::SetDefaultDisplayLayout(const DisplayLayout& layout) { | 42 void DisplayLayoutStore::SetDefaultDisplayLayout(const DisplayLayout& layout) { |
43 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 43 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
44 if (!command_line->HasSwitch(switches::kAshSecondaryDisplayLayout)) | 44 if (!command_line->HasSwitch(switches::kAshSecondaryDisplayLayout)) |
45 default_display_layout_ = layout; | 45 default_display_layout_ = layout; |
46 } | 46 } |
47 | 47 |
48 void DisplayLayoutStore::RegisterLayoutForDisplayIdPair( | 48 void DisplayLayoutStore::RegisterLayoutForDisplayIdPair( |
49 int64 id1, | 49 int64_t id1, |
50 int64 id2, | 50 int64_t id2, |
51 const DisplayLayout& layout) { | 51 const DisplayLayout& layout) { |
52 auto key = CreateDisplayIdPair(id1, id2); | 52 auto key = CreateDisplayIdPair(id1, id2); |
53 paired_layouts_[key] = layout; | 53 paired_layouts_[key] = layout; |
54 } | 54 } |
55 | 55 |
56 DisplayLayout DisplayLayoutStore::GetRegisteredDisplayLayout( | 56 DisplayLayout DisplayLayoutStore::GetRegisteredDisplayLayout( |
57 const DisplayIdPair& pair) { | 57 const DisplayIdPair& pair) { |
58 std::map<DisplayIdPair, DisplayLayout>::const_iterator iter = | 58 std::map<DisplayIdPair, DisplayLayout>::const_iterator iter = |
59 paired_layouts_.find(pair); | 59 paired_layouts_.find(pair); |
60 return | 60 return |
(...skipping 13 matching lines...) Expand all Loading... |
74 void DisplayLayoutStore::UpdateMultiDisplayState(const DisplayIdPair& pair, | 74 void DisplayLayoutStore::UpdateMultiDisplayState(const DisplayIdPair& pair, |
75 bool mirrored, | 75 bool mirrored, |
76 bool default_unified) { | 76 bool default_unified) { |
77 if (paired_layouts_.find(pair) == paired_layouts_.end()) | 77 if (paired_layouts_.find(pair) == paired_layouts_.end()) |
78 CreateDisplayLayout(pair); | 78 CreateDisplayLayout(pair); |
79 paired_layouts_[pair].mirrored = mirrored; | 79 paired_layouts_[pair].mirrored = mirrored; |
80 paired_layouts_[pair].default_unified = default_unified; | 80 paired_layouts_[pair].default_unified = default_unified; |
81 } | 81 } |
82 | 82 |
83 void DisplayLayoutStore::UpdatePrimaryDisplayId(const DisplayIdPair& pair, | 83 void DisplayLayoutStore::UpdatePrimaryDisplayId(const DisplayIdPair& pair, |
84 int64 display_id) { | 84 int64_t display_id) { |
85 if (paired_layouts_.find(pair) == paired_layouts_.end()) | 85 if (paired_layouts_.find(pair) == paired_layouts_.end()) |
86 CreateDisplayLayout(pair); | 86 CreateDisplayLayout(pair); |
87 paired_layouts_[pair].primary_id = display_id; | 87 paired_layouts_[pair].primary_id = display_id; |
88 } | 88 } |
89 | 89 |
90 DisplayLayout DisplayLayoutStore::CreateDisplayLayout( | 90 DisplayLayout DisplayLayoutStore::CreateDisplayLayout( |
91 const DisplayIdPair& pair) { | 91 const DisplayIdPair& pair) { |
92 DisplayLayout layout = default_display_layout_; | 92 DisplayLayout layout = default_display_layout_; |
93 layout.primary_id = pair.first; | 93 layout.primary_id = pair.first; |
94 paired_layouts_[pair] = layout; | 94 paired_layouts_[pair] = layout; |
95 return layout; | 95 return layout; |
96 } | 96 } |
97 | 97 |
98 } // namespace ash | 98 } // namespace ash |
OLD | NEW |