summaryrefslogtreecommitdiffstats
path: root/components/arc/common/app.mojom
blob: cc4b2e0df9e2db983ebea48c9d959eef1309af73 (plain)
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
// 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.

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;
  string activity;
};

interface AppHost {
  // Receives a list of available ARC apps to Chrome. Members of AppInfo must
  // contain non-empty string.
  OnAppListRefreshed(array<AppInfo> apps);

  // Receives an icon of required |scale_factor| for specific ARC app. The app
  // is defined by |package| 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(string package, 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| and
  // |activity|, which cannot be empty.
  LaunchApp(string package, string activity);

  // 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 and activity, which cannot be empty.
  RequestAppIcon(string package, string activity, ScaleFactor scale_factor);
};