OLD | NEW |
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 <include src="more_info_overlay.js"> | 6 <include src="more_info_overlay.js"> |
7 | 7 |
8 cr.define('help', function() { | 8 cr.define('help', function() { |
9 var localStrings = new LocalStrings(); | 9 var localStrings = new LocalStrings(); |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 $('product-license').innerHTML = localStrings.getString('productLicense'); | 31 $('product-license').innerHTML = localStrings.getString('productLicense'); |
32 | 32 |
33 var productTOS = $('product-tos'); | 33 var productTOS = $('product-tos'); |
34 if (productTOS) | 34 if (productTOS) |
35 productTOS.innerHTML = localStrings.getString('productTOS'); | 35 productTOS.innerHTML = localStrings.getString('productTOS'); |
36 | 36 |
37 var moreInfoOverlay = help.MoreInfoOverlay.getInstance(); | 37 var moreInfoOverlay = help.MoreInfoOverlay.getInstance(); |
38 moreInfoOverlay.initializePage(); | 38 moreInfoOverlay.initializePage(); |
39 | 39 |
40 var self = this; | 40 $('get-help').onclick = chrome.send.bind(chrome, 'openHelpPage'); |
41 var moreInfo = $('more-info'); | 41 $('report-issue').onclick = |
42 if (moreInfo) { | 42 chrome.send.bind(chrome, 'openFeedbackDialog'); |
43 moreInfo.onclick = function() { | |
44 self.showOverlay_($('more-info-overlay')); | |
45 }; | |
46 } | |
47 | 43 |
48 var reportIssue = $('report-issue'); | 44 this.maybeSetOnClick_($('more-info'), |
49 if (reportIssue) | 45 this.showOverlay_.bind(this, $('more-info-overlay'))); |
50 reportIssue.onclick = this.reportAnIssue_.bind(this); | |
51 | 46 |
52 var promote = $('promote'); | 47 this.maybeSetOnClick_($('promote'), |
53 if (promote) { | 48 chrome.send.bind(chrome, 'promoteUpdater')); |
54 promote.onclick = function() { | 49 this.maybeSetOnClick_($('relaunch'), |
55 chrome.send('promoteUpdater'); | 50 chrome.send.bind(chrome, 'relaunchNow')); |
56 }; | |
57 } | |
58 | |
59 var relaunch = $('relaunch'); | |
60 if (relaunch) { | |
61 relaunch.onclick = function() { | |
62 chrome.send('relaunchNow'); | |
63 }; | |
64 } | |
65 | 51 |
66 // Attempt to update. | 52 // Attempt to update. |
67 chrome.send('onPageLoaded'); | 53 chrome.send('onPageLoaded'); |
68 }, | 54 }, |
69 | 55 |
70 /** | 56 /** |
| 57 * Assigns |method| to the onclick property of |el| if |el| exists. |
71 * @private | 58 * @private |
72 */ | 59 */ |
73 reportAnIssue_: function() { | 60 maybeSetOnClick_: function(el, method) { |
74 chrome.send('openFeedbackDialog'); | 61 if (el) |
| 62 el.onclick = method; |
75 }, | 63 }, |
76 | 64 |
77 /** | 65 /** |
78 * @private | 66 * @private |
79 */ | 67 */ |
80 setUpdateImage_: function(state) { | 68 setUpdateImage_: function(state) { |
81 $('update-status-icon').className = 'update-icon ' + state; | 69 $('update-status-icon').className = 'update-icon ' + state; |
82 }, | 70 }, |
83 | 71 |
84 /** | 72 /** |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 | 230 |
243 // Export | 231 // Export |
244 return { | 232 return { |
245 HelpPage: HelpPage | 233 HelpPage: HelpPage |
246 }; | 234 }; |
247 }); | 235 }); |
248 | 236 |
249 window.onload = function() { | 237 window.onload = function() { |
250 help.HelpPage.getInstance().initialize(); | 238 help.HelpPage.getInstance().initialize(); |
251 }; | 239 }; |
OLD | NEW |