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 ///////////////////////////////////////////////////////////////////////////// | 6 ///////////////////////////////////////////////////////////////////////////// |
7 // OptionsPage class: | 7 // OptionsPage class: |
8 | 8 |
9 /** | 9 /** |
10 * Base class for options page. | 10 * Base class for options page. |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 parentPage, | 493 parentPage, |
494 associatedControls) { | 494 associatedControls) { |
495 this.registeredOverlayPages[overlay.name.toLowerCase()] = overlay; | 495 this.registeredOverlayPages[overlay.name.toLowerCase()] = overlay; |
496 overlay.parentPage = parentPage; | 496 overlay.parentPage = parentPage; |
497 if (associatedControls) { | 497 if (associatedControls) { |
498 overlay.associatedControls = associatedControls; | 498 overlay.associatedControls = associatedControls; |
499 if (associatedControls.length) { | 499 if (associatedControls.length) { |
500 overlay.associatedSection = | 500 overlay.associatedSection = |
501 this.findSectionForNode_(associatedControls[0]); | 501 this.findSectionForNode_(associatedControls[0]); |
502 } | 502 } |
| 503 |
| 504 // Sanity check. |
| 505 for (var i = 0; i < associatedControls.length; ++i) { |
| 506 assert(associatedControls[i], 'Invalid element passed.'); |
| 507 } |
503 } | 508 } |
504 | 509 |
505 // Reverse the button strip for views. See the documentation of | 510 // Reverse the button strip for views. See the documentation of |
506 // reverseButtonStrip_() for an explanation of why this is necessary. | 511 // reverseButtonStrip_() for an explanation of why this is necessary. |
507 if (cr.isViews) | 512 if (cr.isViews) |
508 this.reverseButtonStrip_(overlay); | 513 this.reverseButtonStrip_(overlay); |
509 | 514 |
510 overlay.tab = undefined; | 515 overlay.tab = undefined; |
511 overlay.isOverlay = true; | 516 overlay.isOverlay = true; |
512 overlay.initializePage(); | 517 overlay.initializePage(); |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
939 canShowPage: function() { | 944 canShowPage: function() { |
940 return true; | 945 return true; |
941 }, | 946 }, |
942 }; | 947 }; |
943 | 948 |
944 // Export | 949 // Export |
945 return { | 950 return { |
946 OptionsPage: OptionsPage | 951 OptionsPage: OptionsPage |
947 }; | 952 }; |
948 }); | 953 }); |
OLD | NEW |