| 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 update() { | 8 function update() { |
| 9 chrome.send('getAllRegistrations'); | 9 chrome.send('getAllRegistrations'); |
| 10 } | 10 } |
| 11 | 11 |
| 12 function progressNodeFor(link) { | 12 function progressNodeFor(link) { |
| 13 return link.parentNode.querySelector('.operation-status'); | 13 return link.parentNode.querySelector('.operation-status'); |
| 14 } | 14 } |
| 15 | 15 |
| 16 // All commands are sent with the partition_path and scope, and | 16 // All commands are sent with the partition_path and scope, and |
| 17 // are all completed with 'onOperationComplete'. | 17 // are all completed with 'onOperationComplete'. |
| 18 var COMMANDS = ['unregister', 'start', 'stop', 'sync', 'inspect']; | 18 var COMMANDS = ['unregister', 'start', 'stop', 'sync', 'push', 'inspect']; |
| 19 function commandHandler(command) { | 19 function commandHandler(command) { |
| 20 return function(event) { | 20 return function(event) { |
| 21 var link = event.target; | 21 var link = event.target; |
| 22 progressNodeFor(link).style.display = 'inline'; | 22 progressNodeFor(link).style.display = 'inline'; |
| 23 chrome.send(command, [link.partition_path, | 23 chrome.send(command, [link.partition_path, |
| 24 link.scope]); | 24 link.scope]); |
| 25 return false; | 25 return false; |
| 26 }; | 26 }; |
| 27 }; | 27 }; |
| 28 | 28 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 onWorkerStopped: onWorkerStopped, | 171 onWorkerStopped: onWorkerStopped, |
| 172 onErrorReported: onErrorReported, | 172 onErrorReported: onErrorReported, |
| 173 onConsoleMessageReported: onConsoleMessageReported, | 173 onConsoleMessageReported: onConsoleMessageReported, |
| 174 onVersionStateChanged: onVersionStateChanged, | 174 onVersionStateChanged: onVersionStateChanged, |
| 175 onRegistrationStored: onRegistrationStored, | 175 onRegistrationStored: onRegistrationStored, |
| 176 onRegistrationDeleted: onRegistrationDeleted, | 176 onRegistrationDeleted: onRegistrationDeleted, |
| 177 }; | 177 }; |
| 178 }); | 178 }); |
| 179 | 179 |
| 180 document.addEventListener('DOMContentLoaded', serviceworker.update); | 180 document.addEventListener('DOMContentLoaded', serviceworker.update); |
| OLD | NEW |