OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 /////////////////////////////////////////////////////////////////////////////// | 5 /////////////////////////////////////////////////////////////////////////////// |
6 // OptionsPage class: | 6 // OptionsPage class: |
7 | 7 |
8 /** | 8 /** |
9 * Base class for options page. | 9 * Base class for options page. |
10 * @constructor | 10 * @constructor |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 }, | 139 }, |
140 | 140 |
141 /** | 141 /** |
142 * Sets page visibility. | 142 * Sets page visibility. |
143 */ | 143 */ |
144 set visible(visible) { | 144 set visible(visible) { |
145 if ((this.visible && visible) || (!this.visible && !visible)) | 145 if ((this.visible && visible) || (!this.visible && !visible)) |
146 return; | 146 return; |
147 | 147 |
148 if (visible) { | 148 if (visible) { |
149 window.history.pushState({pageName: this.name}, | |
150 this.title, | |
151 '/' + this.name); | |
152 this.pageDiv.style.display = 'block'; | 149 this.pageDiv.style.display = 'block'; |
153 if (this.isOverlay) { | 150 if (this.isOverlay) { |
154 var overlay = $('overlay'); | 151 var overlay = $('overlay'); |
155 overlay.classList.remove('hidden'); | 152 overlay.classList.remove('hidden'); |
| 153 } else { |
| 154 window.history.pushState({pageName: this.name}, |
| 155 this.title, |
| 156 '/' + this.name); |
156 } | 157 } |
157 if (this.tab) { | 158 if (this.tab) { |
158 this.tab.classList.add('navbar-item-selected'); | 159 this.tab.classList.add('navbar-item-selected'); |
159 if (this.tab.parentNode && this.tab.parentNode.id == 'subpagesnav') | 160 if (this.tab.parentNode && this.tab.parentNode.id == 'subpagesnav') |
160 this.tab.classList.remove('hidden'); | 161 this.tab.classList.remove('hidden'); |
161 } | 162 } |
162 } else { | 163 } else { |
163 if (this.isOverlay) { | 164 if (this.isOverlay) { |
164 var overlay = $('overlay'); | 165 var overlay = $('overlay'); |
165 overlay.classList.add('hidden'); | 166 overlay.classList.add('hidden'); |
166 } | 167 } |
167 this.pageDiv.style.display = 'none'; | 168 this.pageDiv.style.display = 'none'; |
168 if (this.tab) { | 169 if (this.tab) { |
169 this.tab.classList.remove('navbar-item-selected'); | 170 this.tab.classList.remove('navbar-item-selected'); |
170 if (this.tab.parentNode && this.tab.parentNode.id == 'subpagesnav') | 171 if (this.tab.parentNode && this.tab.parentNode.id == 'subpagesnav') |
171 this.tab.classList.add('hidden'); | 172 this.tab.classList.add('hidden'); |
172 } | 173 } |
173 } | 174 } |
174 | 175 |
175 cr.dispatchPropertyChange(this, 'visible', visible, !visible); | 176 cr.dispatchPropertyChange(this, 'visible', visible, !visible); |
176 } | 177 } |
177 }; | 178 }; |
OLD | NEW |