// 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. // // Next MinVersion: 3 module arc; // Duplicates ui::ScaleFactor enum in order to be accessible on Android side. enum ScaleFactor { SCALE_FACTOR_NONE = 0, SCALE_FACTOR_100P, SCALE_FACTOR_125P, SCALE_FACTOR_133P, SCALE_FACTOR_140P, SCALE_FACTOR_150P, SCALE_FACTOR_180P, SCALE_FACTOR_200P, SCALE_FACTOR_250P, SCALE_FACTOR_300P, NUM_SCALE_FACTORS }; // Describes ARC app. struct AppInfo { string name; string package_name; string activity; [MinVersion=2] bool sticky; // true if the app cannot be uninstalled }; // Represents a rectangle to specify screen coordinates. struct ScreenRect { int32 left; int32 top; int32 right; int32 bottom; }; // Next method ID: 4 interface AppHost { // Receives a list of available ARC apps to Chrome. Members of AppInfo must // contain non-empty string. OnAppListRefreshed@0(array apps); // Sends newly added ARC app to Chrome. This message is sent when ARC receives // package added notification. Multiple apps may be added in the one package. [MinVersion=1] OnAppAdded@2(AppInfo app); // Sends removed ARC package to Chrome. |package_name| must contain non-empty // string. This message is sent when ARC receives package removed // notification. Removing one package can potentially remove more than one // app. [MinVersion=1] OnPackageRemoved@3(string package_name); // Receives an icon of required |scale_factor| for specific ARC app. The app // is defined by |package_name| and |activity|. The icon content cannot be // empty and must match to |scale_factor| assuming 48x48 for // SCALE_FACTOR_100P. |scale_factor| is an enum defined at ui/base/layout.h. // |icon_png_data| is a png-encoded image. OnAppIcon@1(string package_name, string activity, ScaleFactor scale_factor, array icon_png_data); }; // TODO(lhchavez): Migrate all request/response messages to Mojo. interface AppInstance { Init(AppHost host_ptr); // Sends a request to ARC to launch an ARC app defined by |package_name| and // |activity|, which cannot be empty. |dimension_on_screen| can be null to // indicate to use the entire screen. LaunchApp(string package_name, string activity, [MinVersion=1] ScreenRect? dimension_on_screen); // Sends a request to ARC to refresh a list of ARC apps. // OnRefreshAppsList is expected in response to this message. However, // response may not be sent if ARC is not ready yet (boot completed event is // not received). RefreshAppList(); // Sends a request to ARC for the ARC app icon of a required scale factor. // Scale factor is an enum defined at ui/base/layout.h. App is defined by // |package_name| and |activity|, which cannot be empty. RequestAppIcon(string package_name, string activity, ScaleFactor scale_factor); // Query if a given resolution can be handled by the application. Returns true // if it can. [MinVersion=1] CanHandleResolution(string package_name, string activity, ScreenRect dimension) => (bool can_handle); // Sends a request to ARC to uninstall the given package. Error (if ever // happens) is ignored, and uninstall option should appear in the UI. [MinVersion=2] UninstallPackage(string package_name); };