1// Copyright (c) 2012 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5[ 6 { 7 "namespace": "idle", 8 "description": "Use the <code>chrome.idle</code> API to detect when the machine's idle state changes.", 9 "types": [], 10 "functions": [ 11 { 12 "name": "queryState", 13 "type": "function", 14 "description": "Returns \"locked\" if the system is locked, \"idle\" if the user has not generated any input for a specified number of seconds, or \"active\" otherwise.", 15 "parameters": [ 16 { 17 "name": "detectionIntervalInSeconds", 18 "type": "integer", 19 "minimum": 15, 20 "description": "The system is considered idle if detectionIntervalInSeconds seconds have elapsed since the last user input detected." 21 }, 22 { 23 "name": "callback", 24 "type": "function", 25 "parameters": [ 26 { 27 "name": "newState", 28 "type": "string", 29 "enum": ["active", "idle", "locked"] 30 } 31 ] 32 } 33 ] 34 }, 35 { 36 "name": "setDetectionInterval", 37 "type": "function", 38 "description": "Sets the interval, in seconds, used to determine when the system is in an idle state for onStateChanged events. The default interval is 60 seconds.", 39 "parameters": [ 40 { 41 "name": "intervalInSeconds", 42 "type": "integer", 43 "minimum": 15, 44 "description": "Threshold, in seconds, used to determine when the system is in an idle state." 45 } 46 ] 47 } 48 ], 49 "events": [ 50 { 51 "name": "onStateChanged", 52 "type": "function", 53 "description": "Fired when the system changes to an active, idle or locked state. The event fires with \"locked\" if the screen is locked or the screensaver activates, \"idle\" if the system is unlocked and the user has not generated any input for a specified number of seconds, and \"active\" when the user generates input on an idle system.", 54 "parameters": [ 55 { 56 "name": "newState", 57 "type": "string", 58 "enum": ["active", "idle", "locked"] 59 } 60 ] 61 } 62 ] 63 } 64] 65