Commit 5471d5d4 authored by mukai@chromium.org's avatar mukai@chromium.org

Show "displays" section in the options page even for 1 display. It happens in case of mirroring.


BUG=135580
TEST=manually checked on lumpy


Review URL: https://chromiumcodereview.appspot.com/10828005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149113 0039d316-1c4b-4281-b951-d872f2087c98
parent 351f98f4
...@@ -226,23 +226,31 @@ cr.define('options', function() { ...@@ -226,23 +226,31 @@ cr.define('options', function() {
* @private * @private
*/ */
layoutMirroringDisplays_: function() { layoutMirroringDisplays_: function() {
// Offset pixels for secondary display rectangles.
/** @const */ var MIRRORING_OFFSET_PIXELS = 2;
// Always show two displays because there must be two displays when
// the display_options is enabled. Don't rely on displays_.length because
// there is only one display from chrome's perspective in mirror mode.
/** @const */ var MIN_NUM_DISPLAYS = 2;
// The width/height should be same as the primary display: // The width/height should be same as the primary display:
var width = this.displays_[0].width * VISUAL_SCALE; var width = this.displays_[0].width * VISUAL_SCALE;
var height = this.displays_[0].height * VISUAL_SCALE; var height = this.displays_[0].height * VISUAL_SCALE;
var num_displays = Math.max(MIN_NUM_DISPLAYS, this.displays_.length);
this.displays_view_.style.height = this.displays_view_.style.height =
height + this.displays_.length * 2 + 'px'; height + num_displays * MIRRORING_OFFSET_PIXELS + 'px';
for (var i = 0; i < this.displays_.length; i++) { for (var i = 0; i < num_displays; i++) {
var div = document.createElement('div'); var div = document.createElement('div');
this.displays_[i].div = div;
div.className = 'displays-display'; div.className = 'displays-display';
div.style.top = i * 2 + 'px'; div.style.top = i * MIRRORING_OFFSET_PIXELS + 'px';
div.style.left = i * 2 + 'px'; div.style.left = i * MIRRORING_OFFSET_PIXELS + 'px';
div.style.width = width + 'px'; div.style.width = width + 'px';
div.style.height = height + 'px'; div.style.height = height + 'px';
div.style.zIndex = i; div.style.zIndex = i;
if (i == this.displays_.length - 1) if (i == num_displays - 1)
div.className += ' displays-primary'; div.className += ' displays-primary';
this.displays_view_.appendChild(div); this.displays_view_.appendChild(div);
} }
...@@ -330,9 +338,6 @@ cr.define('options', function() { ...@@ -330,9 +338,6 @@ cr.define('options', function() {
this.displays_ = displays; this.displays_ = displays;
if (this.displays_.length <= 1)
return;
this.resetDisplaysView_(); this.resetDisplaysView_();
if (this.mirroring_) if (this.mirroring_)
this.layoutMirroringDisplays_(); this.layoutMirroringDisplays_();
......
...@@ -84,13 +84,10 @@ void DisplayOptionsHandler::OnDisplayRemoved(const gfx::Display& old_display) { ...@@ -84,13 +84,10 @@ void DisplayOptionsHandler::OnDisplayRemoved(const gfx::Display& old_display) {
} }
void DisplayOptionsHandler::UpdateDisplaySectionVisibility() { void DisplayOptionsHandler::UpdateDisplaySectionVisibility() {
aura::DisplayManager* display_manager =
aura::Env::GetInstance()->display_manager();
chromeos::OutputState output_state = chromeos::OutputState output_state =
ash::Shell::GetInstance()->output_configurator()->output_state(); ash::Shell::GetInstance()->output_configurator()->output_state();
base::FundamentalValue show_options( base::FundamentalValue show_options(
DisplayController::IsExtendedDesktopEnabled() && DisplayController::IsExtendedDesktopEnabled() &&
display_manager->GetNumDisplays() > 1 &&
output_state != chromeos::STATE_INVALID && output_state != chromeos::STATE_INVALID &&
output_state != chromeos::STATE_HEADLESS && output_state != chromeos::STATE_HEADLESS &&
output_state != chromeos::STATE_SINGLE); output_state != chromeos::STATE_SINGLE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment