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 Page = cr.ui.pageManager.Page; | 6 var Page = cr.ui.pageManager.Page; |
7 var PageManager = cr.ui.pageManager.PageManager; | 7 var PageManager = cr.ui.pageManager.PageManager; |
8 | 8 |
9 // The scale ratio of the display rectangle to its original size. | 9 // The scale ratio of the display rectangle to its original size. |
10 /** @const */ var VISUAL_SCALE = 1 / 10; | 10 /** @const */ var VISUAL_SCALE = 1 / 10; |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 | 196 |
197 /** @override */ | 197 /** @override */ |
198 didShowPage: function() { | 198 didShowPage: function() { |
199 var optionTitles = document.getElementsByClassName( | 199 var optionTitles = document.getElementsByClassName( |
200 'selected-display-option-title'); | 200 'selected-display-option-title'); |
201 var maxSize = 0; | 201 var maxSize = 0; |
202 for (var i = 0; i < optionTitles.length; i++) | 202 for (var i = 0; i < optionTitles.length; i++) |
203 maxSize = Math.max(maxSize, optionTitles[i].clientWidth); | 203 maxSize = Math.max(maxSize, optionTitles[i].clientWidth); |
204 for (var i = 0; i < optionTitles.length; i++) | 204 for (var i = 0; i < optionTitles.length; i++) |
205 optionTitles[i].style.width = maxSize + 'px'; | 205 optionTitles[i].style.width = maxSize + 'px'; |
206 }, | 206 chrome.send('getDisplayInfo'); |
207 | |
208 /** @override */ | |
209 onVisibilityChanged_: function() { | |
210 Page.prototype.onVisibilityChanged_(this); | |
211 if (this.visible) | |
212 chrome.send('getDisplayInfo'); | |
213 }, | 207 }, |
214 | 208 |
215 /** | 209 /** |
216 * Mouse move handler for dragging display rectangle. | 210 * Mouse move handler for dragging display rectangle. |
217 * @param {Event} e The mouse move event. | 211 * @param {Event} e The mouse move event. |
218 * @private | 212 * @private |
219 */ | 213 */ |
220 onMouseMove_: function(e) { | 214 onMouseMove_: function(e) { |
221 return this.processDragging_(e, {x: e.pageX, y: e.pageY}); | 215 return this.processDragging_(e, {x: e.pageX, y: e.pageY}); |
222 }, | 216 }, |
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 mirroring, displays, layout, offset) { | 870 mirroring, displays, layout, offset) { |
877 DisplayOptions.getInstance().onDisplayChanged_( | 871 DisplayOptions.getInstance().onDisplayChanged_( |
878 mirroring, displays, layout, offset); | 872 mirroring, displays, layout, offset); |
879 }; | 873 }; |
880 | 874 |
881 // Export | 875 // Export |
882 return { | 876 return { |
883 DisplayOptions: DisplayOptions | 877 DisplayOptions: DisplayOptions |
884 }; | 878 }; |
885 }); | 879 }); |
OLD | NEW |