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..4241731fb6847ead61289f1538631770d755d550 100644 |
| --- a/chrome/renderer/resources/offline.js |
| +++ b/chrome/renderer/resources/offline.js |
| @@ -61,7 +61,13 @@ function Runner(outerContainerId, opt_config) { |
| // Images. |
| this.images = {}; |
| this.imagesLoaded = 0; |
| - this.loadImages(); |
| + |
| + if (this.isDisabled()) { |
| + this.setupDisabledRunner(); |
| + console.log(this.isDisabled()); |
|
arv (Not doing code reviews)
2015/03/25 09:36:03
remove debug log?
edwardjung
2015/03/25 11:05:50
Done.
|
| + } else { |
| + this.loadImages(); |
| + } |
| } |
| window['Runner'] = Runner; |
| @@ -135,6 +141,8 @@ Runner.classes = { |
| CONTAINER: 'runner-container', |
| CRASHED: 'crashed', |
| ICON: 'icon-offline', |
| + SNACKBAR: 'snackbar', |
| + SNACKBAR_SHOW: 'snackbar-show', |
| TOUCH_CONTROLLER: 'controller' |
| }; |
| @@ -210,6 +218,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.textContent = loadTimeData.getValue('disabledEasterEgg'); |
| + this.outerContainerEl.appendChild(this.containerEl); |
| + |
| + // Show notification when the activation key is pressed. |
| + document.addEventListener(Runner.events.KEYDOWN, function(e) { |
| + if (Runner.keycodes.JUMP[e.keyCode]) { |
|
arv (Not doing code reviews)
2015/03/25 09:36:03
wrong indentation
edwardjung
2015/03/25 11:05:50
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 |