Home | History | Annotate | Download | only in api
      1 // Copyright (c) 2013 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 // Use the <code>chrome.signedInDevices</code> API to get a list of devices
      6 // signed into chrome with the same account as the current profile.
      7 namespace signedInDevices {
      8   enum OS {
      9     win,
     10     mac,
     11     linux,
     12     chrome_os,
     13     android,
     14     ios,
     15     unknown
     16   };
     17 
     18   enum DeviceType {
     19     desktop_or_laptop,
     20     phone,
     21     tablet,
     22     unknown
     23   };
     24 
     25   dictionary DeviceInfo {
     26     // Name of the device. This name is usually set by the user
     27     // when setting up a device.
     28     DOMString name;
     29 
     30     // Unique Id for this device. Note: The id is meaningful only
     31     // in the current device. This id cannot be used to refer to the
     32     // same device from another device or extension.
     33     DOMString id;
     34 
     35     // The OS of the device.
     36     OS os;
     37 
     38     // Device Type.
     39     DeviceType type;
     40 
     41     // Version of chrome running in this device.
     42     DOMString chromeVersion;
     43   };
     44 
     45   callback DeviceInfoCallback = void(DeviceInfo[] devices);
     46 
     47   interface Functions {
     48     // Gets the array of signed in devices, signed into the same account
     49     // as the current profile.
     50     // |isLocal|: If true only return the information for the local device. If
     51     // false or omitted return the list of all devices including the local
     52     // device.
     53     // |callback|: The callback to be invoked with the array of DeviceInfo
     54     // objects.
     55     static void get(optional boolean isLocal, DeviceInfoCallback callback);
     56   };
     57 
     58   interface Events {
     59     // Fired if the DeviceInfo object of any of the signed in devices
     60     // change or a new device is added or a device removed.
     61     // |callback|: The callback to be invoked with the array of DeviceInfo
     62     // objects.
     63     static void onDeviceInfoChange(DeviceInfo[] devices);
     64   };
     65 };