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

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: hook EolNotification in UserSessionManager::FinalizePrepareProfile 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 * @private 57 * @private
58 */ 58 */
59 canChangeChannel_: false, 59 canChangeChannel_: false,
60 60
61 /** 61 /**
62 * True if we have never checked for available updates. 62 * True if we have never checked for available updates.
63 * @private 63 * @private
64 */ 64 */
65 haveNeverCheckedForUpdates_: true, 65 haveNeverCheckedForUpdates_: true,
66 66
67 /**
68 * Last EndofLife status received from the version updater.
69 * @private
70 */
71 eolstatus_: null,
xiyuan 2016/06/17 20:02:09 nit: eolStatus_, JS uses camel case with the first
xiaoyinh(OOO Sep 11-29) 2016/06/17 22:36:53 Done.
72
73 /**
74 * Last EndofLife message received from the version updater.
75 * @private
76 */
77 eolmessage_: null,
xiyuan 2016/06/17 20:02:09 nit: eolMessage_
xiaoyinh(OOO Sep 11-29) 2016/06/17 22:36:53 Done.
78
67 /** @override */ 79 /** @override */
68 initializePage: function() { 80 initializePage: function() {
69 Page.prototype.initializePage.call(this); 81 Page.prototype.initializePage.call(this);
70 82
71 $('product-license').innerHTML = loadTimeData.getString('productLicense'); 83 $('product-license').innerHTML = loadTimeData.getString('productLicense');
72 if (cr.isChromeOS) { 84 if (cr.isChromeOS) {
73 $('product-os-license').innerHTML = 85 $('product-os-license').innerHTML =
74 loadTimeData.getString('productOsLicense'); 86 loadTimeData.getString('productOsLicense');
75 } 87 }
76 88
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 } 311 }
300 312
301 if (status == 'checking') 313 if (status == 'checking')
302 this.haveNeverCheckedForUpdates_ = false; 314 this.haveNeverCheckedForUpdates_ = false;
303 this.message_ = message; 315 this.message_ = message;
304 316
305 this.updateUI_(); 317 this.updateUI_();
306 }, 318 },
307 319
308 /** 320 /**
321 * @param {string} eolstatus: The EndofLife status of the device.
322 * @param {string} eolmessage: The EndofLife message to display.
323 * @private
324 */
325 updateEolMessage_: function(eolstatus, eolmessage) {
xiyuan 2016/06/17 20:02:09 nit: eolStatus, eolMessage
xiaoyinh(OOO Sep 11-29) 2016/06/17 22:36:53 Done.
326 this.eolstatus_ = eolstatus;
327 this.eolmessage_ = eolmessage;
328
329 this.updateUI_();
330 },
331
332 /**
309 * Updates UI elements on the page according to current state. 333 * Updates UI elements on the page according to current state.
310 * @private 334 * @private
311 */ 335 */
312 updateUI_: function() { 336 updateUI_: function() {
313 var status = this.status_; 337 var status = this.status_;
314 var message = this.message_; 338 var message = this.message_;
315 var channel = this.targetChannel_; 339 var channel = this.targetChannel_;
340 var eolstatus = this.eolstatus_;
341 var eolmessage = this.eolmessage_;
xiyuan 2016/06/17 20:02:09 ditto
xiaoyinh(OOO Sep 11-29) 2016/06/17 22:36:53 Done.
316 342
317 if (this.channelList_.indexOf(channel) >= 0) { 343 if (this.channelList_.indexOf(channel) >= 0) {
318 $('current-channel').textContent = loadTimeData.getStringF( 344 $('current-channel').textContent = loadTimeData.getStringF(
319 'currentChannel', this.channelTable_[channel].label); 345 'currentChannel', this.channelTable_[channel].label);
320 this.updateChannelChangePageContainerVisibility_(); 346 this.updateChannelChangePageContainerVisibility_();
321 if (cr.isChromeOS) 347 if (cr.isChromeOS)
322 $('dev-channel-disclaimer').hidden = (channel != 'dev-channel'); 348 $('dev-channel-disclaimer').hidden = (channel != 'dev-channel');
323 } 349 }
324 350
325 if (status == null) 351 if (status == null)
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 loadTimeData.getString('upToDate'); 389 loadTimeData.getString('upToDate');
364 } else if (status == 'failed') { 390 } else if (status == 'failed') {
365 this.setUpdateImage_('failed'); 391 this.setUpdateImage_('failed');
366 $('update-status-message').innerHTML = message; 392 $('update-status-message').innerHTML = message;
367 } else if (status == 'disabled_by_admin') { 393 } else if (status == 'disabled_by_admin') {
368 // This is the general behavior for non-chromeos. 394 // This is the general behavior for non-chromeos.
369 this.setUpdateImage_('disabled-by-admin'); 395 this.setUpdateImage_('disabled-by-admin');
370 $('update-status-message').innerHTML = message; 396 $('update-status-message').innerHTML = message;
371 } 397 }
372 398
399 // Show EndofLife Strings if applicable
400 if (eolstatus == 'device_supported') {
401 $('eol-message').hidden = true;
402 } else if (eolstatus == 'device_endoflife') {
403 $('eol-message').innerHTML = eolmessage;
404 $('eol-message').hidden = false;
405 }
406
407
373 if (cr.isChromeOS) { 408 if (cr.isChromeOS) {
374 $('change-channel').disabled = !this.canChangeChannel_ || 409 $('change-channel').disabled = !this.canChangeChannel_ ||
375 status == 'nearly_updated'; 410 status == 'nearly_updated';
376 $('channel-change-disallowed-icon').hidden = this.canChangeChannel_; 411 $('channel-change-disallowed-icon').hidden = this.canChangeChannel_;
377 } 412 }
378 413
379 // Following invariant must be established at the end of this function: 414 // Following invariant must be established at the end of this function:
380 // { ~$('relaunch_and_powerwash').hidden -> $('relaunch').hidden } 415 // { ~$('relaunch_and_powerwash').hidden -> $('relaunch').hidden }
381 var relaunchAndPowerwashHidden = true; 416 var relaunchAndPowerwashHidden = true;
382 if ($('relaunch-and-powerwash')) { 417 if ($('relaunch-and-powerwash')) {
383 // It's allowed to do powerwash only for customer devices, 418 // It's allowed to do powerwash only for customer devices,
384 // when user explicitly decides to update to a more stable 419 // when user explicitly decides to update to a more stable
385 // channel. 420 // channel.
386 relaunchAndPowerwashHidden = 421 relaunchAndPowerwashHidden =
387 !this.targetChannelIsMoreStable_() || status != 'nearly_updated'; 422 !this.targetChannelIsMoreStable_() || status != 'nearly_updated';
388 $('relaunch-and-powerwash').hidden = relaunchAndPowerwashHidden; 423 $('relaunch-and-powerwash').hidden = relaunchAndPowerwashHidden;
389 } 424 }
390 425
391 if (cr.isChromeOS) { 426 if (cr.isChromeOS) {
392 // Re-enable the update button if we are in a stale 'updated' status or 427 // 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 428 // update has failed, and disable it if there's an update in progress or
394 // updates are disabled by policy. 429 // updates are disabled by policy.
430 // In addition, Update button will be disabled when device is in eol
431 // status
395 $('request-update').disabled = 432 $('request-update').disabled =
396 !((this.haveNeverCheckedForUpdates_ && status == 'updated') || 433 !((this.haveNeverCheckedForUpdates_ && status == 'updated') ||
397 status == 'failed'); 434 status == 'failed') || (eolstatus == 'device_endoflife');
398 // If updates are disabled by policy, unhide the 435 // If updates are disabled by policy, unhide the
399 // controlled-feature-icon. 436 // controlled-feature-icon.
400 $('controlled-feature-icon').hidden = (status != 'disabled_by_admin'); 437 $('controlled-feature-icon').hidden = (status != 'disabled_by_admin');
401 // If updates are no longer disabled by policy and the tooltip bubble 438 // If updates are no longer disabled by policy and the tooltip bubble
402 // is present, we hide it. 439 // is present, we hide it.
403 if (status != 'disabled_by_admin' && $('controlled-feature-bubble')) 440 if (status != 'disabled_by_admin' && $('controlled-feature-bubble'))
404 $('controlled-feature-bubble').hide(); 441 $('controlled-feature-bubble').hide();
405 } 442 }
406 443
407 var container = $('update-status-container'); 444 var container = $('update-status-container');
408 if (container) { 445 if (container) {
409 container.hidden = status == 'disabled'; 446 container.hidden = status == 'disabled';
410 $('relaunch').hidden = 447 $('relaunch').hidden =
411 (status != 'nearly_updated') || !relaunchAndPowerwashHidden; 448 (status != 'nearly_updated') || !relaunchAndPowerwashHidden;
412 449
413 if (cr.isChromeOS) { 450 if (cr.isChromeOS) {
414 // Assume the "updated" status is stale if we haven't checked yet. 451 // Assume the "updated" status is stale if we haven't checked yet.
415 if (status == 'updated' && this.haveNeverCheckedForUpdates_ || 452 if (status == 'updated' && this.haveNeverCheckedForUpdates_ ||
416 status == 'disabled_by_admin') { 453 status == 'disabled_by_admin' ||
454 eolstatus == 'device_endoflife') {
417 container.hidden = true; 455 container.hidden = true;
418 } 456 }
419 457
420 // Hide the request update button if auto-updating is disabled or 458 // Hide the request update button if auto-updating is disabled or
421 // a relaunch button is showing. 459 // a relaunch button is showing.
422 $('request-update').hidden = status == 'disabled' || 460 $('request-update').hidden = status == 'disabled' ||
423 !$('relaunch').hidden || !relaunchAndPowerwashHidden; 461 !$('relaunch').hidden || !relaunchAndPowerwashHidden;
424 } 462 }
425 463
426 if (!cr.isMac) 464 if (!cr.isMac)
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 HelpPage.setRegulatoryLabelPath = function(path) { 763 HelpPage.setRegulatoryLabelPath = function(path) {
726 assert(cr.isChromeOS); 764 assert(cr.isChromeOS);
727 HelpPage.getInstance().setRegulatoryLabelPath_(path); 765 HelpPage.getInstance().setRegulatoryLabelPath_(path);
728 }; 766 };
729 767
730 HelpPage.setRegulatoryLabelText = function(text) { 768 HelpPage.setRegulatoryLabelText = function(text) {
731 assert(cr.isChromeOS); 769 assert(cr.isChromeOS);
732 HelpPage.getInstance().setRegulatoryLabelText_(text); 770 HelpPage.getInstance().setRegulatoryLabelText_(text);
733 }; 771 };
734 772
773 HelpPage.updateEolMessage = function(eolstatus, eolmessage) {
774 assert(cr.isChromeOS);
775 HelpPage.getInstance().updateEolMessage_(eolstatus, eolmessage);
776 };
777
735 // Export 778 // Export
736 return { 779 return {
737 HelpPage: HelpPage 780 HelpPage: HelpPage
738 }; 781 };
739 }); 782 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698