| Index: ash/display/display_manager.cc
|
| diff --git a/ash/display/display_manager.cc b/ash/display/display_manager.cc
|
| index ff9748d638ce47f33c5e8290f61ce9a9cca64dd4..257e62b6215eeabf55a5ec8e9a779287cfbe1699 100644
|
| --- a/ash/display/display_manager.cc
|
| +++ b/ash/display/display_manager.cc
|
| @@ -102,7 +102,7 @@ void DisplayManager::CycleDisplay() {
|
| }
|
|
|
| // static
|
| -void DisplayManager::ToggleDisplayScale() {
|
| +void DisplayManager::ToggleDisplayScaleFactor() {
|
| Shell::GetInstance()->display_manager()->ScaleDisplayImpl();
|
| }
|
|
|
| @@ -173,6 +173,8 @@ void DisplayManager::ClearCustomOverscanInsets(int64 display_id) {
|
|
|
| void DisplayManager::SetDisplayRotation(int64 display_id,
|
| gfx::Display::Rotation rotation) {
|
| + if (!IsDisplayRotationEnabled())
|
| + return;
|
| DisplayInfoList display_info_list;
|
| for (DisplayList::const_iterator iter = displays_.begin();
|
| iter != displays_.end(); ++iter) {
|
| @@ -184,6 +186,44 @@ void DisplayManager::SetDisplayRotation(int64 display_id,
|
| UpdateDisplays(display_info_list);
|
| }
|
|
|
| +void DisplayManager::SetDisplayUIScale(int64 display_id,
|
| + float ui_scale) {
|
| + if (!IsDisplayUIScalingEnabled())
|
| + return;
|
| + DisplayInfoList display_info_list;
|
| + for (DisplayList::const_iterator iter = displays_.begin();
|
| + iter != displays_.end(); ++iter) {
|
| + DisplayInfo info = GetDisplayInfo(*iter);
|
| + if (info.id() == display_id)
|
| + info.set_ui_scale(ui_scale);
|
| + display_info_list.push_back(info);
|
| + }
|
| + UpdateDisplays(display_info_list);
|
| +}
|
| +
|
| +
|
| +bool DisplayManager::IsDisplayRotationEnabled() const {
|
| + static bool enabled = !CommandLine::ForCurrentProcess()->
|
| + HasSwitch(switches::kAshDisableDisplayRotation);
|
| + return enabled;
|
| +}
|
| +
|
| +bool DisplayManager::IsDisplayUIScalingEnabled() const {
|
| + static bool enabled = !CommandLine::ForCurrentProcess()->
|
| + HasSwitch(switches::kAshDisableUIScaling);
|
| + if (!enabled)
|
| + return false;
|
| + // UI Scaling is effective only when the internal display has
|
| + // 2x density (currently Pixel).
|
| + int64 display_id = gfx::Display::InternalDisplayId();
|
| +#if defined(OS_CHROMEOS)
|
| + // On linux desktop, allow ui scaling on the first dislpay.
|
| + if (!base::chromeos::IsRunningOnChromeOS())
|
| + display_id = Shell::GetInstance()->display_manager()->first_display_id();
|
| +#endif
|
| + return GetDisplayForId(display_id).device_scale_factor() == 2.0f;
|
| +}
|
| +
|
| gfx::Insets DisplayManager::GetOverscanInsets(int64 display_id) const {
|
| std::map<int64, DisplayInfo>::const_iterator it =
|
| display_info_.find(display_id);
|
|
|