| 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 ui::ManagedDisplayInfo& display_info, | 81 const ui::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<ui::ManagedDisplayMode> native_mode = | 84 scoped_refptr<ui::ManagedDisplayMode> native_mode = |
| 84 new ui::ManagedDisplayMode(ui_native_mode->size(), | 85 new ui::ManagedDisplayMode(ui_native_mode->size(), |
| 85 ui_native_mode->refresh_rate(), | 86 ui_native_mode->refresh_rate(), |
| 86 ui_native_mode->is_interlaced(), true, 1.0, | 87 ui_native_mode->is_interlaced(), true, 1.0, |
| 87 display_info.device_scale_factor()); | 88 display_info.device_scale_factor()); |
| 88 | 89 |
| 89 return CreateInternalManagedDisplayModeList(native_mode); | 90 return ui::CreateInternalManagedDisplayModeList(native_mode); |
| 90 } | 91 } |
| 91 | 92 |
| 92 // static | 93 // static |
| 93 ui::ManagedDisplayInfo::ManagedDisplayModeList | 94 ui::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<ui::ManagedDisplayMode>>; | 98 std::map<std::pair<int, int>, scoped_refptr<ui::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 ui::InputDeviceManager::GetInstance()->RemoveObserver(this); | 159 ui::InputDeviceManager::GetInstance()->RemoveObserver(this); |
| 159 WmShell::Get()->RemoveShellObserver(this); | 160 WmShell::Get()->RemoveShellObserver(this); |
| 160 } | 161 } |
| 161 | 162 |
| 162 ui::MultipleDisplayState DisplayChangeObserver::GetStateForDisplayIds( | 163 ui::MultipleDisplayState DisplayChangeObserver::GetStateForDisplayIds( |
| 163 const ui::DisplayConfigurator::DisplayStateList& display_states) const { | 164 const ui::DisplayConfigurator::DisplayStateList& display_states) const { |
| 164 UpdateInternalDisplayId(display_states); | 165 UpdateInternalDisplayId(display_states); |
| 165 if (display_states.size() == 1) | 166 if (display_states.size() == 1) |
| 166 return ui::MULTIPLE_DISPLAY_STATE_SINGLE; | 167 return ui::MULTIPLE_DISPLAY_STATE_SINGLE; |
| 167 display::DisplayIdList list = | 168 display::DisplayIdList list = |
| 168 GenerateDisplayIdList(display_states.begin(), display_states.end(), | 169 ui::GenerateDisplayIdList(display_states.begin(), display_states.end(), |
| 169 [](const ui::DisplaySnapshot* display_state) { | 170 [](const ui::DisplaySnapshot* display_state) { |
| 170 return display_state->display_id(); | 171 return display_state->display_id(); |
| 171 }); | 172 }); |
| 172 | 173 |
| 173 const display::DisplayLayout& layout = Shell::GetInstance() | 174 const display::DisplayLayout& layout = Shell::GetInstance() |
| 174 ->display_manager() | 175 ->display_manager() |
| 175 ->layout_store() | 176 ->layout_store() |
| 176 ->GetRegisteredDisplayLayout(list); | 177 ->GetRegisteredDisplayLayout(list); |
| 177 return layout.mirrored ? ui::MULTIPLE_DISPLAY_STATE_DUAL_MIRROR | 178 return layout.mirrored ? ui::MULTIPLE_DISPLAY_STATE_DUAL_MIRROR |
| 178 : ui::MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED; | 179 : ui::MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED; |
| 179 } | 180 } |
| 180 | 181 |
| 181 bool DisplayChangeObserver::GetResolutionForDisplayId(int64_t display_id, | 182 bool DisplayChangeObserver::GetResolutionForDisplayId(int64_t display_id, |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 } | 315 } |
| 315 return 1.0f; | 316 return 1.0f; |
| 316 } | 317 } |
| 317 | 318 |
| 318 void DisplayChangeObserver::OnTouchscreenDeviceConfigurationChanged() { | 319 void DisplayChangeObserver::OnTouchscreenDeviceConfigurationChanged() { |
| 319 OnDisplayModeChanged( | 320 OnDisplayModeChanged( |
| 320 Shell::GetInstance()->display_configurator()->cached_displays()); | 321 Shell::GetInstance()->display_configurator()->cached_displays()); |
| 321 } | 322 } |
| 322 | 323 |
| 323 } // namespace ash | 324 } // namespace ash |
| OLD | NEW |