OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // <include src="../node_utils.js"> | 5 // <include src="../node_utils.js"> |
6 | 6 |
7 cr.define('cr.ui.pageManager', function() { | 7 cr.define('cr.ui.pageManager', function() { |
8 var PageManager = cr.ui.pageManager.PageManager; | 8 var PageManager = cr.ui.pageManager.PageManager; |
9 | 9 |
10 /** | 10 /** |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 /** | 71 /** |
72 * Called by the PageManager when this.hash changes while the page is | 72 * Called by the PageManager when this.hash changes while the page is |
73 * already visible. This is analogous to the hashchange DOM event. | 73 * already visible. This is analogous to the hashchange DOM event. |
74 */ | 74 */ |
75 didChangeHash: function() {}, | 75 didChangeHash: function() {}, |
76 | 76 |
77 /** | 77 /** |
78 * Sets focus on the first focusable element. Override for a custom focus | 78 * Sets focus on the first focusable element. Override for a custom focus |
79 * strategy. | 79 * strategy. |
80 */ | 80 */ |
81 focus: function() { cr.ui.setInitialFocus(this.pageDiv); }, | 81 focus: function() { |
| 82 cr.ui.setInitialFocus(this.pageDiv); |
| 83 }, |
82 | 84 |
83 /** | 85 /** |
84 * Reverse any buttons strips in this page (only applies to overlays). | 86 * Reverse any buttons strips in this page (only applies to overlays). |
85 * @see cr.ui.reverseButtonStrips for an explanation of why this is | 87 * @see cr.ui.reverseButtonStrips for an explanation of why this is |
86 * necessary and when it's done. | 88 * necessary and when it's done. |
87 */ | 89 */ |
88 reverseButtonStrip: function() { | 90 reverseButtonStrip: function() { |
89 assert(this.isOverlay); | 91 assert(this.isOverlay); |
90 cr.ui.reverseButtonStrips(this.pageDiv); | 92 cr.ui.reverseButtonStrips(this.pageDiv); |
91 }, | 93 }, |
92 | 94 |
93 /** | 95 /** |
94 * Whether it should be possible to show the page. | 96 * Whether it should be possible to show the page. |
95 * @return {boolean} True if the page should be shown. | 97 * @return {boolean} True if the page should be shown. |
96 */ | 98 */ |
97 canShowPage: function() { return true; }, | 99 canShowPage: function() { |
| 100 return true; |
| 101 }, |
98 | 102 |
99 /** | 103 /** |
100 * Updates the hash of the current page. If the page is topmost, the history | 104 * Updates the hash of the current page. If the page is topmost, the history |
101 * state is updated. | 105 * state is updated. |
102 * @param {string} hash The new hash value. Like location.hash, this | 106 * @param {string} hash The new hash value. Like location.hash, this |
103 * should include the leading '#' if not empty. | 107 * should include the leading '#' if not empty. |
104 */ | 108 */ |
105 setHash: function(hash) { | 109 setHash: function(hash) { |
106 if (this.hash == hash) | 110 if (this.hash == hash) |
107 return; | 111 return; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 } | 180 } |
177 | 181 |
178 cr.dispatchPropertyChange(this, 'visible', visible, !visible); | 182 cr.dispatchPropertyChange(this, 'visible', visible, !visible); |
179 }, | 183 }, |
180 | 184 |
181 /** | 185 /** |
182 * Whether the page is considered 'sticky', such that it will remain a root | 186 * Whether the page is considered 'sticky', such that it will remain a root |
183 * page even if sub-pages change. | 187 * page even if sub-pages change. |
184 * @type {boolean} True if this page is sticky. | 188 * @type {boolean} True if this page is sticky. |
185 */ | 189 */ |
186 get sticky() { return false; }, | 190 get sticky() { |
| 191 return false; |
| 192 }, |
187 | 193 |
188 /** | 194 /** |
189 * @type {boolean} True if this page should always be considered the | 195 * @type {boolean} True if this page should always be considered the |
190 * top-most page when visible. | 196 * top-most page when visible. |
191 */ | 197 */ |
192 get alwaysOnTop() { return this.alwaysOnTop_; }, | 198 get alwaysOnTop() { |
| 199 return this.alwaysOnTop_; |
| 200 }, |
193 | 201 |
194 /** | 202 /** |
195 * @type {boolean} True if this page should always be considered the | 203 * @type {boolean} True if this page should always be considered the |
196 * top-most page when visible. Only overlays can be always on top. | 204 * top-most page when visible. Only overlays can be always on top. |
197 */ | 205 */ |
198 set alwaysOnTop(value) { | 206 set alwaysOnTop(value) { |
199 assert(this.isOverlay); | 207 assert(this.isOverlay); |
200 this.alwaysOnTop_ = value; | 208 this.alwaysOnTop_ = value; |
201 }, | 209 }, |
202 | 210 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 this.parentPage.pageDiv.parentElement.removeAttribute('aria-hidden'); | 295 this.parentPage.pageDiv.parentElement.removeAttribute('aria-hidden'); |
288 | 296 |
289 PageManager.onPageVisibilityChanged(this); | 297 PageManager.onPageVisibilityChanged(this); |
290 } | 298 } |
291 }, | 299 }, |
292 }; | 300 }; |
293 | 301 |
294 // Export | 302 // Export |
295 return {Page: Page}; | 303 return {Page: Page}; |
296 }); | 304 }); |
OLD | NEW |