| 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/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/display.h" |
| 27 #include "ui/display/manager/display_layout.h" | 28 #include "ui/display/manager/display_layout.h" |
| 28 #include "ui/display/types/display_mode.h" | 29 #include "ui/display/types/display_mode.h" |
| 29 #include "ui/display/types/display_snapshot.h" | 30 #include "ui/display/types/display_snapshot.h" |
| 30 #include "ui/display/util/display_util.h" | 31 #include "ui/display/util/display_util.h" |
| 31 #include "ui/events/devices/device_data_manager.h" | 32 #include "ui/events/devices/device_data_manager.h" |
| 32 #include "ui/events/devices/touchscreen_device.h" | 33 #include "ui/events/devices/touchscreen_device.h" |
| 33 #include "ui/gfx/display.h" | |
| 34 | 34 |
| 35 namespace ash { | 35 namespace ash { |
| 36 | 36 |
| 37 using ui::DisplayConfigurator; | 37 using ui::DisplayConfigurator; |
| 38 | 38 |
| 39 namespace { | 39 namespace { |
| 40 | 40 |
| 41 // The DPI threshold to determine the device scale factor. | 41 // The DPI threshold to determine the device scale factor. |
| 42 // DPI higher than |dpi| will use |device_scale_factor|. | 42 // DPI higher than |dpi| will use |device_scale_factor|. |
| 43 struct DeviceScaleFactorDPIThreshold { | 43 struct DeviceScaleFactorDPIThreshold { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 58 const int kMinimumWidthFor4K = 3840; | 58 const int kMinimumWidthFor4K = 3840; |
| 59 | 59 |
| 60 // The list of device scale factors (in addition to 1.0f) which is | 60 // The list of device scale factors (in addition to 1.0f) which is |
| 61 // available in extrenal large monitors. | 61 // available in extrenal large monitors. |
| 62 const float kAdditionalDeviceScaleFactorsFor4k[] = {1.25f, 2.0f}; | 62 const float kAdditionalDeviceScaleFactorsFor4k[] = {1.25f, 2.0f}; |
| 63 | 63 |
| 64 void UpdateInternalDisplayId( | 64 void UpdateInternalDisplayId( |
| 65 const ui::DisplayConfigurator::DisplayStateList& display_states) { | 65 const ui::DisplayConfigurator::DisplayStateList& display_states) { |
| 66 for (auto* state : display_states) { | 66 for (auto* state : display_states) { |
| 67 if (state->type() == ui::DISPLAY_CONNECTION_TYPE_INTERNAL) { | 67 if (state->type() == ui::DISPLAY_CONNECTION_TYPE_INTERNAL) { |
| 68 if (gfx::Display::HasInternalDisplay()) | 68 if (display::Display::HasInternalDisplay()) |
| 69 DCHECK_EQ(gfx::Display::InternalDisplayId(), state->display_id()); | 69 DCHECK_EQ(display::Display::InternalDisplayId(), state->display_id()); |
| 70 gfx::Display::SetInternalDisplayId(state->display_id()); | 70 display::Display::SetInternalDisplayId(state->display_id()); |
| 71 } | 71 } |
| 72 } | 72 } |
| 73 } | 73 } |
| 74 | 74 |
| 75 } // namespace | 75 } // namespace |
| 76 | 76 |
| 77 // static | 77 // static |
| 78 std::vector<DisplayMode> DisplayChangeObserver::GetInternalDisplayModeList( | 78 std::vector<DisplayMode> DisplayChangeObserver::GetInternalDisplayModeList( |
| 79 const DisplayInfo& display_info, | 79 const DisplayInfo& display_info, |
| 80 const ui::DisplaySnapshot& output) { | 80 const ui::DisplaySnapshot& output) { |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 } | 305 } |
| 306 return 1.0f; | 306 return 1.0f; |
| 307 } | 307 } |
| 308 | 308 |
| 309 void DisplayChangeObserver::OnTouchscreenDeviceConfigurationChanged() { | 309 void DisplayChangeObserver::OnTouchscreenDeviceConfigurationChanged() { |
| 310 OnDisplayModeChanged( | 310 OnDisplayModeChanged( |
| 311 Shell::GetInstance()->display_configurator()->cached_displays()); | 311 Shell::GetInstance()->display_configurator()->cached_displays()); |
| 312 } | 312 } |
| 313 | 313 |
| 314 } // namespace ash | 314 } // namespace ash |
| OLD | NEW |