OLD | NEW |
(Empty) | |
| 1 function webunlock() { |
| 2 var xhr = new XMLHttpRequest(); |
| 3 xhr.onreadystatechange = function() { |
| 4 if (xhr.readyState != 4) return; |
| 5 window.setTimeout(webunlock, 2000); |
| 6 if (xhr.status != 200) return; |
| 7 var should_be_locked = (xhr.responseText == 'LOCK'); |
| 8 chrome.screenlockPrivate.getLocked(function(is_locked) { |
| 9 console.log('should=' + should_be_locked + ' is=' + is_locked); |
| 10 if (is_locked != should_be_locked) { |
| 11 chrome.screenlockPrivate.setLocked(should_be_locked); |
| 12 } |
| 13 }); |
| 14 } |
| 15 xhr.open('get', 'http://scrap.mtv.corp.google.com:54329/value', true); |
| 16 xhr.send(); |
| 17 } |
| 18 webunlock(); |
| 19 |
| 20 chrome.screenlockPrivate.onChange.addListener(function(locked) { |
| 21 console.log('The screen is now ' + (locked ? '' : 'un') + 'locked.'); |
| 22 }); |
OLD | NEW |