| 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.define('options', function() { | 5 cr.define('options', function() { |
| 6 var OptionsPage = options.OptionsPage; | 6 var OptionsPage = options.OptionsPage; |
| 7 | 7 |
| 8 // The scale ratio of the display rectangle to its original size. | 8 // The scale ratio of the display rectangle to its original size. |
| 9 /** @const */ var VISUAL_SCALE = 1 / 10; | 9 /** @const */ var VISUAL_SCALE = 1 / 10; |
| 10 | 10 |
| (...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1049 * @param {boolean} mirroring Whether current mode is mirroring or not. | 1049 * @param {boolean} mirroring Whether current mode is mirroring or not. |
| 1050 * @param {Array} displays The list of the display information. | 1050 * @param {Array} displays The list of the display information. |
| 1051 * @param {SecondaryDisplayLayout} layout The layout strategy. | 1051 * @param {SecondaryDisplayLayout} layout The layout strategy. |
| 1052 * @param {number} offset The offset of the secondary display. | 1052 * @param {number} offset The offset of the secondary display. |
| 1053 * @private | 1053 * @private |
| 1054 */ | 1054 */ |
| 1055 onDisplayChanged_: function(mirroring, displays, layout, offset) { | 1055 onDisplayChanged_: function(mirroring, displays, layout, offset) { |
| 1056 if (!this.visible) | 1056 if (!this.visible) |
| 1057 return; | 1057 return; |
| 1058 | 1058 |
| 1059 if (displays.length < 2 && !mirroring) { | 1059 var hasExternal = false; |
| 1060 for (var i = 0; i < displays.length; i++) { |
| 1061 if (!displays[i].isInternal) { |
| 1062 hasExternal = true; |
| 1063 break; |
| 1064 } |
| 1065 } |
| 1066 if (!hasExternal && !mirroring) { |
| 1060 OptionsPage.showDefaultPage(); | 1067 OptionsPage.showDefaultPage(); |
| 1061 return; | 1068 return; |
| 1062 } | 1069 } |
| 1063 | 1070 |
| 1064 this.mirroring_ = mirroring; | 1071 this.mirroring_ = mirroring; |
| 1065 this.layout_ = layout; | 1072 this.layout_ = layout; |
| 1066 this.offset_ = offset; | 1073 this.offset_ = offset; |
| 1067 this.dirty_ = false; | 1074 this.dirty_ = false; |
| 1068 | 1075 |
| 1069 $('display-options-toggle-mirroring').textContent = | 1076 $('display-options-toggle-mirroring').textContent = |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1098 mirroring, displays, layout, offset) { | 1105 mirroring, displays, layout, offset) { |
| 1099 DisplayOptions.getInstance().onDisplayChanged_( | 1106 DisplayOptions.getInstance().onDisplayChanged_( |
| 1100 mirroring, displays, layout, offset); | 1107 mirroring, displays, layout, offset); |
| 1101 }; | 1108 }; |
| 1102 | 1109 |
| 1103 // Export | 1110 // Export |
| 1104 return { | 1111 return { |
| 1105 DisplayOptions: DisplayOptions | 1112 DisplayOptions: DisplayOptions |
| 1106 }; | 1113 }; |
| 1107 }); | 1114 }); |
| OLD | NEW |