Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Side by Side Diff: chrome/browser/resources/help/help_base_page.js

Issue 443553002: Typecheck chrome://help using CompilerPass.java, everything except dependency to options (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@true_master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 // Helper base class for all help pages and overlays, which controls 5 // Helper base class for all help pages and overlays, which controls
6 // overlays, focus and scroll. This class is partially based on 6 // overlays, focus and scroll. This class is partially based on
7 // OptionsPage, but simpler and contains only overlay- and focus- 7 // OptionsPage, but simpler and contains only overlay- and focus-
8 // handling logic. As in OptionsPage each page can be an overlay itself, 8 // handling logic. As in OptionsPage each page can be an overlay itself,
9 // but each page contains its own list of registered overlays which can be 9 // but each page contains its own list of registered overlays which can be
10 // displayed over it. 10 // displayed over it.
11 // 11 //
12 // TODO (ygorshenin@): crbug.com/313244. 12 // TODO (ygorshenin@): crbug.com/313244.
13 cr.define('help', function() { 13 cr.define('help', function() {
14 /**
15 * @constructor
16 * @extends {HTMLDivElement}
17 */
14 function HelpBasePage() { 18 function HelpBasePage() {
15 } 19 }
16 20
17 HelpBasePage.prototype = { 21 HelpBasePage.prototype = {
18 __proto__: HTMLDivElement.prototype, 22 __proto__: HTMLDivElement.prototype,
19 23
20 /** 24 /**
21 * name of the page, should be the same as an id of the 25 * name of the page, should be the same as an id of the
22 * corresponding HTMLDivElement. 26 * corresponding HTMLDivElement.
23 */ 27 */
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 /** 147 /**
144 * @return {HTMLDivElement} Topmost visible page, or null, if 148 * @return {HTMLDivElement} Topmost visible page, or null, if
145 * there are no visible pages. 149 * there are no visible pages.
146 */ 150 */
147 getTopmostVisiblePage: function() { 151 getTopmostVisiblePage: function() {
148 return this.getVisibleOverlay_() || this.getVisibleNonOverlay_(); 152 return this.getVisibleOverlay_() || this.getVisibleNonOverlay_();
149 }, 153 },
150 154
151 /** 155 /**
152 * Registers overlay. 156 * Registers overlay.
153 * @param {HelpBasePage} overlay Overlay that should be registered. 157 * @param {help.HelpBasePage} overlay Overlay that should be registered.
154 */ 158 */
155 registerOverlay: function(overlay) { 159 registerOverlay: function(overlay) {
156 this.registeredOverlays[overlay.name] = overlay; 160 this.registeredOverlays[overlay.name] = overlay;
157 overlay.isOverlay = true; 161 overlay.isOverlay = true;
158 }, 162 },
159 163
160 /** 164 /**
161 * Shows or hides current page. 165 * Shows or hides current page.
162 * @param {boolean} visible True if current page should be displayed. 166 * @param {boolean} visible True if current page should be displayed.
163 */ 167 */
(...skipping 26 matching lines...) Expand all
190 return !this.pageDiv.hidden; 194 return !this.pageDiv.hidden;
191 }, 195 },
192 196
193 /** 197 /**
194 * This method returns overlay container, it should be called only 198 * This method returns overlay container, it should be called only
195 * on overlays. 199 * on overlays.
196 * @return {HTMLDivElement} overlay container. 200 * @return {HTMLDivElement} overlay container.
197 */ 201 */
198 get container() { 202 get container() {
199 assert(this.isOverlay); 203 assert(this.isOverlay);
200 return this.pageDiv.parentNode; 204 return /** @type {HTMLDivElement} */(this.pageDiv.parentNode);
Dan Beam 2014/08/05 18:49:27 why don't you make this HTMLElement instead? Div
Vitaly Pavlenko 2014/08/05 23:00:54 Done.
201 }, 205 },
202 206
203 /** 207 /**
204 * Shows registered overlay. 208 * Shows registered overlay.
205 * @param {string} name Name of registered overlay to show. 209 * @param {string} name Name of registered overlay to show.
206 */ 210 */
207 showOverlay: function(name) { 211 showOverlay: function(name) {
208 var currentPage = this.getTopmostVisiblePage(); 212 var currentPage = this.getTopmostVisiblePage();
209 currentPage.storeLastFocusedElement_(); 213 currentPage.storeLastFocusedElement_();
210 currentPage.freeze_(true); 214 currentPage.freeze_(true);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 return; 249 return;
246 } 250 }
247 }, 251 },
248 }; 252 };
249 253
250 // Export 254 // Export
251 return { 255 return {
252 HelpBasePage: HelpBasePage 256 HelpBasePage: HelpBasePage
253 }; 257 };
254 }); 258 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698