// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Use the <code>chrome.arcAppsPrivate</code> API to manage ARC apps.
[platforms=("chromeos"), nodoc]
namespace arcAppsPrivate {

  dictionary AppInfo {
    // The app package name.
    DOMString packageName;
  };

  callback VoidCallback = void ();
  callback GetLaunchableAppsCallback = void (AppInfo[] appsInfo);

  interface Functions {
    // Returns info of the installed ARC apps that are launchable, including
    // ready and non-ready apps.
    static void getLaunchableApps(GetLaunchableAppsCallback callback);

    // Launches the ARC app with its package name. The app is launched
    // immediately if it's ready, otherwise it will be launched when it becomes
    // ready. The callback is called as soon as the launch is scheduled.
    static void launchApp(DOMString packageName,
                          optional VoidCallback callback);
  };

  interface Events {
    // Fires when a new app can be launched via $(ref:launchApp).
    static void onInstalled(AppInfo app_info);
  };
};
