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

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

Issue 2060623002: Implementation of Device End of Life Notification (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Modify browsertest Created 4 years, 6 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
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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 } 299 }
300 300
301 if (status == 'checking') 301 if (status == 'checking')
302 this.haveNeverCheckedForUpdates_ = false; 302 this.haveNeverCheckedForUpdates_ = false;
303 this.message_ = message; 303 this.message_ = message;
304 304
305 this.updateUI_(); 305 this.updateUI_();
306 }, 306 },
307 307
308 /** 308 /**
309 * @param {string} eol_status: The status of the eol.
310 * @param {string} message: eol message to display.
311 * @private
312 */
313 updateEolMessage_: function(eol_status, message) {
xiyuan 2016/06/16 22:41:28 JS uses a different style than C++ eol_status ->
xiaoyinh(OOO Sep 11-29) 2016/06/17 04:07:35 Done.
314 this.status_ = eol_status;
315 this.message_ = message;
xiyuan 2016/06/16 22:41:28 Can we introduce new properties to hold the eol_st
xiaoyinh(OOO Sep 11-29) 2016/06/17 04:07:35 Done.
316
317 this.updateUI_();
318 },
319
320
321
xiyuan 2016/06/16 22:41:28 nuke two and keep only one empty line.
xiaoyinh(OOO Sep 11-29) 2016/06/17 04:07:35 Done.
322 /**
309 * Updates UI elements on the page according to current state. 323 * Updates UI elements on the page according to current state.
310 * @private 324 * @private
311 */ 325 */
312 updateUI_: function() { 326 updateUI_: function() {
313 var status = this.status_; 327 var status = this.status_;
314 var message = this.message_; 328 var message = this.message_;
315 var channel = this.targetChannel_; 329 var channel = this.targetChannel_;
316 330
317 if (this.channelList_.indexOf(channel) >= 0) { 331 if (this.channelList_.indexOf(channel) >= 0) {
318 $('current-channel').textContent = loadTimeData.getStringF( 332 $('current-channel').textContent = loadTimeData.getStringF(
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 loadTimeData.getString('upToDate'); 377 loadTimeData.getString('upToDate');
364 } else if (status == 'failed') { 378 } else if (status == 'failed') {
365 this.setUpdateImage_('failed'); 379 this.setUpdateImage_('failed');
366 $('update-status-message').innerHTML = message; 380 $('update-status-message').innerHTML = message;
367 } else if (status == 'disabled_by_admin') { 381 } else if (status == 'disabled_by_admin') {
368 // This is the general behavior for non-chromeos. 382 // This is the general behavior for non-chromeos.
369 this.setUpdateImage_('disabled-by-admin'); 383 this.setUpdateImage_('disabled-by-admin');
370 $('update-status-message').innerHTML = message; 384 $('update-status-message').innerHTML = message;
371 } 385 }
372 386
387 // Show EndofLife Strings if applicable
388 if (status == 'device_supported') {
389 $('eol-message').hidden = true;
390 } else if (status == 'device_endoflife') {
391 $('eol-message').innerHTML = message;
392 $('eol-message').hidden = false;
393 }
394
395
373 if (cr.isChromeOS) { 396 if (cr.isChromeOS) {
374 $('change-channel').disabled = !this.canChangeChannel_ || 397 $('change-channel').disabled = !this.canChangeChannel_ ||
375 status == 'nearly_updated'; 398 status == 'nearly_updated';
376 $('channel-change-disallowed-icon').hidden = this.canChangeChannel_; 399 $('channel-change-disallowed-icon').hidden = this.canChangeChannel_;
377 } 400 }
378 401
379 // Following invariant must be established at the end of this function: 402 // Following invariant must be established at the end of this function:
380 // { ~$('relaunch_and_powerwash').hidden -> $('relaunch').hidden } 403 // { ~$('relaunch_and_powerwash').hidden -> $('relaunch').hidden }
381 var relaunchAndPowerwashHidden = true; 404 var relaunchAndPowerwashHidden = true;
382 if ($('relaunch-and-powerwash')) { 405 if ($('relaunch-and-powerwash')) {
383 // It's allowed to do powerwash only for customer devices, 406 // It's allowed to do powerwash only for customer devices,
384 // when user explicitly decides to update to a more stable 407 // when user explicitly decides to update to a more stable
385 // channel. 408 // channel.
386 relaunchAndPowerwashHidden = 409 relaunchAndPowerwashHidden =
387 !this.targetChannelIsMoreStable_() || status != 'nearly_updated'; 410 !this.targetChannelIsMoreStable_() || status != 'nearly_updated';
388 $('relaunch-and-powerwash').hidden = relaunchAndPowerwashHidden; 411 $('relaunch-and-powerwash').hidden = relaunchAndPowerwashHidden;
389 } 412 }
390 413
391 if (cr.isChromeOS) { 414 if (cr.isChromeOS) {
392 // Re-enable the update button if we are in a stale 'updated' status or 415 // Re-enable the update button if we are in a stale 'updated' status or
393 // update has failed, and disable it if there's an update in progress or 416 // update has failed, and disable it if there's an update in progress or
394 // updates are disabled by policy. 417 // updates are disabled by policy.
418 // In addition, Update button will be disabled when device is in eol
419 // status
395 $('request-update').disabled = 420 $('request-update').disabled =
396 !((this.haveNeverCheckedForUpdates_ && status == 'updated') || 421 !((this.haveNeverCheckedForUpdates_ && status == 'updated') ||
397 status == 'failed'); 422 status == 'failed') || (status == 'device_endoflife');
398 // If updates are disabled by policy, unhide the 423 // If updates are disabled by policy, unhide the
399 // controlled-feature-icon. 424 // controlled-feature-icon.
400 $('controlled-feature-icon').hidden = (status != 'disabled_by_admin'); 425 $('controlled-feature-icon').hidden = (status != 'disabled_by_admin');
401 // If updates are no longer disabled by policy and the tooltip bubble 426 // If updates are no longer disabled by policy and the tooltip bubble
402 // is present, we hide it. 427 // is present, we hide it.
403 if (status != 'disabled_by_admin' && $('controlled-feature-bubble')) 428 if (status != 'disabled_by_admin' && $('controlled-feature-bubble'))
404 $('controlled-feature-bubble').hide(); 429 $('controlled-feature-bubble').hide();
405 } 430 }
406 431
407 var container = $('update-status-container'); 432 var container = $('update-status-container');
408 if (container) { 433 if (container) {
409 container.hidden = status == 'disabled'; 434 container.hidden = status == 'disabled';
410 $('relaunch').hidden = 435 $('relaunch').hidden =
411 (status != 'nearly_updated') || !relaunchAndPowerwashHidden; 436 (status != 'nearly_updated') || !relaunchAndPowerwashHidden;
412 437
413 if (cr.isChromeOS) { 438 if (cr.isChromeOS) {
414 // Assume the "updated" status is stale if we haven't checked yet. 439 // Assume the "updated" status is stale if we haven't checked yet.
415 if (status == 'updated' && this.haveNeverCheckedForUpdates_ || 440 if (status == 'updated' && this.haveNeverCheckedForUpdates_ ||
416 status == 'disabled_by_admin') { 441 status == 'disabled_by_admin' || status == 'device_endoflife') {
417 container.hidden = true; 442 container.hidden = true;
418 } 443 }
419 444
420 // Hide the request update button if auto-updating is disabled or 445 // Hide the request update button if auto-updating is disabled or
421 // a relaunch button is showing. 446 // a relaunch button is showing.
422 $('request-update').hidden = status == 'disabled' || 447 $('request-update').hidden = status == 'disabled' ||
423 !$('relaunch').hidden || !relaunchAndPowerwashHidden; 448 !$('relaunch').hidden || !relaunchAndPowerwashHidden;
424 } 449 }
425 450
426 if (!cr.isMac) 451 if (!cr.isMac)
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 HelpPage.setRegulatoryLabelPath = function(path) { 750 HelpPage.setRegulatoryLabelPath = function(path) {
726 assert(cr.isChromeOS); 751 assert(cr.isChromeOS);
727 HelpPage.getInstance().setRegulatoryLabelPath_(path); 752 HelpPage.getInstance().setRegulatoryLabelPath_(path);
728 }; 753 };
729 754
730 HelpPage.setRegulatoryLabelText = function(text) { 755 HelpPage.setRegulatoryLabelText = function(text) {
731 assert(cr.isChromeOS); 756 assert(cr.isChromeOS);
732 HelpPage.getInstance().setRegulatoryLabelText_(text); 757 HelpPage.getInstance().setRegulatoryLabelText_(text);
733 }; 758 };
734 759
760 HelpPage.updateEolMessage = function(eol_status, message) {
761 assert(cr.isChromeOS);
762 HelpPage.getInstance().updateEolMessage_(eol_status, message);
763 };
764
735 // Export 765 // Export
736 return { 766 return {
737 HelpPage: HelpPage 767 HelpPage: HelpPage
738 }; 768 };
739 }); 769 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698