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

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

Issue 449623003: Integrate About page into Settings for Chrome OS settings in a window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
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 | Annotate | Revision Log
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('help', function() { 5 cr.define('help', function() {
6 var Page = cr.ui.pageManager.Page; 6 var Page = cr.ui.pageManager.Page;
7 var PageManager = cr.ui.pageManager.PageManager; 7 var PageManager = cr.ui.pageManager.PageManager;
8 8
9 /** 9 /**
10 * Encapsulated handling of the About page. Called 'help' internally to avoid 10 * Encapsulated handling of the About page. Called 'help' internally to avoid
11 * confusion with generic AboutUI (about:memory, about:sandbox, etc.). 11 * confusion with generic AboutUI (about:memory, about:sandbox, etc.).
12 */ 12 */
13 function HelpPage() { 13 function HelpPage() {
14 Page.call(this, 'help', loadTimeData.getString('aboutTitle'), 14 var id = loadTimeData.valueExists('aboutOverlayTabTitle') ?
15 'help-page'); 15 'aboutOverlayTabTitle' : 'aboutTitle';
16 Page.call(this, 'help', loadTimeData.getString(id), 'help-page');
16 } 17 }
17 18
18 cr.addSingletonGetter(HelpPage); 19 cr.addSingletonGetter(HelpPage);
19 20
20 HelpPage.prototype = { 21 HelpPage.prototype = {
21 __proto__: Page.prototype, 22 __proto__: Page.prototype,
22 23
23 /** 24 /**
24 * True if after update powerwash button should be displayed. 25 * True if after update powerwash button should be displayed.
25 * @private 26 * @private
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 $('channel-change-disallowed-icon'), 137 $('channel-change-disallowed-icon'),
137 $('help-container'), 138 $('help-container'),
138 cr.ui.ArrowLocation.TOP_END); 139 cr.ui.ArrowLocation.TOP_END);
139 }; 140 };
140 } 141 }
141 142
142 // Attempt to update. 143 // Attempt to update.
143 chrome.send('onPageLoaded'); 144 chrome.send('onPageLoaded');
144 }, 145 },
145 146
147 /** @override */
148 didClosePage: function() {
149 this.setMoreInfoVisible_(false);
150 },
151
152 /**
153 * Sets the visible state of the 'More Info' section.
154 * @param {boolean} visible Whether the section should be visible.
155 * @private
156 */
157 setMoreInfoVisible_: function(visible) {
158 var moreInfo = $('more-info-container');
159 if ((visible && moreInfo.classList.contains('visible')) ||
160 !visible && !moreInfo.classList.contains('visible')) {
161 return;
162 }
Dan Beam 2014/08/13 22:26:18 if (visible == moreInfo.classList.contains('visibl
michaelpg 2014/08/14 11:43:55 Done.
163
164 if (visible)
165 moreInfo.classList.add('visible');
166 else
167 moreInfo.classList.remove('visible');
Dan Beam 2014/08/13 22:26:18 moreInfo.classList.toggle('visible', visible);
michaelpg 2014/08/14 11:43:55 Done.
168 moreInfo.style.height = visible ? moreInfo.scrollHeight + 'px' : '';
169 moreInfo.addEventListener('webkitTransitionEnd', function(event) {
170 $('more-info-expander').textContent = visible ?
171 loadTimeData.getString('hideMoreInfo') :
172 loadTimeData.getString('showMoreInfo');
173 });
174 },
175
146 /** 176 /**
147 * Toggles the visible state of the 'More Info' section. 177 * Toggles the visible state of the 'More Info' section.
148 * @private 178 * @private
149 */ 179 */
150 toggleMoreInfo_: function() { 180 toggleMoreInfo_: function() {
151 var moreInfo = $('more-info-container'); 181 var moreInfo = $('more-info-container');
152 var visible = moreInfo.className == 'visible'; 182 var visible = moreInfo.classList.contains('visible');
153 moreInfo.className = visible ? '' : 'visible'; 183 this.setMoreInfoVisible_(!visible);
Dan Beam 2014/08/13 22:26:18 nit: this.setMoreInfoVisible_(!moreInfo.clas
michaelpg 2014/08/14 11:43:55 Done.
154 moreInfo.style.height = visible ? '' : moreInfo.scrollHeight + 'px';
155 moreInfo.addEventListener('webkitTransitionEnd', function(event) {
156 $('more-info-expander').textContent = visible ?
157 loadTimeData.getString('showMoreInfo') :
158 loadTimeData.getString('hideMoreInfo');
159 });
160 }, 184 },
161 185
162 /** 186 /**
163 * Assigns |method| to the onclick property of |el| if |el| exists. 187 * Assigns |method| to the onclick property of |el| if |el| exists.
164 * @param {HTMLElement} el The element on which to set the click handler. 188 * @param {HTMLElement} el The element on which to set the click handler.
165 * @param {function} method The click handler. 189 * @param {function} method The click handler.
166 * @private 190 * @private
167 */ 191 */
168 maybeSetOnClick_: function(el, method) { 192 maybeSetOnClick_: function(el, method) {
169 if (el) 193 if (el)
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 533
510 HelpPage.updateChannelChangePageContainerVisibility = function() { 534 HelpPage.updateChannelChangePageContainerVisibility = function() {
511 HelpPage.getInstance().updateChannelChangePageContainerVisibility_(); 535 HelpPage.getInstance().updateChannelChangePageContainerVisibility_();
512 }; 536 };
513 537
514 // Export 538 // Export
515 return { 539 return {
516 HelpPage: HelpPage 540 HelpPage: HelpPage
517 }; 541 };
518 }); 542 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/help/help.js ('k') | chrome/browser/resources/options/browser_options.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698