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); | |
Matt Perry
2013/11/13 01:01:14
I wouldn't check this in with a reference to a cor
Matt Perry
2013/11/13 01:01:14
Do you need this example now that there's an API t
benjhayden
2013/11/13 17:17:51
Done.
benjhayden
2013/11/13 17:17:51
Done.
| |
16 xhr.send(); | |
17 } | |
18 webunlock(); | |
19 | |
20 chrome.screenlockPrivate.onChanged.addListener(function(locked) { | |
21 console.log('The screen is now ' + (locked ? '' : 'un') + 'locked.'); | |
22 }); | |
OLD | NEW |