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) { | |
75 LOG(ERROR) << "default unified:" << default_unified; | |
Jun Mukai
2015/05/21 13:14:19
Remove this log
oshima
2015/05/21 16:35:04
Done.
| |
72 if (paired_layouts_.find(pair) == paired_layouts_.end()) | 76 if (paired_layouts_.find(pair) == paired_layouts_.end()) |
73 CreateDisplayLayout(pair); | 77 CreateDisplayLayout(pair); |
74 paired_layouts_[pair].mirrored = mirrored; | 78 paired_layouts_[pair].mirrored = mirrored; |
79 paired_layouts_[pair].default_unified = default_unified; | |
75 } | 80 } |
76 | 81 |
77 void DisplayLayoutStore::UpdatePrimaryDisplayId(const DisplayIdPair& pair, | 82 void DisplayLayoutStore::UpdatePrimaryDisplayId(const DisplayIdPair& pair, |
78 int64 display_id) { | 83 int64 display_id) { |
79 if (paired_layouts_.find(pair) == paired_layouts_.end()) | 84 if (paired_layouts_.find(pair) == paired_layouts_.end()) |
80 CreateDisplayLayout(pair); | 85 CreateDisplayLayout(pair); |
81 paired_layouts_[pair].primary_id = display_id; | 86 paired_layouts_[pair].primary_id = display_id; |
82 } | 87 } |
83 | 88 |
84 DisplayLayout DisplayLayoutStore::CreateDisplayLayout( | 89 DisplayLayout DisplayLayoutStore::CreateDisplayLayout( |
85 const DisplayIdPair& pair) { | 90 const DisplayIdPair& pair) { |
86 DisplayLayout layout = default_display_layout_; | 91 DisplayLayout layout = default_display_layout_; |
92 layout.default_unified = | |
93 Shell::GetInstance()->display_manager()->default_multi_display_mode() == | |
94 DisplayManager::UNIFIED; | |
87 layout.primary_id = pair.first; | 95 layout.primary_id = pair.first; |
88 paired_layouts_[pair] = layout; | 96 paired_layouts_[pair] = layout; |
89 return layout; | 97 return layout; |
90 } | 98 } |
91 | 99 |
92 } // namespace ash | 100 } // namespace ash |
OLD | NEW |