OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/display/chromeos/display_configurator.h" | 5 #include "ui/display/chromeos/display_configurator.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 | 296 |
297 for (size_t i = 0; i < states.size(); ++i) { | 297 for (size_t i = 0; i < states.size(); ++i) { |
298 const DisplayState* state = &states[i]; | 298 const DisplayState* state = &states[i]; |
299 (*requests)[i].mode = display_power[i] ? state->mirror_mode : NULL; | 299 (*requests)[i].mode = display_power[i] ? state->mirror_mode : NULL; |
300 } | 300 } |
301 break; | 301 break; |
302 } | 302 } |
303 case MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED: | 303 case MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED: |
304 case MULTIPLE_DISPLAY_STATE_MULTI_EXTENDED: { | 304 case MULTIPLE_DISPLAY_STATE_MULTI_EXTENDED: { |
305 if ((new_display_state == MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED && | 305 if ((new_display_state == MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED && |
306 states.size() != 2) || | 306 states.size() != 2 && num_on_displays != 2) || |
307 (new_display_state == MULTIPLE_DISPLAY_STATE_MULTI_EXTENDED && | 307 (new_display_state == MULTIPLE_DISPLAY_STATE_MULTI_EXTENDED && |
308 states.size() <= 2) || | 308 num_on_displays <= 2)) { |
309 (num_on_displays != 0 && | |
310 num_on_displays != static_cast<int>(displays.size()))) { | |
311 LOG(WARNING) << "Ignoring request to enter extended mode with " | 309 LOG(WARNING) << "Ignoring request to enter extended mode with " |
312 << states.size() << " connected display(s) and " | 310 << states.size() << " connected display(s) and " |
313 << num_on_displays << " turned on"; | 311 << num_on_displays << " turned on"; |
314 return false; | 312 return false; |
315 } | 313 } |
316 | 314 |
317 for (size_t i = 0; i < states.size(); ++i) { | 315 for (size_t i = 0; i < states.size(); ++i) { |
318 const DisplayState* state = &states[i]; | 316 const DisplayState* state = &states[i]; |
319 (*requests)[i].origin.set_y(size.height() ? size.height() + kVerticalGap | 317 (*requests)[i].origin.set_y(size.height() ? size.height() + kVerticalGap |
320 : 0); | 318 : 0); |
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1136 | 1134 |
1137 int64_t max_display_id = 0; | 1135 int64_t max_display_id = 0; |
1138 for (const auto& display : virtual_display_snapshots_) | 1136 for (const auto& display : virtual_display_snapshots_) |
1139 max_display_id = std::max(max_display_id, display->display_id()); | 1137 max_display_id = std::max(max_display_id, display->display_id()); |
1140 last_virtual_display_id_ = max_display_id & 0xff; | 1138 last_virtual_display_id_ = max_display_id & 0xff; |
1141 | 1139 |
1142 return true; | 1140 return true; |
1143 } | 1141 } |
1144 | 1142 |
1145 } // namespace ui | 1143 } // namespace ui |
OLD | NEW |