// Copyright 2015 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>appview</code> tag to embed other Chrome Apps within your
// Chrome App. (see <a href=#usage>Usage</a>).
[documentation_title="<appview> Tag",
  documentation_namespace="<appview>",
  documented_in="tags/appview"]
namespace appviewTag {
  // This object specifies details and operations to perform on the embedding
  // request. The app to be embedded can make a decision on whether or not to
  // allow the embedding and what to embed based on the embedder making the
  // request.
  dictionary EmbedRequest {
    // The ID of the app that sent the embedding request.
    DOMString embedderId;

    // Optional developer specified data that the app to be embedded can use
    // when making an embedding decision.
    object data;

    // Allows the embedding request.
    //
    // |url| : Specifies the content to be embedded.
    static void allow(DOMString url);

    // Prevents the embedding request.
    static void deny();
  };

  // An optional function that's called after the embedding request is
  // completed.
  //
  // |success| : True if the embedding request succeded.
  callback EmbeddingCallback = void (boolean success);

  interface Functions {
    // Requests another app to be embedded.
    //
    // |app| : The extension id of the app to be embedded.
    // |data| : Optional developer specified data that the app to be embedded
    //   can use when making an embedding decision.
    // |callback| : An optional function that's called after the embedding
    //   request is completed.
    static void connect(DOMString app, optional any data,
      optional EmbeddingCallback callback);
  };
};
