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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 $('display-options-toggle-mirroring').onclick = (function() { | 50 $('display-options-toggle-mirroring').onclick = (function() { |
51 this.mirroring_ = !this.mirroring_; | 51 this.mirroring_ = !this.mirroring_; |
52 chrome.send('setMirroring', [this.mirroring_]); | 52 chrome.send('setMirroring', [this.mirroring_]); |
53 }).bind(this); | 53 }).bind(this); |
54 | 54 |
55 $('display-options-apply').onclick = this.applyResult_.bind(this); | 55 $('display-options-apply').onclick = this.applyResult_.bind(this); |
56 chrome.send('getDisplayInfo'); | 56 chrome.send('getDisplayInfo'); |
57 }, | 57 }, |
58 | 58 |
| 59 /** @override */ |
| 60 onVisibilityChanged_: function() { |
| 61 OptionsPage.prototype.onVisibilityChanged_(this); |
| 62 if (this.visible) |
| 63 chrome.send('getDisplayInfo'); |
| 64 }, |
| 65 |
59 /** | 66 /** |
60 * Collects the current data and sends it to Chrome. | 67 * Collects the current data and sends it to Chrome. |
61 * @private | 68 * @private |
62 */ | 69 */ |
63 applyResult_: function() { | 70 applyResult_: function() { |
64 // Offset is calculated from top or left edge. | 71 // Offset is calculated from top or left edge. |
65 var primary = this.displays_[0]; | 72 var primary = this.displays_[0]; |
66 var secondary = this.displays_[1]; | 73 var secondary = this.displays_[1]; |
67 var offset; | 74 var offset; |
68 if (this.layout_ == SecondaryDisplayLayout.LEFT || | 75 if (this.layout_ == SecondaryDisplayLayout.LEFT || |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 mirroring, displays, layout, offset) { | 445 mirroring, displays, layout, offset) { |
439 DisplayOptions.getInstance().onDisplayChanged_( | 446 DisplayOptions.getInstance().onDisplayChanged_( |
440 mirroring, displays, layout, offset); | 447 mirroring, displays, layout, offset); |
441 }; | 448 }; |
442 | 449 |
443 // Export | 450 // Export |
444 return { | 451 return { |
445 DisplayOptions: DisplayOptions | 452 DisplayOptions: DisplayOptions |
446 }; | 453 }; |
447 }); | 454 }); |
OLD | NEW |