| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_manager.h" | 5 #include "ash/display/display_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 } | 230 } |
| 231 | 231 |
| 232 void DisplayManager::InitDefaultDisplay() { | 232 void DisplayManager::InitDefaultDisplay() { |
| 233 DisplayInfoList info_list; | 233 DisplayInfoList info_list; |
| 234 info_list.push_back(DisplayInfo::CreateFromSpec(std::string())); | 234 info_list.push_back(DisplayInfo::CreateFromSpec(std::string())); |
| 235 info_list.back().set_native(true); | 235 info_list.back().set_native(true); |
| 236 MaybeInitInternalDisplay(info_list[0].id()); | 236 MaybeInitInternalDisplay(info_list[0].id()); |
| 237 OnNativeDisplaysChanged(info_list); | 237 OnNativeDisplaysChanged(info_list); |
| 238 } | 238 } |
| 239 | 239 |
| 240 void DisplayManager::InitFontParams() { | 240 void DisplayManager::RefreshFontParams() { |
| 241 #if defined(OS_CHROMEOS) | 241 #if defined(OS_CHROMEOS) |
| 242 if (!HasInternalDisplay()) | 242 float device_scale_factor = 1.0f; |
| 243 return; | 243 if (HasInternalDisplay()) { |
| 244 const DisplayInfo& display_info = | 244 device_scale_factor = GetDisplayInfo(gfx::Display::InternalDisplayId()) |
| 245 GetDisplayInfo(gfx::Display::InternalDisplayId()); | 245 .GetEffectiveDeviceScaleFactor(); |
| 246 gfx::SetFontRenderParamsDeviceScaleFactor( | 246 } |
| 247 display_info.GetEffectiveDeviceScaleFactor()); | 247 gfx::SetFontRenderParamsDeviceScaleFactor(device_scale_factor); |
| 248 #endif // OS_CHROMEOS | 248 #endif // OS_CHROMEOS |
| 249 } | 249 } |
| 250 | 250 |
| 251 // static | 251 // static |
| 252 void DisplayManager::UpdateDisplayBoundsForLayoutById( | 252 void DisplayManager::UpdateDisplayBoundsForLayoutById( |
| 253 const DisplayLayout& layout, | 253 const DisplayLayout& layout, |
| 254 const gfx::Display& primary_display, | 254 const gfx::Display& primary_display, |
| 255 int64 secondary_display_id) { | 255 int64 secondary_display_id) { |
| 256 DCHECK_NE(gfx::Display::kInvalidDisplayID, secondary_display_id); | 256 DCHECK_NE(gfx::Display::kInvalidDisplayID, secondary_display_id); |
| 257 UpdateDisplayBoundsForLayout( | 257 UpdateDisplayBoundsForLayout( |
| (...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 if (display_changes.find(updated_index) != display_changes.end()) | 897 if (display_changes.find(updated_index) != display_changes.end()) |
| 898 metrics |= display_changes[updated_index]; | 898 metrics |= display_changes[updated_index]; |
| 899 | 899 |
| 900 display_changes[updated_index] = metrics; | 900 display_changes[updated_index] = metrics; |
| 901 } | 901 } |
| 902 } | 902 } |
| 903 } | 903 } |
| 904 | 904 |
| 905 displays_ = new_displays; | 905 displays_ = new_displays; |
| 906 | 906 |
| 907 RefreshFontParams(); |
| 907 base::AutoReset<bool> resetter(&change_display_upon_host_resize_, false); | 908 base::AutoReset<bool> resetter(&change_display_upon_host_resize_, false); |
| 908 | 909 |
| 909 // Temporarily add displays to be removed because display object | 910 // Temporarily add displays to be removed because display object |
| 910 // being removed are accessed during shutting down the root. | 911 // being removed are accessed during shutting down the root. |
| 911 displays_.insert(displays_.end(), removed_displays.begin(), | 912 displays_.insert(displays_.end(), removed_displays.begin(), |
| 912 removed_displays.end()); | 913 removed_displays.end()); |
| 913 | 914 |
| 914 for (DisplayList::const_reverse_iterator iter = removed_displays.rbegin(); | 915 for (DisplayList::const_reverse_iterator iter = removed_displays.rbegin(); |
| 915 iter != removed_displays.rend(); ++iter) { | 916 iter != removed_displays.rend(); ++iter) { |
| 916 screen_ash_->NotifyDisplayRemoved(displays_.back()); | 917 screen_ash_->NotifyDisplayRemoved(displays_.back()); |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1310 new_secondary_origin.Offset(-secondary_bounds.width(), offset); | 1311 new_secondary_origin.Offset(-secondary_bounds.width(), offset); |
| 1311 break; | 1312 break; |
| 1312 } | 1313 } |
| 1313 gfx::Insets insets = secondary_display->GetWorkAreaInsets(); | 1314 gfx::Insets insets = secondary_display->GetWorkAreaInsets(); |
| 1314 secondary_display->set_bounds( | 1315 secondary_display->set_bounds( |
| 1315 gfx::Rect(new_secondary_origin, secondary_bounds.size())); | 1316 gfx::Rect(new_secondary_origin, secondary_bounds.size())); |
| 1316 secondary_display->UpdateWorkAreaFromInsets(insets); | 1317 secondary_display->UpdateWorkAreaFromInsets(insets); |
| 1317 } | 1318 } |
| 1318 | 1319 |
| 1319 } // namespace ash | 1320 } // namespace ash |
| OLD | NEW |