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

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

Issue 476983002: About page should not automatically trigger OS updates (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase and formatting 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
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 100
101 var self = this; 101 var self = this;
102 var channelChanger = $('channel-changer'); 102 var channelChanger = $('channel-changer');
103 if (channelChanger) { 103 if (channelChanger) {
104 channelChanger.onchange = function(event) { 104 channelChanger.onchange = function(event) {
105 self.setChannel_(event.target.value, false); 105 self.setChannel_(event.target.value, false);
106 }; 106 };
107 } 107 }
108 108
109 if (cr.isChromeOS) { 109 if (cr.isChromeOS) {
110 // Add event listener for the check for and apply updates button.
111 this.maybeSetOnClick_($('request-update'), function() {
112 self.setUpdateStatus_('checking');
113 $('request-update').disabled = true;
114 chrome.send('requestUpdate');
115 });
116
110 // Add event listener for the close button when shown as an overlay. 117 // Add event listener for the close button when shown as an overlay.
111 if ($('about-done')) { 118 if ($('about-done')) {
112 $('about-done').addEventListener('click', function() { 119 $('about-done').addEventListener('click', function() {
113 PageManager.closeOverlay(); 120 PageManager.closeOverlay();
114 }); 121 });
115 } 122 }
116 123
117 $('change-channel').onclick = function() { 124 $('change-channel').onclick = function() {
118 PageManager.showPageByName('channel-change-page', false); 125 PageManager.showPageByName('channel-change-page', false);
119 }; 126 };
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 var relaunchAndPowerwashHidden = true; 276 var relaunchAndPowerwashHidden = true;
270 if ($('relaunch-and-powerwash')) { 277 if ($('relaunch-and-powerwash')) {
271 // It's allowed to do powerwash only for customer devices, 278 // It's allowed to do powerwash only for customer devices,
272 // when user explicitly decides to update to a more stable 279 // when user explicitly decides to update to a more stable
273 // channel. 280 // channel.
274 relaunchAndPowerwashHidden = 281 relaunchAndPowerwashHidden =
275 !this.powerwashAfterUpdate_ || status != 'nearly_updated'; 282 !this.powerwashAfterUpdate_ || status != 'nearly_updated';
276 $('relaunch-and-powerwash').hidden = relaunchAndPowerwashHidden; 283 $('relaunch-and-powerwash').hidden = relaunchAndPowerwashHidden;
277 } 284 }
278 285
286 if (cr.isChromeOS) {
287 // Only enable the update button if it hasn't been used yet or the
288 // status isn't 'updated'.
289 if (!$('request-update').disabled || status != 'updated') {
290 // Disable the button if an update is already in progress.
291 $('request-update').disabled =
292 ['checking', 'updating', 'nearly_updated'].indexOf(status) > -1;
293 }
294 }
295
279 var container = $('update-status-container'); 296 var container = $('update-status-container');
280 if (container) { 297 if (container) {
281 container.hidden = status == 'disabled'; 298 container.hidden = status == 'disabled';
282 $('relaunch').hidden = 299 $('relaunch').hidden =
283 (status != 'nearly_updated') || !relaunchAndPowerwashHidden; 300 (status != 'nearly_updated') || !relaunchAndPowerwashHidden;
284 301
302 if (cr.isChromeOS) {
303 // Hide the status container if we haven't checked for updates yet.
deymo 2014/08/19 05:09:12 This comment isn't quite accurate. We want to show
michaelpg 2014/08/19 05:20:02 I agree -- this is the desired behavior and what t
304 if (status == 'updated' && !$('request-update').disabled)
305 container.hidden = true;
306
307 // Hide the request update button if auto-updating is disabled or
308 // a relaunch button is showing.
309 $('request-update').hidden = status == 'disabled' ||
310 !$('relaunch').hidden || !relaunchAndPowerwashHidden;
311 }
312
285 if (!cr.isMac) 313 if (!cr.isMac)
286 $('update-percentage').hidden = status != 'updating'; 314 $('update-percentage').hidden = status != 'updating';
287 } 315 }
288 }, 316 },
289 317
290 /** 318 /**
291 * @param {number} progress The percent completion. 319 * @param {number} progress The percent completion.
292 * @private 320 * @private
293 */ 321 */
294 setProgress_: function(progress) { 322 setProgress_: function(progress) {
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 555
528 HelpPage.updateChannelChangePageContainerVisibility = function() { 556 HelpPage.updateChannelChangePageContainerVisibility = function() {
529 HelpPage.getInstance().updateChannelChangePageContainerVisibility_(); 557 HelpPage.getInstance().updateChannelChangePageContainerVisibility_();
530 }; 558 };
531 559
532 // Export 560 // Export
533 return { 561 return {
534 HelpPage: HelpPage 562 HelpPage: HelpPage
535 }; 563 };
536 }); 564 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/help/help_content.html ('k') | chrome/browser/ui/webui/help/help_browsertest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698