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

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: rebase 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 return;
161
162 moreInfo.classList.toggle('visible', visible);
163 moreInfo.style.height = visible ? moreInfo.scrollHeight + 'px' : '';
164 moreInfo.addEventListener('webkitTransitionEnd', function(event) {
165 $('more-info-expander').textContent = visible ?
166 loadTimeData.getString('hideMoreInfo') :
167 loadTimeData.getString('showMoreInfo');
168 });
169 },
170
146 /** 171 /**
147 * Toggles the visible state of the 'More Info' section. 172 * Toggles the visible state of the 'More Info' section.
148 * @private 173 * @private
149 */ 174 */
150 toggleMoreInfo_: function() { 175 toggleMoreInfo_: function() {
151 var moreInfo = $('more-info-container'); 176 var moreInfo = $('more-info-container');
152 var visible = moreInfo.className == 'visible'; 177 this.setMoreInfoVisible_(!moreInfo.classList.contains('visible'));
153 moreInfo.className = visible ? '' : 'visible';
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 }, 178 },
161 179
162 /** 180 /**
163 * Assigns |method| to the onclick property of |el| if |el| exists. 181 * Assigns |method| to the onclick property of |el| if |el| exists.
164 * @param {HTMLElement} el The element on which to set the click handler. 182 * @param {HTMLElement} el The element on which to set the click handler.
165 * @param {function} method The click handler. 183 * @param {function} method The click handler.
166 * @private 184 * @private
167 */ 185 */
168 maybeSetOnClick_: function(el, method) { 186 maybeSetOnClick_: function(el, method) {
169 if (el) 187 if (el)
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 527
510 HelpPage.updateChannelChangePageContainerVisibility = function() { 528 HelpPage.updateChannelChangePageContainerVisibility = function() {
511 HelpPage.getInstance().updateChannelChangePageContainerVisibility_(); 529 HelpPage.getInstance().updateChannelChangePageContainerVisibility_();
512 }; 530 };
513 531
514 // Export 532 // Export
515 return { 533 return {
516 HelpPage: HelpPage 534 HelpPage: HelpPage
517 }; 535 };
518 }); 536 });
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