Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 /** | |
| 6 * @fileoverview | |
| 7 * Behavior controlling the visibility of Settings pages. | |
| 8 * | |
| 9 * Example: | |
| 10 * behaviors: [SettingsPageVisibility], | |
| 11 * | |
| 12 * @group Chrome UI Behavior | |
| 13 */ | |
| 14 | |
| 15 /** | |
| 16 * Set this to true in tests before loading the page (e.g. in preLoad()) so that | |
| 17 * pages do not initially get created. Set this to false BEFORE modifying | |
| 18 * pageVisibility. NOTE: Changing this value after the DOM is loaded will not | |
| 19 * trigger a visibility change, pageVisibility must be modified to trigger data | |
| 20 * binding events. | |
| 21 * @type {boolean} | |
| 22 */ | |
| 23 var SettingsHideAllPagesForTest; | |
|
Dan Beam
2015/12/08 02:55:27
nit: settingsHideAllPagesForTest
stevenjb
2015/12/08 20:07:37
Done.
| |
| 24 | |
| 25 /** @polymerBehavior */ | |
| 26 var SettingsPageVisibility = { | |
| 27 properties: { | |
| 28 /** | |
| 29 * Dictionary defining page visibility. If not set for a page, visibility | |
| 30 * will default to true (unless SettingsHideAllPagesForTest is set). | |
| 31 * @type {Object<string, boolean>} | |
|
michaelpg
2015/12/08 00:45:58
nit: just Object<boolean>, keys are always strings
Dan Beam
2015/12/08 02:55:27
+1 (I thought we had a presubmit about this?)
stevenjb
2015/12/08 20:07:37
Done. (And apparently not, we have 128 instances o
| |
| 32 */ | |
| 33 pageVisibility: { | |
| 34 type: Object, | |
| 35 value: function() { return {}; }, | |
| 36 notify: true, | |
|
michaelpg
2015/12/08 00:45:58
notify: true is unnecessary -- no one is two-way b
stevenjb
2015/12/08 20:07:37
Not currently... and probably not ever. Done.
| |
| 37 }, | |
| 38 }, | |
| 39 | |
| 40 /** | |
| 41 * @param {boolean} visibility | |
| 42 * @return {boolean} | |
| 43 */ | |
| 44 showPage: function(visibility) { | |
| 45 return !SettingsHideAllPagesForTest && visibility !== false; | |
| 46 }, | |
| 47 }; | |
| OLD | NEW |