| Index: chrome/common/extensions/docs/examples/api/screenlock/weblocker/bg.js
|
| diff --git a/chrome/common/extensions/docs/examples/api/screenlock/weblocker/bg.js b/chrome/common/extensions/docs/examples/api/screenlock/weblocker/bg.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..0d73f5537393f05943bffdd060a6e2a4e72b2fca
|
| --- /dev/null
|
| +++ b/chrome/common/extensions/docs/examples/api/screenlock/weblocker/bg.js
|
| @@ -0,0 +1,22 @@
|
| +function webunlock() {
|
| + var xhr = new XMLHttpRequest();
|
| + xhr.onreadystatechange = function() {
|
| + if (xhr.readyState != 4) return;
|
| + window.setTimeout(webunlock, 2000);
|
| + if (xhr.status != 200) return;
|
| + var should_be_locked = (xhr.responseText == 'LOCK');
|
| + chrome.screenlockPrivate.getLocked(function(is_locked) {
|
| + console.log('should=' + should_be_locked + ' is=' + is_locked);
|
| + if (is_locked != should_be_locked) {
|
| + chrome.screenlockPrivate.setLocked(should_be_locked);
|
| + }
|
| + });
|
| + }
|
| + xhr.open('get', 'http://scrap.mtv.corp.google.com:54329/value', true);
|
| + xhr.send();
|
| +}
|
| +webunlock();
|
| +
|
| +chrome.screenlockPrivate.onChange.addListener(function(locked) {
|
| + console.log('The screen is now ' + (locked ? '' : 'un') + 'locked.');
|
| +});
|
|
|