| 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 cr.exportPath('options'); |
| 6 |
| 7 /** |
| 8 * @typedef {{ |
| 9 * availableColorProfiles: Array.<{profileId: number, name: string}>, |
| 10 * colorProfile: number, |
| 11 * height: number, |
| 12 * id: string, |
| 13 * isInternal: boolean, |
| 14 * isPrimary: boolean, |
| 15 * resolutions: Array.<{width: number, height: number, originalWidth: number, |
| 16 * originalHeight: number, deviceScaleFactor: number, scale: number, |
| 17 * refreshRate: number, isBest: boolean, selected: boolean}>, |
| 18 * name: string, |
| 19 * orientation: number, |
| 20 * width: number, |
| 21 * x: number, |
| 22 * y: number |
| 23 * }} |
| 24 */ |
| 25 options.DisplayInfo; |
| 26 |
| 27 /** |
| 28 * Enumeration of secondary display layout. The value has to be same as the |
| 29 * values in ash/display/display_controller.cc. |
| 30 * @enum {number} |
| 31 */ |
| 32 options.SecondaryDisplayLayout = { |
| 33 TOP: 0, |
| 34 RIGHT: 1, |
| 35 BOTTOM: 2, |
| 36 LEFT: 3 |
| 37 }; |
| 38 |
| 5 cr.define('options', function() { | 39 cr.define('options', function() { |
| 6 var Page = cr.ui.pageManager.Page; | 40 var Page = cr.ui.pageManager.Page; |
| 7 var PageManager = cr.ui.pageManager.PageManager; | 41 var PageManager = cr.ui.pageManager.PageManager; |
| 8 | 42 |
| 9 // The scale ratio of the display rectangle to its original size. | 43 // The scale ratio of the display rectangle to its original size. |
| 10 /** @const */ var VISUAL_SCALE = 1 / 10; | 44 /** @const */ var VISUAL_SCALE = 1 / 10; |
| 11 | 45 |
| 12 // The number of pixels to share the edges between displays. | 46 // The number of pixels to share the edges between displays. |
| 13 /** @const */ var MIN_OFFSET_OVERLAP = 5; | 47 /** @const */ var MIN_OFFSET_OVERLAP = 5; |
| 14 | 48 |
| 15 /** | 49 /** |
| 16 * Enumeration of secondary display layout. The value has to be same as the | |
| 17 * values in ash/display/display_controller.cc. | |
| 18 * @enum {number} | |
| 19 */ | |
| 20 var SecondaryDisplayLayout = { | |
| 21 TOP: 0, | |
| 22 RIGHT: 1, | |
| 23 BOTTOM: 2, | |
| 24 LEFT: 3 | |
| 25 }; | |
| 26 | |
| 27 /** | |
| 28 * Calculates the bounds of |element| relative to the page. | 50 * Calculates the bounds of |element| relative to the page. |
| 29 * @param {HTMLElement} element The element to be known. | 51 * @param {HTMLElement} element The element to be known. |
| 30 * @return {Object} The object for the bounds, with x, y, width, and height. | 52 * @return {Object} The object for the bounds, with x, y, width, and height. |
| 31 */ | 53 */ |
| 32 function getBoundsInPage(element) { | 54 function getBoundsInPage(element) { |
| 33 var bounds = { | 55 var bounds = { |
| 34 x: element.offsetLeft, | 56 x: element.offsetLeft, |
| 35 y: element.offsetTop, | 57 y: element.offsetTop, |
| 36 width: element.offsetWidth, | 58 width: element.offsetWidth, |
| 37 height: element.offsetHeight | 59 height: element.offsetHeight |
| 38 }; | 60 }; |
| 39 var parent = element.offsetParent; | 61 var parent = element.offsetParent; |
| 40 while (parent && parent != document.body) { | 62 while (parent && parent != document.body) { |
| 41 bounds.x += parent.offsetLeft; | 63 bounds.x += parent.offsetLeft; |
| 42 bounds.y += parent.offsetTop; | 64 bounds.y += parent.offsetTop; |
| 43 parent = parent.offsetParent; | 65 parent = parent.offsetParent; |
| 44 } | 66 } |
| 45 return bounds; | 67 return bounds; |
| 46 } | 68 } |
| 47 | 69 |
| 48 /** | 70 /** |
| 49 * Gets the position of |point| to |rect|, left, right, top, or bottom. | 71 * Gets the position of |point| to |rect|, left, right, top, or bottom. |
| 50 * @param {Object} rect The base rectangle with x, y, width, and height. | 72 * @param {Object} rect The base rectangle with x, y, width, and height. |
| 51 * @param {Object} point The point to check the position. | 73 * @param {Object} point The point to check the position. |
| 52 * @return {SecondaryDisplayLayout} The position of the calculated point. | 74 * @return {options.SecondaryDisplayLayout} The position of the calculated |
| 75 * point. |
| 53 */ | 76 */ |
| 54 function getPositionToRectangle(rect, point) { | 77 function getPositionToRectangle(rect, point) { |
| 55 // Separates the area into four (LEFT/RIGHT/TOP/BOTTOM) by the diagonals of | 78 // Separates the area into four (LEFT/RIGHT/TOP/BOTTOM) by the diagonals of |
| 56 // the rect, and decides which area the display should reside. | 79 // the rect, and decides which area the display should reside. |
| 57 var diagonalSlope = rect.height / rect.width; | 80 var diagonalSlope = rect.height / rect.width; |
| 58 var topDownIntercept = rect.y - rect.x * diagonalSlope; | 81 var topDownIntercept = rect.y - rect.x * diagonalSlope; |
| 59 var bottomUpIntercept = rect.y + rect.height + rect.x * diagonalSlope; | 82 var bottomUpIntercept = rect.y + rect.height + rect.x * diagonalSlope; |
| 60 | 83 |
| 61 if (point.y > topDownIntercept + point.x * diagonalSlope) { | 84 if (point.y > topDownIntercept + point.x * diagonalSlope) { |
| 62 if (point.y > bottomUpIntercept - point.x * diagonalSlope) | 85 if (point.y > bottomUpIntercept - point.x * diagonalSlope) |
| 63 return SecondaryDisplayLayout.BOTTOM; | 86 return options.SecondaryDisplayLayout.BOTTOM; |
| 64 else | 87 else |
| 65 return SecondaryDisplayLayout.LEFT; | 88 return options.SecondaryDisplayLayout.LEFT; |
| 66 } else { | 89 } else { |
| 67 if (point.y > bottomUpIntercept - point.x * diagonalSlope) | 90 if (point.y > bottomUpIntercept - point.x * diagonalSlope) |
| 68 return SecondaryDisplayLayout.RIGHT; | 91 return options.SecondaryDisplayLayout.RIGHT; |
| 69 else | 92 else |
| 70 return SecondaryDisplayLayout.TOP; | 93 return options.SecondaryDisplayLayout.TOP; |
| 71 } | 94 } |
| 72 } | 95 } |
| 73 | 96 |
| 74 /** | 97 /** |
| 75 * Encapsulated handling of the 'Display' page. | 98 * Encapsulated handling of the 'Display' page. |
| 76 * @constructor | 99 * @constructor |
| 77 * @extends {cr.ui.pageManager.Page} | 100 * @extends {cr.ui.pageManager.Page} |
| 78 */ | 101 */ |
| 79 function DisplayOptions() { | 102 function DisplayOptions() { |
| 80 Page.call(this, 'display', | 103 Page.call(this, 'display', |
| 81 loadTimeData.getString('displayOptionsPageTabTitle'), | 104 loadTimeData.getString('displayOptionsPageTabTitle'), |
| 82 'display-options-page'); | 105 'display-options-page'); |
| 83 } | 106 } |
| 84 | 107 |
| 85 cr.addSingletonGetter(DisplayOptions); | 108 cr.addSingletonGetter(DisplayOptions); |
| 86 | 109 |
| 87 DisplayOptions.prototype = { | 110 DisplayOptions.prototype = { |
| 88 __proto__: Page.prototype, | 111 __proto__: Page.prototype, |
| 89 | 112 |
| 90 /** | 113 /** |
| 91 * Whether the current output status is mirroring displays or not. | 114 * Whether the current output status is mirroring displays or not. |
| 92 * @private | 115 * @private |
| 93 */ | 116 */ |
| 94 mirroring_: false, | 117 mirroring_: false, |
| 95 | 118 |
| 96 /** | 119 /** |
| 97 * The current secondary display layout. | 120 * The current secondary display layout. |
| 98 * @private | 121 * @private |
| 99 */ | 122 */ |
| 100 layout_: SecondaryDisplayLayout.RIGHT, | 123 layout_: options.SecondaryDisplayLayout.RIGHT, |
| 101 | 124 |
| 102 /** | 125 /** |
| 103 * The array of current output displays. It also contains the display | 126 * The array of current output displays. It also contains the display |
| 104 * rectangles currently rendered on screen. | 127 * rectangles currently rendered on screen. |
| 128 * @type {Array.<options.DisplayInfo>} |
| 105 * @private | 129 * @private |
| 106 */ | 130 */ |
| 107 displays_: [], | 131 displays_: [], |
| 108 | 132 |
| 109 /** | 133 /** |
| 110 * The index for the currently focused display in the options UI. null if | 134 * The index for the currently focused display in the options UI. null if |
| 111 * no one has focus. | 135 * no one has focus. |
| 112 * @private | 136 * @private |
| 113 */ | 137 */ |
| 114 focusedIndex_: null, | 138 focusedIndex_: null, |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 | 297 |
| 274 /** | 298 /** |
| 275 * Collects the current data and sends it to Chrome. | 299 * Collects the current data and sends it to Chrome. |
| 276 * @private | 300 * @private |
| 277 */ | 301 */ |
| 278 applyResult_: function() { | 302 applyResult_: function() { |
| 279 // Offset is calculated from top or left edge. | 303 // Offset is calculated from top or left edge. |
| 280 var primary = this.primaryDisplay_; | 304 var primary = this.primaryDisplay_; |
| 281 var secondary = this.secondaryDisplay_; | 305 var secondary = this.secondaryDisplay_; |
| 282 var offset; | 306 var offset; |
| 283 if (this.layout_ == SecondaryDisplayLayout.LEFT || | 307 if (this.layout_ == options.SecondaryDisplayLayout.LEFT || |
| 284 this.layout_ == SecondaryDisplayLayout.RIGHT) { | 308 this.layout_ == options.SecondaryDisplayLayout.RIGHT) { |
| 285 offset = secondary.div.offsetTop - primary.div.offsetTop; | 309 offset = secondary.div.offsetTop - primary.div.offsetTop; |
| 286 } else { | 310 } else { |
| 287 offset = secondary.div.offsetLeft - primary.div.offsetLeft; | 311 offset = secondary.div.offsetLeft - primary.div.offsetLeft; |
| 288 } | 312 } |
| 289 chrome.send('setDisplayLayout', | 313 chrome.send('setDisplayLayout', |
| 290 [this.layout_, offset / this.visualScale_]); | 314 [this.layout_, offset / this.visualScale_]); |
| 291 }, | 315 }, |
| 292 | 316 |
| 293 /** | 317 /** |
| 294 * Snaps the region [point, width] to [basePoint, baseWidth] if | 318 * Snaps the region [point, width] to [basePoint, baseWidth] if |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 y: newPosition.y + draggingDiv.offsetHeight / 2 | 387 y: newPosition.y + draggingDiv.offsetHeight / 2 |
| 364 }; | 388 }; |
| 365 | 389 |
| 366 var baseBounds = { | 390 var baseBounds = { |
| 367 x: baseDiv.offsetLeft, | 391 x: baseDiv.offsetLeft, |
| 368 y: baseDiv.offsetTop, | 392 y: baseDiv.offsetTop, |
| 369 width: baseDiv.offsetWidth, | 393 width: baseDiv.offsetWidth, |
| 370 height: baseDiv.offsetHeight | 394 height: baseDiv.offsetHeight |
| 371 }; | 395 }; |
| 372 switch (getPositionToRectangle(baseBounds, newCenter)) { | 396 switch (getPositionToRectangle(baseBounds, newCenter)) { |
| 373 case SecondaryDisplayLayout.RIGHT: | 397 case options.SecondaryDisplayLayout.RIGHT: |
| 374 this.layout_ = this.dragging_.display.isPrimary ? | 398 this.layout_ = this.dragging_.display.isPrimary ? |
| 375 SecondaryDisplayLayout.LEFT : SecondaryDisplayLayout.RIGHT; | 399 options.SecondaryDisplayLayout.LEFT : |
| 400 options.SecondaryDisplayLayout.RIGHT; |
| 376 break; | 401 break; |
| 377 case SecondaryDisplayLayout.LEFT: | 402 case options.SecondaryDisplayLayout.LEFT: |
| 378 this.layout_ = this.dragging_.display.isPrimary ? | 403 this.layout_ = this.dragging_.display.isPrimary ? |
| 379 SecondaryDisplayLayout.RIGHT : SecondaryDisplayLayout.LEFT; | 404 options.SecondaryDisplayLayout.RIGHT : |
| 405 options.SecondaryDisplayLayout.LEFT; |
| 380 break; | 406 break; |
| 381 case SecondaryDisplayLayout.TOP: | 407 case options.SecondaryDisplayLayout.TOP: |
| 382 this.layout_ = this.dragging_.display.isPrimary ? | 408 this.layout_ = this.dragging_.display.isPrimary ? |
| 383 SecondaryDisplayLayout.BOTTOM : SecondaryDisplayLayout.TOP; | 409 options.SecondaryDisplayLayout.BOTTOM : |
| 410 options.SecondaryDisplayLayout.TOP; |
| 384 break; | 411 break; |
| 385 case SecondaryDisplayLayout.BOTTOM: | 412 case options.SecondaryDisplayLayout.BOTTOM: |
| 386 this.layout_ = this.dragging_.display.isPrimary ? | 413 this.layout_ = this.dragging_.display.isPrimary ? |
| 387 SecondaryDisplayLayout.TOP : SecondaryDisplayLayout.BOTTOM; | 414 options.SecondaryDisplayLayout.TOP : |
| 415 options.SecondaryDisplayLayout.BOTTOM; |
| 388 break; | 416 break; |
| 389 } | 417 } |
| 390 | 418 |
| 391 if (this.layout_ == SecondaryDisplayLayout.LEFT || | 419 if (this.layout_ == options.SecondaryDisplayLayout.LEFT || |
| 392 this.layout_ == SecondaryDisplayLayout.RIGHT) { | 420 this.layout_ == options.SecondaryDisplayLayout.RIGHT) { |
| 393 if (newPosition.y > baseDiv.offsetTop + baseDiv.offsetHeight) | 421 if (newPosition.y > baseDiv.offsetTop + baseDiv.offsetHeight) |
| 394 this.layout_ = this.dragging_.display.isPrimary ? | 422 this.layout_ = this.dragging_.display.isPrimary ? |
| 395 SecondaryDisplayLayout.TOP : SecondaryDisplayLayout.BOTTOM; | 423 options.SecondaryDisplayLayout.TOP : |
| 424 options.SecondaryDisplayLayout.BOTTOM; |
| 396 else if (newPosition.y + draggingDiv.offsetHeight < | 425 else if (newPosition.y + draggingDiv.offsetHeight < |
| 397 baseDiv.offsetTop) | 426 baseDiv.offsetTop) |
| 398 this.layout_ = this.dragging_.display.isPrimary ? | 427 this.layout_ = this.dragging_.display.isPrimary ? |
| 399 SecondaryDisplayLayout.BOTTOM : SecondaryDisplayLayout.TOP; | 428 options.SecondaryDisplayLayout.BOTTOM : |
| 429 options.SecondaryDisplayLayout.TOP; |
| 400 } else { | 430 } else { |
| 401 if (newPosition.x > baseDiv.offsetLeft + baseDiv.offsetWidth) | 431 if (newPosition.x > baseDiv.offsetLeft + baseDiv.offsetWidth) |
| 402 this.layout_ = this.dragging_.display.isPrimary ? | 432 this.layout_ = this.dragging_.display.isPrimary ? |
| 403 SecondaryDisplayLayout.LEFT : SecondaryDisplayLayout.RIGHT; | 433 options.SecondaryDisplayLayout.LEFT : |
| 434 options.SecondaryDisplayLayout.RIGHT; |
| 404 else if (newPosition.x + draggingDiv.offsetWidth < | 435 else if (newPosition.x + draggingDiv.offsetWidth < |
| 405 baseDiv.offsetLeft) | 436 baseDiv.offsetLeft) |
| 406 this.layout_ = this.dragging_.display.isPrimary ? | 437 this.layout_ = this.dragging_.display.isPrimary ? |
| 407 SecondaryDisplayLayout.RIGHT : SecondaryDisplayLayout.LEFT; | 438 options.SecondaryDisplayLayout.RIGHT : |
| 439 options.SecondaryDisplayLayout.LEFT; |
| 408 } | 440 } |
| 409 | 441 |
| 410 var layoutToBase; | 442 var layoutToBase; |
| 411 if (!this.dragging_.display.isPrimary) { | 443 if (!this.dragging_.display.isPrimary) { |
| 412 layoutToBase = this.layout_; | 444 layoutToBase = this.layout_; |
| 413 } else { | 445 } else { |
| 414 switch (this.layout_) { | 446 switch (this.layout_) { |
| 415 case SecondaryDisplayLayout.RIGHT: | 447 case options.SecondaryDisplayLayout.RIGHT: |
| 416 layoutToBase = SecondaryDisplayLayout.LEFT; | 448 layoutToBase = options.SecondaryDisplayLayout.LEFT; |
| 417 break; | 449 break; |
| 418 case SecondaryDisplayLayout.LEFT: | 450 case options.SecondaryDisplayLayout.LEFT: |
| 419 layoutToBase = SecondaryDisplayLayout.RIGHT; | 451 layoutToBase = options.SecondaryDisplayLayout.RIGHT; |
| 420 break; | 452 break; |
| 421 case SecondaryDisplayLayout.TOP: | 453 case options.SecondaryDisplayLayout.TOP: |
| 422 layoutToBase = SecondaryDisplayLayout.BOTTOM; | 454 layoutToBase = options.SecondaryDisplayLayout.BOTTOM; |
| 423 break; | 455 break; |
| 424 case SecondaryDisplayLayout.BOTTOM: | 456 case options.SecondaryDisplayLayout.BOTTOM: |
| 425 layoutToBase = SecondaryDisplayLayout.TOP; | 457 layoutToBase = options.SecondaryDisplayLayout.TOP; |
| 426 break; | 458 break; |
| 427 } | 459 } |
| 428 } | 460 } |
| 429 | 461 |
| 430 switch (layoutToBase) { | 462 switch (layoutToBase) { |
| 431 case SecondaryDisplayLayout.RIGHT: | 463 case options.SecondaryDisplayLayout.RIGHT: |
| 432 draggingDiv.style.left = | 464 draggingDiv.style.left = |
| 433 baseDiv.offsetLeft + baseDiv.offsetWidth + 'px'; | 465 baseDiv.offsetLeft + baseDiv.offsetWidth + 'px'; |
| 434 draggingDiv.style.top = newPosition.y + 'px'; | 466 draggingDiv.style.top = newPosition.y + 'px'; |
| 435 break; | 467 break; |
| 436 case SecondaryDisplayLayout.LEFT: | 468 case options.SecondaryDisplayLayout.LEFT: |
| 437 draggingDiv.style.left = | 469 draggingDiv.style.left = |
| 438 baseDiv.offsetLeft - draggingDiv.offsetWidth + 'px'; | 470 baseDiv.offsetLeft - draggingDiv.offsetWidth + 'px'; |
| 439 draggingDiv.style.top = newPosition.y + 'px'; | 471 draggingDiv.style.top = newPosition.y + 'px'; |
| 440 break; | 472 break; |
| 441 case SecondaryDisplayLayout.TOP: | 473 case options.SecondaryDisplayLayout.TOP: |
| 442 draggingDiv.style.top = | 474 draggingDiv.style.top = |
| 443 baseDiv.offsetTop - draggingDiv.offsetHeight + 'px'; | 475 baseDiv.offsetTop - draggingDiv.offsetHeight + 'px'; |
| 444 draggingDiv.style.left = newPosition.x + 'px'; | 476 draggingDiv.style.left = newPosition.x + 'px'; |
| 445 break; | 477 break; |
| 446 case SecondaryDisplayLayout.BOTTOM: | 478 case options.SecondaryDisplayLayout.BOTTOM: |
| 447 draggingDiv.style.top = | 479 draggingDiv.style.top = |
| 448 baseDiv.offsetTop + baseDiv.offsetHeight + 'px'; | 480 baseDiv.offsetTop + baseDiv.offsetHeight + 'px'; |
| 449 draggingDiv.style.left = newPosition.x + 'px'; | 481 draggingDiv.style.left = newPosition.x + 'px'; |
| 450 break; | 482 break; |
| 451 } | 483 } |
| 452 | 484 |
| 453 return false; | 485 return false; |
| 454 }, | 486 }, |
| 455 | 487 |
| 456 /** | 488 /** |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 * @param {Event} e The event which triggers this. | 530 * @param {Event} e The event which triggers this. |
| 499 * @private | 531 * @private |
| 500 */ | 532 */ |
| 501 endDragging_: function(e) { | 533 endDragging_: function(e) { |
| 502 this.lastTouchLocation_ = null; | 534 this.lastTouchLocation_ = null; |
| 503 if (this.dragging_) { | 535 if (this.dragging_) { |
| 504 // Make sure the dragging location is connected. | 536 // Make sure the dragging location is connected. |
| 505 var baseDiv = this.dragging_.display.isPrimary ? | 537 var baseDiv = this.dragging_.display.isPrimary ? |
| 506 this.secondaryDisplay_.div : this.primaryDisplay_.div; | 538 this.secondaryDisplay_.div : this.primaryDisplay_.div; |
| 507 var draggingDiv = this.dragging_.display.div; | 539 var draggingDiv = this.dragging_.display.div; |
| 508 if (this.layout_ == SecondaryDisplayLayout.LEFT || | 540 if (this.layout_ == options.SecondaryDisplayLayout.LEFT || |
| 509 this.layout_ == SecondaryDisplayLayout.RIGHT) { | 541 this.layout_ == options.SecondaryDisplayLayout.RIGHT) { |
| 510 var top = Math.max(draggingDiv.offsetTop, | 542 var top = Math.max(draggingDiv.offsetTop, |
| 511 baseDiv.offsetTop - draggingDiv.offsetHeight + | 543 baseDiv.offsetTop - draggingDiv.offsetHeight + |
| 512 MIN_OFFSET_OVERLAP); | 544 MIN_OFFSET_OVERLAP); |
| 513 top = Math.min(top, | 545 top = Math.min(top, |
| 514 baseDiv.offsetTop + baseDiv.offsetHeight - | 546 baseDiv.offsetTop + baseDiv.offsetHeight - |
| 515 MIN_OFFSET_OVERLAP); | 547 MIN_OFFSET_OVERLAP); |
| 516 draggingDiv.style.top = top + 'px'; | 548 draggingDiv.style.top = top + 'px'; |
| 517 } else { | 549 } else { |
| 518 var left = Math.max(draggingDiv.offsetLeft, | 550 var left = Math.max(draggingDiv.offsetLeft, |
| 519 baseDiv.offsetLeft - draggingDiv.offsetWidth + | 551 baseDiv.offsetLeft - draggingDiv.offsetWidth + |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 820 // |displaysView_|. Otherwise its offsetHeight is yet 0. | 852 // |displaysView_|. Otherwise its offsetHeight is yet 0. |
| 821 displayNameContainer.style.marginTop = | 853 displayNameContainer.style.marginTop = |
| 822 (div.offsetHeight - displayNameContainer.offsetHeight) / 2 + 'px'; | 854 (div.offsetHeight - displayNameContainer.offsetHeight) / 2 + 'px'; |
| 823 display.originalPosition = {x: div.offsetLeft, y: div.offsetTop}; | 855 display.originalPosition = {x: div.offsetLeft, y: div.offsetTop}; |
| 824 } | 856 } |
| 825 }, | 857 }, |
| 826 | 858 |
| 827 /** | 859 /** |
| 828 * Called when the display arrangement has changed. | 860 * Called when the display arrangement has changed. |
| 829 * @param {boolean} mirroring Whether current mode is mirroring or not. | 861 * @param {boolean} mirroring Whether current mode is mirroring or not. |
| 830 * @param {Array} displays The list of the display information. | 862 * @param {Array.<options.DisplayInfo>} displays The list of the display |
| 831 * @param {SecondaryDisplayLayout} layout The layout strategy. | 863 * information. |
| 864 * @param {options.SecondaryDisplayLayout} layout The layout strategy. |
| 832 * @param {number} offset The offset of the secondary display. | 865 * @param {number} offset The offset of the secondary display. |
| 833 * @private | 866 * @private |
| 834 */ | 867 */ |
| 835 onDisplayChanged_: function(mirroring, displays, layout, offset) { | 868 onDisplayChanged_: function(mirroring, displays, layout, offset) { |
| 836 if (!this.visible) | 869 if (!this.visible) |
| 837 return; | 870 return; |
| 838 | 871 |
| 839 var hasExternal = false; | 872 var hasExternal = false; |
| 840 for (var i = 0; i < displays.length; i++) { | 873 for (var i = 0; i < displays.length; i++) { |
| 841 if (!displays[i].isInternal) { | 874 if (!displays[i].isInternal) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 876 mirroring, displays, layout, offset) { | 909 mirroring, displays, layout, offset) { |
| 877 DisplayOptions.getInstance().onDisplayChanged_( | 910 DisplayOptions.getInstance().onDisplayChanged_( |
| 878 mirroring, displays, layout, offset); | 911 mirroring, displays, layout, offset); |
| 879 }; | 912 }; |
| 880 | 913 |
| 881 // Export | 914 // Export |
| 882 return { | 915 return { |
| 883 DisplayOptions: DisplayOptions | 916 DisplayOptions: DisplayOptions |
| 884 }; | 917 }; |
| 885 }); | 918 }); |
| OLD | NEW |