Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: ui/display/chromeos/display_configurator.cc

Issue 667753002: Treat displays with and without EDID the same way (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ui/display/chromeos/display_configurator_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 cached_displays_.clear(); 572 cached_displays_.clear();
573 for (size_t i = 0; i < snapshots.size(); ++i) { 573 for (size_t i = 0; i < snapshots.size(); ++i) {
574 DisplayState display_state; 574 DisplayState display_state;
575 display_state.display = snapshots[i]; 575 display_state.display = snapshots[i];
576 cached_displays_.push_back(display_state); 576 cached_displays_.push_back(display_state);
577 } 577 }
578 578
579 // Set |selected_mode| fields. 579 // Set |selected_mode| fields.
580 for (size_t i = 0; i < cached_displays_.size(); ++i) { 580 for (size_t i = 0; i < cached_displays_.size(); ++i) {
581 DisplayState* display_state = &cached_displays_[i]; 581 DisplayState* display_state = &cached_displays_[i];
582 if (display_state->display->has_proper_display_id()) { 582 gfx::Size size;
583 gfx::Size size; 583 if (state_controller_ &&
584 if (state_controller_ && 584 state_controller_->GetResolutionForDisplayId(
585 state_controller_->GetResolutionForDisplayId( 585 display_state->display->display_id(), &size)) {
586 display_state->display->display_id(), &size)) { 586 display_state->selected_mode =
587 display_state->selected_mode = 587 FindDisplayModeMatchingSize(*display_state->display, size);
588 FindDisplayModeMatchingSize(*display_state->display, size);
589 }
590 } 588 }
589
591 // Fall back to native mode. 590 // Fall back to native mode.
592 if (!display_state->selected_mode) 591 if (!display_state->selected_mode)
593 display_state->selected_mode = display_state->display->native_mode(); 592 display_state->selected_mode = display_state->display->native_mode();
594 } 593 }
595 594
596 // Set |mirror_mode| fields. 595 // Set |mirror_mode| fields.
597 if (cached_displays_.size() == 2) { 596 if (cached_displays_.size() == 2) {
598 bool one_is_internal = 597 bool one_is_internal =
599 cached_displays_[0].display->type() == DISPLAY_CONNECTION_TYPE_INTERNAL; 598 cached_displays_[0].display->type() == DISPLAY_CONNECTION_TYPE_INTERNAL;
600 bool two_is_internal = 599 bool two_is_internal =
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 if (num_on_displays == 1) { 952 if (num_on_displays == 1) {
954 // If only one display is currently turned on, return the "single" 953 // If only one display is currently turned on, return the "single"
955 // state so that its native mode will be used. 954 // state so that its native mode will be used.
956 return MULTIPLE_DISPLAY_STATE_SINGLE; 955 return MULTIPLE_DISPLAY_STATE_SINGLE;
957 } else { 956 } else {
958 if (!state_controller_) 957 if (!state_controller_)
959 return MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED; 958 return MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED;
960 // With either both displays on or both displays off, use one of the 959 // With either both displays on or both displays off, use one of the
961 // dual modes. 960 // dual modes.
962 std::vector<int64_t> display_ids; 961 std::vector<int64_t> display_ids;
963 for (size_t i = 0; i < cached_displays_.size(); ++i) { 962 for (size_t i = 0; i < cached_displays_.size(); ++i)
964 // If display id isn't available, switch to extended mode.
965 if (!cached_displays_[i].display->has_proper_display_id())
966 return MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED;
967 display_ids.push_back(cached_displays_[i].display->display_id()); 963 display_ids.push_back(cached_displays_[i].display->display_id());
968 } 964
969 return state_controller_->GetStateForDisplayIds(display_ids); 965 return state_controller_->GetStateForDisplayIds(display_ids);
970 } 966 }
971 } 967 }
972 default: 968 default:
973 NOTREACHED(); 969 NOTREACHED();
974 } 970 }
975 return MULTIPLE_DISPLAY_STATE_INVALID; 971 return MULTIPLE_DISPLAY_STATE_INVALID;
976 } 972 }
977 973
978 } // namespace ui 974 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | ui/display/chromeos/display_configurator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698