Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Side by Side Diff: ash/display/display_change_observer_chromeos.cc

Issue 1838833002: Move DisplayLayout and DisplayLayoutBuilder From ash To ui/display (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@screenwinmove
Patch Set: Fix comment Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/ash.gyp ('k') | ash/display/display_configuration_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ash/display/display_change_observer_chromeos.h" 5 #include "ash/display/display_change_observer_chromeos.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 #include <utility> 11 #include <utility>
12 #include <vector> 12 #include <vector>
13 13
14 #include "ash/ash_switches.h" 14 #include "ash/ash_switches.h"
15 #include "ash/display/display_info.h" 15 #include "ash/display/display_info.h"
16 #include "ash/display/display_layout_store.h" 16 #include "ash/display/display_layout_store.h"
17 #include "ash/display/display_manager.h" 17 #include "ash/display/display_manager.h"
18 #include "ash/display/display_util.h" 18 #include "ash/display/display_util.h"
19 #include "ash/shell.h" 19 #include "ash/shell.h"
20 #include "ash/touch/touchscreen_util.h" 20 #include "ash/touch/touchscreen_util.h"
21 #include "base/command_line.h" 21 #include "base/command_line.h"
22 #include "base/logging.h" 22 #include "base/logging.h"
23 #include "grit/ash_strings.h" 23 #include "grit/ash_strings.h"
24 #include "ui/base/l10n/l10n_util.h" 24 #include "ui/base/l10n/l10n_util.h"
25 #include "ui/base/user_activity/user_activity_detector.h" 25 #include "ui/base/user_activity/user_activity_detector.h"
26 #include "ui/compositor/dip_util.h" 26 #include "ui/compositor/dip_util.h"
27 #include "ui/display/manager/display_layout.h"
27 #include "ui/display/types/display_mode.h" 28 #include "ui/display/types/display_mode.h"
28 #include "ui/display/types/display_snapshot.h" 29 #include "ui/display/types/display_snapshot.h"
29 #include "ui/display/util/display_util.h" 30 #include "ui/display/util/display_util.h"
30 #include "ui/events/devices/device_data_manager.h" 31 #include "ui/events/devices/device_data_manager.h"
31 #include "ui/events/devices/touchscreen_device.h" 32 #include "ui/events/devices/touchscreen_device.h"
32 #include "ui/gfx/display.h" 33 #include "ui/gfx/display.h"
33 34
34 namespace ash { 35 namespace ash {
35 36
36 using ui::DisplayConfigurator; 37 using ui::DisplayConfigurator;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 DisplayChangeObserver::~DisplayChangeObserver() { 150 DisplayChangeObserver::~DisplayChangeObserver() {
150 ui::DeviceDataManager::GetInstance()->RemoveObserver(this); 151 ui::DeviceDataManager::GetInstance()->RemoveObserver(this);
151 Shell::GetInstance()->RemoveShellObserver(this); 152 Shell::GetInstance()->RemoveShellObserver(this);
152 } 153 }
153 154
154 ui::MultipleDisplayState DisplayChangeObserver::GetStateForDisplayIds( 155 ui::MultipleDisplayState DisplayChangeObserver::GetStateForDisplayIds(
155 const ui::DisplayConfigurator::DisplayStateList& display_states) const { 156 const ui::DisplayConfigurator::DisplayStateList& display_states) const {
156 UpdateInternalDisplayId(display_states); 157 UpdateInternalDisplayId(display_states);
157 if (display_states.size() == 1) 158 if (display_states.size() == 1)
158 return ui::MULTIPLE_DISPLAY_STATE_SINGLE; 159 return ui::MULTIPLE_DISPLAY_STATE_SINGLE;
159 DisplayIdList list = 160 display::DisplayIdList list =
160 GenerateDisplayIdList(display_states.begin(), display_states.end(), 161 GenerateDisplayIdList(display_states.begin(), display_states.end(),
161 [](const ui::DisplaySnapshot* display_state) { 162 [](const ui::DisplaySnapshot* display_state) {
162 return display_state->display_id(); 163 return display_state->display_id();
163 }); 164 });
164 165
165 const DisplayLayout& layout = Shell::GetInstance() 166 const display::DisplayLayout& layout = Shell::GetInstance()
166 ->display_manager() 167 ->display_manager()
167 ->layout_store() 168 ->layout_store()
168 ->GetRegisteredDisplayLayout(list); 169 ->GetRegisteredDisplayLayout(list);
169 return layout.mirrored ? ui::MULTIPLE_DISPLAY_STATE_DUAL_MIRROR : 170 return layout.mirrored ? ui::MULTIPLE_DISPLAY_STATE_DUAL_MIRROR :
170 ui::MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED; 171 ui::MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED;
171 } 172 }
172 173
173 bool DisplayChangeObserver::GetResolutionForDisplayId(int64_t display_id, 174 bool DisplayChangeObserver::GetResolutionForDisplayId(int64_t display_id,
174 gfx::Size* size) const { 175 gfx::Size* size) const {
175 DisplayMode mode; 176 DisplayMode mode;
176 if (!Shell::GetInstance()->display_manager()->GetSelectedModeForDisplayId( 177 if (!Shell::GetInstance()->display_manager()->GetSelectedModeForDisplayId(
177 display_id, &mode)) 178 display_id, &mode))
178 return false; 179 return false;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 } 304 }
304 return 1.0f; 305 return 1.0f;
305 } 306 }
306 307
307 void DisplayChangeObserver::OnTouchscreenDeviceConfigurationChanged() { 308 void DisplayChangeObserver::OnTouchscreenDeviceConfigurationChanged() {
308 OnDisplayModeChanged( 309 OnDisplayModeChanged(
309 Shell::GetInstance()->display_configurator()->cached_displays()); 310 Shell::GetInstance()->display_configurator()->cached_displays());
310 } 311 }
311 312
312 } // namespace ash 313 } // namespace ash
OLDNEW
« no previous file with comments | « ash/ash.gyp ('k') | ash/display/display_configuration_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698