Chromium Code Reviews| Index: chrome/renderer/resources/offline.js |
| diff --git a/chrome/renderer/resources/offline.js b/chrome/renderer/resources/offline.js |
| index 75404cc9e2618a33a09e5db79240f20345c2374d..ff70470bed817ea706eb653305eaba3c67299936 100644 |
| --- a/chrome/renderer/resources/offline.js |
| +++ b/chrome/renderer/resources/offline.js |
| @@ -61,7 +61,12 @@ function Runner(outerContainerId, opt_config) { |
| // Images. |
| this.images = {}; |
| this.imagesLoaded = 0; |
| - this.loadImages(); |
| + |
| + if (this.isDisabled()) { |
| + this.setupDisabledRunner(); |
| + } else { |
| + this.loadImages(); |
| + } |
| } |
| window['Runner'] = Runner; |
| @@ -135,6 +140,8 @@ Runner.classes = { |
| CONTAINER: 'runner-container', |
| CRASHED: 'crashed', |
| ICON: 'icon-offline', |
| + SNACKBAR: 'snackbar', |
| + SNACKBAR_SHOW: 'snackbar-show', |
| TOUCH_CONTROLLER: 'controller' |
| }; |
| @@ -210,6 +217,32 @@ Runner.events = { |
| Runner.prototype = { |
| /** |
| + * Whether the easter egg has been disabled. CrOS enterprise enrolled devices. |
| + * @return {boolean} |
| + */ |
| + isDisabled: function() { |
| + return loadTimeData && loadTimeData.valueExists('disabledEasterEgg'); |
| + }, |
| + |
| + /** |
| + * For disabled instances, set up a snackbar with the disabled message. |
| + */ |
| + setupDisabledRunner: function() { |
| + this.containerEl = document.createElement('div'); |
| + this.containerEl.className = Runner.classes.SNACKBAR; |
| + this.containerEl.innerText = loadTimeData.getValue('disabledEasterEgg'); |
|
arv (Not doing code reviews)
2015/03/24 16:46:59
don't use innerText. You can use textContent here.
edwardjung
2015/03/24 17:42:36
Done.
Need to shake off this habit.
|
| + this.outerContainerEl.appendChild(this.containerEl); |
| + |
| + // Show notification when the activation key is pressed. |
| + document.addEventListener(Runner.events.KEYDOWN, function(e) { |
| + if (Runner.keycodes.JUMP[String(e.keyCode)]) { |
|
arv (Not doing code reviews)
2015/03/24 16:46:59
No need for String() here
edwardjung
2015/03/24 17:42:36
Done.
|
| + this.containerEl.classList.add(Runner.classes.SNACKBAR_SHOW); |
| + document.querySelector('.icon').classList.add('icon-disabled'); |
| + } |
| + }.bind(this)); |
| + }, |
| + |
| + /** |
| * Setting individual settings for debugging. |
| * @param {string} setting |
| * @param {*} value |