| // 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: 16 |
| |
| module arc.mojom; |
| |
| import "scale_factor.mojom"; |
| import "screen_rect.mojom"; |
| |
| // Describes OrientationLock request. |
| // Note: ChromeOS currently assumes the internal panel is always landscape. |
| // All rotation angles mentioned here are measured clockwise. |
| [Extensible] |
| enum OrientationLock { |
| NONE = 0, |
| // Rotated 90 or 270 deg. |
| PORTRAIT = 1, |
| // Rotated 0 or 180 deg. |
| LANDSCAPE = 2, |
| // Keep the current orientation. |
| CURRENT = 3, |
| // Rotated 90 deg. |
| PORTRAIT_PRIMARY = 4, |
| // Rotated 0 deg. |
| LANDSCAPE_PRIMARY = 5, |
| // Rotated 270 deg. |
| PORTRAIT_SECONDARY = 6, |
| // Rotated 180 deg. |
| LANDSCAPE_SECONDARY = 7, |
| }; |
| |
| // Describes ARC app. |
| struct AppInfo { |
| string name; |
| string package_name; |
| string activity; |
| [MinVersion=2] bool sticky; // true if the app cannot be uninstalled |
| [MinVersion=7] bool notifications_enabled; |
| [MinVersion=12] OrientationLock orientation_lock; |
| }; |
| |
| // Describes ARC package. |
| struct ArcPackageInfo { |
| string package_name; |
| int32 package_version; |
| int64 last_backup_android_id; |
| int64 last_backup_time; |
| bool sync; // true if package installation should be synced |
| [MinVersion=11] bool system; // true if package is system package. |
| }; |
| |
| // Describes ARC app shortcut. |
| struct ShortcutInfo { |
| string name; |
| string package_name; |
| string icon_resource_id; |
| string intent_uri; |
| }; |
| |
| // Page for ShowPackageInfoOnPage. |
| [Extensible] |
| enum ShowPackageInfoPage { |
| // The main package info page. |
| MAIN = 0, |
| |
| // Page for managing links assigned to the app. |
| MANAGE_LINKS = 1, |
| }; |
| |
| // Next method ID: 14 |
| interface AppHost { |
| // 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] OnAppAddedDeprecated@2(AppInfo app); |
| |
| // 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<uint8> icon_png_data); |
| |
| // Receives a list of available ARC apps to Chrome. Members of AppInfo must |
| // contain non-empty string. |
| OnAppListRefreshed@0(array<AppInfo> apps); |
| |
| // Notifies that a package has been added. |
| [MinVersion=8] OnPackageAdded@8(ArcPackageInfo arcPackageInfo); |
| |
| // Notifies that a package list of apps has been updated. |
| [MinVersion=14] OnPackageAppListRefreshed@13(string package_name, |
| array<AppInfo> apps); |
| |
| // Receives a list of available ARC packages to Chrome. Members of |
| // PackageInfo must contain non-empty string. |
| [MinVersion=8] OnPackageListRefreshed@9(array<ArcPackageInfo> packages); |
| |
| // Notifies that a package has been modified. |
| [MinVersion=8] OnPackageModified@10(ArcPackageInfo arcPackageInfo); |
| |
| // 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); |
| |
| // Sends information about newly created task |package_name| and |activity| |
| // specifies launch activity and |intent| is initial intent used to start |
| // new task. |
| [MinVersion=4] OnTaskCreated@4(int32 task_id@0, |
| string package_name@1, |
| string activity@2, |
| [MinVersion=13] string? name@3, |
| [MinVersion=15] string? intent@4); |
| |
| // Notifies that task has been destroyed. |
| [MinVersion=4] OnTaskDestroyed@5(int32 task_id); |
| |
| // Notifies that task has been activated. |
| [MinVersion=4] OnTaskSetActive@6(int32 task_id); |
| |
| // Notifies that notifications enabled settings in Android is changed. |
| [MinVersion=7] OnNotificationsEnabledChanged@7(string package_name, |
| bool enabled); |
| |
| // Notifies that an application shortcut needs to be created. |
| [MinVersion=9] OnInstallShortcut@11(ShortcutInfo shortcut); |
| |
| // Notifies that task requested orientation lock. |
| [MinVersion=12] OnTaskOrientationLockRequested@12(int32 task_id, |
| OrientationLock lock); |
| }; |
| |
| // TODO(lhchavez): Migrate all request/response messages to Mojo. |
| // Next method ID: 16 |
| // Deprecated method ID: 9 |
| interface AppInstance { |
| Init@0(AppHost host_ptr); |
| |
| // Query if a given resolution can be handled by the application. Returns true |
| // if it can. |
| [MinVersion=1] CanHandleResolution@4(string package_name, string activity, |
| ScreenRect dimension) => |
| (bool can_handle); |
| |
| // Closes the the given task. |
| [MinVersion=4] CloseTask@8(int32 task_id); |
| |
| // Requests information about task. |
| [MinVersion=3] GetTaskInfo@6(int32 task_id) => (string package_name, |
| string activity); |
| |
| // Sends a request to ARC to install package. |
| [MinVersion=8] InstallPackage@11(ArcPackageInfo arcPackageInfo); |
| |
| // 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@1(string package_name, string activity, |
| [MinVersion=1] ScreenRect? dimension_on_screen); |
| |
| // Sends a reqeust to ARC to launch an intent. The intent is encoded as a |
| // Uri string, see Intent.toUri(). |
| [MinVersion=9] LaunchIntent@12(string intent_uri, |
| 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@2(); |
| |
| // 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@3(string package_name, string activity, |
| ScaleFactor scale_factor); |
| |
| // Sends a request for the ARC shortcut icon of a given resource id and scale |
| // factor. |
| [MinVersion=9] RequestIcon@13(string icon_resource_id, |
| ScaleFactor scale_factor) => |
| (array<uint8> icon_png_data); |
| |
| // Removes cached shortcut icon with the given resource id. |
| [MinVersion=9] RemoveCachedIcon@14(string icon_resource_id); |
| |
| // Activates the given task and move it to foreground. |
| [MinVersion=4] SetTaskActive@7(int32 task_id); |
| |
| // Sends a request to ARC to show package info for given package. |
| [MinVersion=5] ShowPackageInfoDeprecated@9(string package_name, |
| ScreenRect dimension_on_screen); |
| |
| // Sends a request to ARC to show package info for given package on the |
| // specified page. |
| [MinVersion=10] ShowPackageInfoOnPage@15(string package_name, |
| ShowPackageInfoPage page, |
| ScreenRect dimension_on_screen); |
| |
| // Sets notification setting for the package. |
| [MinVersion=6] SetNotificationsEnabled@10(string package_name, bool enabled); |
| |
| // 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@5(string package_name); |
| }; |