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

Side by Side Diff: ui/webui/resources/js/cr/ui/page_manager/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: rebase to master, compile everything but dependency to options 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 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 cr.define('cr.ui.pageManager', function() { 5 cr.define('cr.ui.pageManager', function() {
6 var PageManager = cr.ui.pageManager.PageManager; 6 var PageManager = cr.ui.pageManager.PageManager;
7 7
8 /** 8 /**
9 * Base class for pages that can be shown and hidden by PageManager. Each Page 9 * Base class for pages that can be shown and hidden by PageManager. Each Page
10 * is like a node in a forest, corresponding to a particular div. At any 10 * is like a node in a forest, corresponding to a particular div. At any
11 * point, one root Page is visible, and any visible Page can show a child Page 11 * point, one root Page is visible, and any visible Page can show a child Page
12 * as an overlay. The host of the root Page(s) should provide a container div 12 * as an overlay. The host of the root Page(s) should provide a container div
13 * for each nested level to enforce the stack order of overlays. 13 * for each nested level to enforce the stack order of overlays.
14 * @constructor 14 * @constructor
15 * @param {string} name Page name. 15 * @param {string} name Page name.
16 * @param {string} title Page title, used for history. 16 * @param {string} title Page title, used for history.
17 * @param {string} pageDivName ID of the div corresponding to the page. 17 * @param {string} pageDivName ID of the div corresponding to the page.
18 * @extends {EventTarget}
Dan Beam 2014/08/13 22:20:08 this needs to match with the __proto__ line
Vitaly Pavlenko 2014/08/14 00:01:02 Done.
19 */ 18 */
20 function Page(name, title, pageDivName) { 19 function Page(name, title, pageDivName) {
21 this.name = name; 20 this.name = name;
22 this.title = title; 21 this.title = title;
23 this.pageDivName = pageDivName; 22 this.pageDivName = pageDivName;
24 this.pageDiv = $(this.pageDivName); 23 this.pageDiv = $(this.pageDivName);
25 // |pageDiv.page| is set to the page object (this) when the page is visible 24 // |pageDiv.page| is set to the page object (this) when the page is visible
26 // to track which page is being shown when multiple pages can share the same 25 // to track which page is being shown when multiple pages can share the same
27 // underlying div. 26 // underlying div.
28 this.pageDiv.page = null; 27 this.pageDiv.page = null;
29 this.tab = null; 28 this.tab = null;
30 this.lastFocusedElement = null; 29 this.lastFocusedElement = null;
31 } 30 }
32 31
33 Page.prototype = { 32 Page.prototype = {
34 __proto__: cr.EventTarget.prototype, 33 __proto__: cr.EventTarget.prototype,
35 34
36 /** 35 /**
37 * The parent page of this page, or null for root pages. 36 * The parent page of this page, or null for root pages.
38 * @type {Page} 37 * @type {cr.ui.pageManager.Page}
39 */ 38 */
40 parentPage: null, 39 parentPage: null,
41 40
42 /** 41 /**
43 * The section on the parent page that is associated with this page. 42 * The section on the parent page that is associated with this page.
44 * Can be null. 43 * Can be null.
45 * @type {Element} 44 * @type {Element}
46 */ 45 */
47 associatedSection: null, 46 associatedSection: null,
48 47
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 // -webkit-transition is 200ms. Let's wait for 400ms. 235 // -webkit-transition is 200ms. Let's wait for 400ms.
237 ensureTransitionEndEvent(container, 400); 236 ensureTransitionEndEvent(container, 400);
238 } 237 }
239 238
240 if (visible) { 239 if (visible) {
241 container.hidden = false; 240 container.hidden = false;
242 pageDiv.hidden = false; 241 pageDiv.hidden = false;
243 pageDiv.page = this; 242 pageDiv.page = this;
244 // NOTE: This is a hacky way to force the container to layout which 243 // NOTE: This is a hacky way to force the container to layout which
245 // will allow us to trigger the webkit transition. 244 // will allow us to trigger the webkit transition.
245 /** @suppress {uselessCode} */
246 container.scrollTop; 246 container.scrollTop;
247 247
248 this.pageDiv.removeAttribute('aria-hidden'); 248 this.pageDiv.removeAttribute('aria-hidden');
249 if (this.parentPage) { 249 if (this.parentPage) {
250 this.parentPage.pageDiv.parentElement.setAttribute('aria-hidden', 250 this.parentPage.pageDiv.parentElement.setAttribute('aria-hidden',
251 true); 251 true);
252 } 252 }
253 container.classList.remove('transparent'); 253 container.classList.remove('transparent');
254 PageManager.onPageVisibilityChanged(this); 254 PageManager.onPageVisibilityChanged(this);
255 } else { 255 } else {
(...skipping 22 matching lines...) Expand all
278 PageManager.onPageVisibilityChanged(this); 278 PageManager.onPageVisibilityChanged(this);
279 } 279 }
280 }, 280 },
281 }; 281 };
282 282
283 // Export 283 // Export
284 return { 284 return {
285 Page: Page 285 Page: Page
286 }; 286 };
287 }); 287 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698