| 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 "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/common/ash_switches.h" | 14 #include "ash/common/ash_switches.h" |
| 15 #include "ash/common/wm_shell.h" | 15 #include "ash/common/wm_shell.h" |
| 16 #include "ash/display/display_manager.h" | 16 #include "ash/display/display_manager.h" |
| 17 #include "ash/display/display_util.h" | 17 #include "ash/display/display_util.h" |
| 18 #include "ash/shell.h" | 18 #include "ash/shell.h" |
| 19 #include "ash/touch/touchscreen_util.h" | 19 #include "ash/touch/touchscreen_util.h" |
| 20 #include "base/command_line.h" | 20 #include "base/command_line.h" |
| 21 #include "base/logging.h" | 21 #include "base/logging.h" |
| 22 #include "grit/ash_strings.h" | 22 #include "grit/ash_strings.h" |
| 23 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
| 24 #include "ui/base/user_activity/user_activity_detector.h" | 24 #include "ui/base/user_activity/user_activity_detector.h" |
| 25 #include "ui/compositor/dip_util.h" | 25 #include "ui/compositor/dip_util.h" |
| 26 #include "ui/display/display.h" | 26 #include "ui/display/display.h" |
| 27 #include "ui/display/manager/display_layout.h" | 27 #include "ui/display/manager/display_layout.h" |
| 28 #include "ui/display/manager/display_layout_store.h" | 28 #include "ui/display/manager/display_layout_store.h" |
| 29 #include "ui/display/manager/display_manager_utilities.h" |
| 29 #include "ui/display/types/display_mode.h" | 30 #include "ui/display/types/display_mode.h" |
| 30 #include "ui/display/types/display_snapshot.h" | 31 #include "ui/display/types/display_snapshot.h" |
| 31 #include "ui/display/util/display_util.h" | 32 #include "ui/display/util/display_util.h" |
| 32 #include "ui/events/devices/input_device_manager.h" | 33 #include "ui/events/devices/input_device_manager.h" |
| 33 #include "ui/events/devices/touchscreen_device.h" | 34 #include "ui/events/devices/touchscreen_device.h" |
| 34 | 35 |
| 35 namespace ash { | 36 namespace ash { |
| 36 | 37 |
| 37 using ui::DisplayConfigurator; | 38 using ui::DisplayConfigurator; |
| 38 | 39 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 DisplayChangeObserver::GetInternalManagedDisplayModeList( | 80 DisplayChangeObserver::GetInternalManagedDisplayModeList( |
| 80 const display::ManagedDisplayInfo& display_info, | 81 const display::ManagedDisplayInfo& display_info, |
| 81 const ui::DisplaySnapshot& output) { | 82 const ui::DisplaySnapshot& output) { |
| 82 const ui::DisplayMode* ui_native_mode = output.native_mode(); | 83 const ui::DisplayMode* ui_native_mode = output.native_mode(); |
| 83 scoped_refptr<display::ManagedDisplayMode> native_mode = | 84 scoped_refptr<display::ManagedDisplayMode> native_mode = |
| 84 new display::ManagedDisplayMode(ui_native_mode->size(), | 85 new display::ManagedDisplayMode(ui_native_mode->size(), |
| 85 ui_native_mode->refresh_rate(), | 86 ui_native_mode->refresh_rate(), |
| 86 ui_native_mode->is_interlaced(), true, | 87 ui_native_mode->is_interlaced(), true, |
| 87 1.0, display_info.device_scale_factor()); | 88 1.0, display_info.device_scale_factor()); |
| 88 | 89 |
| 89 return CreateInternalManagedDisplayModeList(native_mode); | 90 return display::CreateInternalManagedDisplayModeList(native_mode); |
| 90 } | 91 } |
| 91 | 92 |
| 92 // static | 93 // static |
| 93 display::ManagedDisplayInfo::ManagedDisplayModeList | 94 display::ManagedDisplayInfo::ManagedDisplayModeList |
| 94 DisplayChangeObserver::GetExternalManagedDisplayModeList( | 95 DisplayChangeObserver::GetExternalManagedDisplayModeList( |
| 95 const ui::DisplaySnapshot& output) { | 96 const ui::DisplaySnapshot& output) { |
| 96 using DisplayModeMap = | 97 using DisplayModeMap = |
| 97 std::map<std::pair<int, int>, scoped_refptr<display::ManagedDisplayMode>>; | 98 std::map<std::pair<int, int>, scoped_refptr<display::ManagedDisplayMode>>; |
| 98 DisplayModeMap display_mode_map; | 99 DisplayModeMap display_mode_map; |
| 99 | 100 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 DisplayChangeObserver::~DisplayChangeObserver() { | 159 DisplayChangeObserver::~DisplayChangeObserver() { |
| 159 ui::InputDeviceManager::GetInstance()->RemoveObserver(this); | 160 ui::InputDeviceManager::GetInstance()->RemoveObserver(this); |
| 160 WmShell::Get()->RemoveShellObserver(this); | 161 WmShell::Get()->RemoveShellObserver(this); |
| 161 } | 162 } |
| 162 | 163 |
| 163 ui::MultipleDisplayState DisplayChangeObserver::GetStateForDisplayIds( | 164 ui::MultipleDisplayState DisplayChangeObserver::GetStateForDisplayIds( |
| 164 const ui::DisplayConfigurator::DisplayStateList& display_states) const { | 165 const ui::DisplayConfigurator::DisplayStateList& display_states) const { |
| 165 UpdateInternalDisplayId(display_states); | 166 UpdateInternalDisplayId(display_states); |
| 166 if (display_states.size() == 1) | 167 if (display_states.size() == 1) |
| 167 return ui::MULTIPLE_DISPLAY_STATE_SINGLE; | 168 return ui::MULTIPLE_DISPLAY_STATE_SINGLE; |
| 168 display::DisplayIdList list = | 169 display::DisplayIdList list = display::GenerateDisplayIdList( |
| 169 GenerateDisplayIdList(display_states.begin(), display_states.end(), | 170 display_states.begin(), display_states.end(), |
| 170 [](const ui::DisplaySnapshot* display_state) { | 171 [](const ui::DisplaySnapshot* display_state) { |
| 171 return display_state->display_id(); | 172 return display_state->display_id(); |
| 172 }); | 173 }); |
| 173 | 174 |
| 174 const display::DisplayLayout& layout = Shell::GetInstance() | 175 const display::DisplayLayout& layout = Shell::GetInstance() |
| 175 ->display_manager() | 176 ->display_manager() |
| 176 ->layout_store() | 177 ->layout_store() |
| 177 ->GetRegisteredDisplayLayout(list); | 178 ->GetRegisteredDisplayLayout(list); |
| 178 return layout.mirrored ? ui::MULTIPLE_DISPLAY_STATE_DUAL_MIRROR | 179 return layout.mirrored ? ui::MULTIPLE_DISPLAY_STATE_DUAL_MIRROR |
| 179 : ui::MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED; | 180 : ui::MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED; |
| 180 } | 181 } |
| 181 | 182 |
| 182 bool DisplayChangeObserver::GetResolutionForDisplayId(int64_t display_id, | 183 bool DisplayChangeObserver::GetResolutionForDisplayId(int64_t display_id, |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 } | 316 } |
| 316 return 1.0f; | 317 return 1.0f; |
| 317 } | 318 } |
| 318 | 319 |
| 319 void DisplayChangeObserver::OnTouchscreenDeviceConfigurationChanged() { | 320 void DisplayChangeObserver::OnTouchscreenDeviceConfigurationChanged() { |
| 320 OnDisplayModeChanged( | 321 OnDisplayModeChanged( |
| 321 Shell::GetInstance()->display_configurator()->cached_displays()); | 322 Shell::GetInstance()->display_configurator()->cached_displays()); |
| 322 } | 323 } |
| 323 | 324 |
| 324 } // namespace ash | 325 } // namespace ash |
| OLD | NEW |