OLD | NEW |
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('serviceworker', function() { | 5 cr.define('serviceworker', function() { |
6 'use strict'; | 6 'use strict'; |
7 | 7 |
8 function initialize() { | 8 function initialize() { |
9 if (window.location.hash == "#iframe") { | 9 if (window.location.hash == "#iframe") { |
10 // This page is loaded from chrome://inspect. | 10 // This page is loaded from chrome://inspect. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 inputs[i].hasClickEvent = true; | 46 inputs[i].hasClickEvent = true; |
47 } | 47 } |
48 } | 48 } |
49 } | 49 } |
50 | 50 |
51 function progressNodeFor(link) { | 51 function progressNodeFor(link) { |
52 return link.parentNode.querySelector('.operation-status'); | 52 return link.parentNode.querySelector('.operation-status'); |
53 } | 53 } |
54 | 54 |
55 // All commands are completed with 'onOperationComplete'. | 55 // All commands are completed with 'onOperationComplete'. |
56 var COMMANDS = ['stop', 'sync', 'inspect', 'unregister', 'start']; | 56 var COMMANDS = ['stop', 'sync', 'push', 'inspect', 'unregister', 'start']; |
57 function commandHandler(command) { | 57 function commandHandler(command) { |
58 return function(event) { | 58 return function(event) { |
59 var link = event.target; | 59 var link = event.target; |
60 progressNodeFor(link).style.display = 'inline'; | 60 progressNodeFor(link).style.display = 'inline'; |
61 sendCommand(command, link.cmdArgs, (function(status) { | 61 sendCommand(command, link.cmdArgs, (function(status) { |
62 progressNodeFor(link).style.display = 'none'; | 62 progressNodeFor(link).style.display = 'none'; |
63 }).bind(null, link)); | 63 }).bind(null, link)); |
64 return false; | 64 return false; |
65 }; | 65 }; |
66 }; | 66 }; |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 onWorkerStopped: onWorkerStopped, | 295 onWorkerStopped: onWorkerStopped, |
296 onErrorReported: onErrorReported, | 296 onErrorReported: onErrorReported, |
297 onConsoleMessageReported: onConsoleMessageReported, | 297 onConsoleMessageReported: onConsoleMessageReported, |
298 onVersionStateChanged: onVersionStateChanged, | 298 onVersionStateChanged: onVersionStateChanged, |
299 onRegistrationStored: onRegistrationStored, | 299 onRegistrationStored: onRegistrationStored, |
300 onRegistrationDeleted: onRegistrationDeleted, | 300 onRegistrationDeleted: onRegistrationDeleted, |
301 }; | 301 }; |
302 }); | 302 }); |
303 | 303 |
304 document.addEventListener('DOMContentLoaded', serviceworker.initialize); | 304 document.addEventListener('DOMContentLoaded', serviceworker.initialize); |
OLD | NEW |