Chromium Code Reviews| 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/multi_display_manager.h" | 5 #include "ash/display/multi_display_manager.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/display/display_controller.h" | 10 #include "ash/display/display_controller.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 151 // Undo the existing insets before applying the new insets. | 151 // Undo the existing insets before applying the new insets. |
| 152 gfx::Rect bounds = display.bounds_in_pixel(); | 152 gfx::Rect bounds = display.bounds_in_pixel(); |
| 153 bounds.Inset(old_insets.Scale(-display.device_scale_factor())); | 153 bounds.Inset(old_insets.Scale(-display.device_scale_factor())); |
| 154 display.SetScaleAndBounds(display.device_scale_factor(), bounds); | 154 display.SetScaleAndBounds(display.device_scale_factor(), bounds); |
| 155 } | 155 } |
| 156 } | 156 } |
| 157 overscan_mapping_[display_id] = insets_in_dip; | 157 overscan_mapping_[display_id] = insets_in_dip; |
| 158 OnNativeDisplaysChanged(displays_); | 158 OnNativeDisplaysChanged(displays_); |
| 159 } | 159 } |
| 160 | 160 |
| 161 gfx::Insets MultiDisplayManager::GetOverscanInsets(int64 display_id) { | |
| 162 std::map<int64, gfx::Insets>::const_iterator it = | |
| 163 overscan_mapping_.find(display_id); | |
| 164 if (it != overscan_mapping_.end()) | |
| 165 return it->second; | |
| 166 | |
| 167 return gfx::Insets(); | |
|
oshima
2012/10/19 19:36:11
return it != ... ? it->second() : gfx::Insetse();
Jun Mukai
2012/10/19 21:39:34
Done.
| |
| 168 } | |
| 169 | |
| 161 void MultiDisplayManager::OnNativeDisplaysChanged( | 170 void MultiDisplayManager::OnNativeDisplaysChanged( |
| 162 const std::vector<gfx::Display>& updated_displays) { | 171 const std::vector<gfx::Display>& updated_displays) { |
| 163 if (updated_displays.empty()) { | 172 if (updated_displays.empty()) { |
| 164 // Don't update the displays when all displays are disconnected. | 173 // Don't update the displays when all displays are disconnected. |
| 165 // This happens when: | 174 // This happens when: |
| 166 // - the device is idle and powerd requested to turn off all displays. | 175 // - the device is idle and powerd requested to turn off all displays. |
| 167 // - the device is suspended. (kernel turns off all displays) | 176 // - the device is suspended. (kernel turns off all displays) |
| 168 // - the internal display's brightness is set to 0 and no external | 177 // - the internal display's brightness is set to 0 and no external |
| 169 // display is connected. | 178 // display is connected. |
| 170 // - the internal display's brightness is 0 and external display is | 179 // - the internal display's brightness is 0 and external display is |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 479 DisplayList::iterator iter_to_update = to_update->begin(); | 488 DisplayList::iterator iter_to_update = to_update->begin(); |
| 480 DisplayList::const_iterator iter = displays_.begin(); | 489 DisplayList::const_iterator iter = displays_.begin(); |
| 481 for (; iter != displays_.end() && iter_to_update != to_update->end(); | 490 for (; iter != displays_.end() && iter_to_update != to_update->end(); |
| 482 ++iter, ++iter_to_update) { | 491 ++iter, ++iter_to_update) { |
| 483 (*iter_to_update).set_id((*iter).id()); | 492 (*iter_to_update).set_id((*iter).id()); |
| 484 } | 493 } |
| 485 } | 494 } |
| 486 | 495 |
| 487 } // namespace internal | 496 } // namespace internal |
| 488 } // namespace ash | 497 } // namespace ash |
| OLD | NEW |