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

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

Issue 10408007: retry 137554 - convert help page to loadTimeData (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <include src="../uber/uber_utils.js"> 5 <include src="../uber/uber_utils.js">
6 6
7 cr.define('help', function() { 7 cr.define('help', function() {
8 var localStrings = new LocalStrings();
9
10 /** 8 /**
11 * Encapsulated handling of the help page. 9 * Encapsulated handling of the help page.
12 */ 10 */
13 function HelpPage() {} 11 function HelpPage() {}
14 12
15 cr.addSingletonGetter(HelpPage); 13 cr.addSingletonGetter(HelpPage);
16 14
17 HelpPage.prototype = { 15 HelpPage.prototype = {
18 __proto__: HTMLDivElement.prototype, 16 __proto__: HTMLDivElement.prototype,
19 17
20 /** 18 /**
21 * Perform initial setup. 19 * Perform initial setup.
22 */ 20 */
23 initialize: function() { 21 initialize: function() {
24 uber.onContentFrameLoaded(); 22 uber.onContentFrameLoaded();
25 23
26 // Set the title. 24 // Set the title.
27 var title = localStrings.getString('helpTitle'); 25 var title = loadTimeData.getString('helpTitle');
28 uber.invokeMethodOnParent('setTitle', {title: title}); 26 uber.invokeMethodOnParent('setTitle', {title: title});
29 27
30 $('product-license').innerHTML = localStrings.getString('productLicense'); 28 $('product-license').innerHTML = loadTimeData.getString('productLicense');
31 if (cr.isChromeOS) 29 if (cr.isChromeOS) {
32 $('product-os-license').innerHTML = 30 $('product-os-license').innerHTML =
33 localStrings.getString('productOsLicense'); 31 loadTimeData.getString('productOsLicense');
32 }
34 33
35 var productTOS = $('product-tos'); 34 var productTOS = $('product-tos');
36 if (productTOS) 35 if (productTOS)
37 productTOS.innerHTML = localStrings.getString('productTOS'); 36 productTOS.innerHTML = loadTimeData.getString('productTOS');
38 37
39 $('get-help').onclick = chrome.send.bind(chrome, 'openHelpPage'); 38 $('get-help').onclick = chrome.send.bind(chrome, 'openHelpPage');
40 $('report-issue').onclick = 39 $('report-issue').onclick =
41 chrome.send.bind(chrome, 'openFeedbackDialog'); 40 chrome.send.bind(chrome, 'openFeedbackDialog');
42 41
43 this.maybeSetOnClick_($('more-info-expander'), 42 this.maybeSetOnClick_($('more-info-expander'),
44 this.toggleMoreInfo_.bind(this)); 43 this.toggleMoreInfo_.bind(this));
45 44
46 this.maybeSetOnClick_($('promote'), 45 this.maybeSetOnClick_($('promote'),
47 chrome.send.bind(chrome, 'promoteUpdater')); 46 chrome.send.bind(chrome, 'promoteUpdater'));
(...skipping 16 matching lines...) Expand all
64 * Toggles the visible state of the 'More Info' section. 63 * Toggles the visible state of the 'More Info' section.
65 * @private 64 * @private
66 */ 65 */
67 toggleMoreInfo_: function() { 66 toggleMoreInfo_: function() {
68 var moreInfo = $('more-info-container'); 67 var moreInfo = $('more-info-container');
69 var visible = moreInfo.className == 'visible'; 68 var visible = moreInfo.className == 'visible';
70 moreInfo.className = visible ? '' : 'visible'; 69 moreInfo.className = visible ? '' : 'visible';
71 moreInfo.style.height = visible ? '' : moreInfo.scrollHeight + 'px'; 70 moreInfo.style.height = visible ? '' : moreInfo.scrollHeight + 'px';
72 moreInfo.addEventListener('webkitTransitionEnd', function(event) { 71 moreInfo.addEventListener('webkitTransitionEnd', function(event) {
73 $('more-info-expander').textContent = visible ? 72 $('more-info-expander').textContent = visible ?
74 localStrings.getString('showMoreInfo') : 73 loadTimeData.getString('showMoreInfo') :
75 localStrings.getString('hideMoreInfo'); 74 loadTimeData.getString('hideMoreInfo');
76 }); 75 });
77 }, 76 },
78 77
79 /** 78 /**
80 * Assigns |method| to the onclick property of |el| if |el| exists. 79 * Assigns |method| to the onclick property of |el| if |el| exists.
81 * @private 80 * @private
82 */ 81 */
83 maybeSetOnClick_: function(el, method) { 82 maybeSetOnClick_: function(el, method) {
84 if (el) 83 if (el)
85 el.onclick = method; 84 el.onclick = method;
86 }, 85 },
87 86
88 /** 87 /**
89 * @private 88 * @private
90 */ 89 */
91 setUpdateImage_: function(state) { 90 setUpdateImage_: function(state) {
92 $('update-status-icon').className = 'update-icon ' + state; 91 $('update-status-icon').className = 'update-icon ' + state;
93 }, 92 },
94 93
95 /** 94 /**
96 * @private 95 * @private
97 */ 96 */
98 setUpdateStatus_: function(status, message) { 97 setUpdateStatus_: function(status, message) {
99 if (status == 'checking') { 98 if (status == 'checking') {
100 this.setUpdateImage_('working'); 99 this.setUpdateImage_('working');
101 $('update-status').innerHTML = 100 $('update-status').innerHTML =
102 localStrings.getString('updateCheckStarted'); 101 loadTimeData.getString('updateCheckStarted');
103 } else if (status == 'updating') { 102 } else if (status == 'updating') {
104 this.setUpdateImage_('working'); 103 this.setUpdateImage_('working');
105 $('update-status').innerHTML = localStrings.getString('updating'); 104 $('update-status').innerHTML = loadTimeData.getString('updating');
106 } else if (status == 'nearly_updated') { 105 } else if (status == 'nearly_updated') {
107 this.setUpdateImage_('up-to-date'); 106 this.setUpdateImage_('up-to-date');
108 $('update-status').innerHTML = 107 $('update-status').innerHTML =
109 localStrings.getString('updateAlmostDone'); 108 loadTimeData.getString('updateAlmostDone');
110 } else if (status == 'updated') { 109 } else if (status == 'updated') {
111 this.setUpdateImage_('up-to-date'); 110 this.setUpdateImage_('up-to-date');
112 $('update-status').innerHTML = localStrings.getString('upToDate'); 111 $('update-status').innerHTML = loadTimeData.getString('upToDate');
113 } else if (status == 'failed') { 112 } else if (status == 'failed') {
114 this.setUpdateImage_('failed'); 113 this.setUpdateImage_('failed');
115 $('update-status').innerHTML = message; 114 $('update-status').innerHTML = message;
116 } else if (status == 'disabled') { 115 } else if (status == 'disabled') {
117 var container = $('update-status-container'); 116 var container = $('update-status-container');
118 if (container) 117 if (container)
119 container.hidden = true; 118 container.hidden = true;
120 return; 119 return;
121 } 120 }
122 121
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 HelpPage: HelpPage 269 HelpPage: HelpPage
271 }; 270 };
272 }); 271 });
273 272
274 /** 273 /**
275 * onload listener to initialize the HelpPage. 274 * onload listener to initialize the HelpPage.
276 */ 275 */
277 window.onload = function() { 276 window.onload = function() {
278 help.HelpPage.getInstance().initialize(); 277 help.HelpPage.getInstance().initialize();
279 }; 278 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698