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" |
| 10 #include "ash/shell.h" |
9 #include "base/command_line.h" | 11 #include "base/command_line.h" |
10 #include "base/logging.h" | 12 #include "base/logging.h" |
11 #include "ui/gfx/display.h" | 13 #include "ui/gfx/display.h" |
12 | 14 |
13 namespace ash { | 15 namespace ash { |
14 | 16 |
15 DisplayLayoutStore::DisplayLayoutStore() { | 17 DisplayLayoutStore::DisplayLayoutStore() { |
16 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 18 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
17 if (command_line->HasSwitch(switches::kAshSecondaryDisplayLayout)) { | 19 if (command_line->HasSwitch(switches::kAshSecondaryDisplayLayout)) { |
18 std::string value = command_line->GetSwitchValueASCII( | 20 std::string value = command_line->GetSwitchValueASCII( |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 DisplayLayout DisplayLayoutStore::ComputeDisplayLayoutForDisplayIdPair( | 62 DisplayLayout DisplayLayoutStore::ComputeDisplayLayoutForDisplayIdPair( |
61 const DisplayIdPair& pair) { | 63 const DisplayIdPair& pair) { |
62 DisplayLayout layout = GetRegisteredDisplayLayout(pair); | 64 DisplayLayout layout = GetRegisteredDisplayLayout(pair); |
63 DCHECK_NE(layout.primary_id, gfx::Display::kInvalidDisplayID); | 65 DCHECK_NE(layout.primary_id, gfx::Display::kInvalidDisplayID); |
64 // Invert if the primary was swapped. If mirrored, first is always | 66 // Invert if the primary was swapped. If mirrored, first is always |
65 // primary. | 67 // primary. |
66 return (layout.primary_id == gfx::Display::kInvalidDisplayID || | 68 return (layout.primary_id == gfx::Display::kInvalidDisplayID || |
67 pair.first == layout.primary_id) ? layout : layout.Invert(); | 69 pair.first == layout.primary_id) ? layout : layout.Invert(); |
68 } | 70 } |
69 | 71 |
70 void DisplayLayoutStore::UpdateMirrorStatus(const DisplayIdPair& pair, | 72 void DisplayLayoutStore::UpdateMultiDisplayState(const DisplayIdPair& pair, |
71 bool mirrored) { | 73 bool mirrored, |
| 74 bool default_unified) { |
72 if (paired_layouts_.find(pair) == paired_layouts_.end()) | 75 if (paired_layouts_.find(pair) == paired_layouts_.end()) |
73 CreateDisplayLayout(pair); | 76 CreateDisplayLayout(pair); |
74 paired_layouts_[pair].mirrored = mirrored; | 77 paired_layouts_[pair].mirrored = mirrored; |
| 78 paired_layouts_[pair].default_unified = default_unified; |
75 } | 79 } |
76 | 80 |
77 void DisplayLayoutStore::UpdatePrimaryDisplayId(const DisplayIdPair& pair, | 81 void DisplayLayoutStore::UpdatePrimaryDisplayId(const DisplayIdPair& pair, |
78 int64 display_id) { | 82 int64 display_id) { |
79 if (paired_layouts_.find(pair) == paired_layouts_.end()) | 83 if (paired_layouts_.find(pair) == paired_layouts_.end()) |
80 CreateDisplayLayout(pair); | 84 CreateDisplayLayout(pair); |
81 paired_layouts_[pair].primary_id = display_id; | 85 paired_layouts_[pair].primary_id = display_id; |
82 } | 86 } |
83 | 87 |
84 DisplayLayout DisplayLayoutStore::CreateDisplayLayout( | 88 DisplayLayout DisplayLayoutStore::CreateDisplayLayout( |
85 const DisplayIdPair& pair) { | 89 const DisplayIdPair& pair) { |
86 DisplayLayout layout = default_display_layout_; | 90 DisplayLayout layout = default_display_layout_; |
| 91 layout.default_unified = |
| 92 Shell::GetInstance()->display_manager()->default_multi_display_mode() == |
| 93 DisplayManager::UNIFIED; |
87 layout.primary_id = pair.first; | 94 layout.primary_id = pair.first; |
88 paired_layouts_[pair] = layout; | 95 paired_layouts_[pair] = layout; |
89 return layout; | 96 return layout; |
90 } | 97 } |
91 | 98 |
92 } // namespace ash | 99 } // namespace ash |
OLD | NEW |