1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
// 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: 4
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<AppInfo> 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<uint8> 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);
// Requests information about task.
[MinVersion=3] GetTaskInfo(int32 task_id) => (string package_name,
string activity);
};
|