blob: 075721d9c72b78ef317f21aac8c7987703eb2aeb [file]
// Copyright 2016 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: 11
module arc.mojom;
import "scale_factor.mojom";
// Describes the type of action to invoke.
enum ActionType {
VIEW,
SEND,
SEND_MULTIPLE,
};
[Extensible]
enum PatternType {
PATTERN_LITERAL,
PATTERN_PREFIX,
PATTERN_SIMPLE_GLOB,
};
struct PatternMatcher {
string pattern;
PatternType type;
};
struct AuthorityEntry {
string host;
int32 port;
};
struct IntentFilter {
array<string> actions;
array<string> categories;
array<string> data_schemes;
[MinVersion=10] array<AuthorityEntry>? data_authorities;
[MinVersion=10] array<PatternMatcher>? data_paths;
[MinVersion=10] array<PatternMatcher>? deprecated_data_scheme_specific_parts;
};
// Describes a package that can handle a URL.
struct UrlHandlerInfo {
string name;
string package_name;
string activity_name; // A hint for retrieving the package's icon.
[MinVersion=4] ActionType action;
[MinVersion=6] bool is_preferred;
};
// Describes an activity.
struct ActivityName {
string package_name;
string activity_name;
};
// Describes an icon for the activity.
struct ActivityIcon {
ActivityName activity;
uint32 width; // in px
uint32 height; // in px
array<uint8> icon; // in BGRA8888 format
};
// URL associated with its mime type.
struct UrlWithMimeType {
string url;
string mime_type;
};
// Handles intents from ARC in Chrome.
// Next method ID: 6
interface IntentHelperHost {
// Called when icons associated with the package are no longer up to date.
[MinVersion=3] OnIconInvalidated@1(string package_name);
// Called when intent filters are updated. Either on startup or when
// apps are installed or uninstalled.
[MinVersion=9] OnIntentFiltersUpdated@5(array<IntentFilter> intent_filters);
// Opens the downloads directory in the Chrome OS file manager.
[MinVersion=5] OnOpenDownloads@2();
// Opens the url with Chrome for Chrome OS.
OnOpenUrl@0(string url);
// Opens the wallpaper picker dialog.
[MinVersion=6] OpenWallpaperPicker@3();
// Sets an image as the wallpaper.
// |jpeg_data| is a JPEG encoded wallpaper image.
[MinVersion=8] SetWallpaper@4(array<uint8> jpeg_data);
};
// Sends intents to ARC on behalf of Chrome.
// Next method ID: 9
interface IntentHelperInstance {
// Sets the given package as a preferred package. The next time an ACTION_VIEW
// intent is sent with a URL that requires disambiguation, instead of opening
// the ResolverActivity, this package will be picked if it is on the list.
// When multiple packages are set as preferred, the most recent setting wins.
[MinVersion=7] AddPreferredPackage@8(string package_name);
// Handles the URL by sending an ACTION_VIEW intent to the package. The
// most suitable activity for the URL within the package will be started.
[MinVersion=2] HandleUrl@2(string url, string package_name);
// Handles the list of URLs by sending a specified intent to the handler.
[MinVersion=5] HandleUrlList@7(array<UrlWithMimeType> urls,
ActivityName activity,
ActionType action);
// Deprecated. Use HandleUrlList.
[MinVersion=4] HandleUrlListDeprecated@5(array<UrlWithMimeType> urls,
string package_name,
ActionType action);
// Establishes full-duplex communication with the host.
Init@0(IntentHelperHost host_ptr);
// Requests 48dp * 48dp icons of the |activities| suitable for the
// |scale_factor|. An array of icon data will be returned.
[MinVersion=3] RequestActivityIcons@4(array<ActivityName> activities,
ScaleFactor scale_factor)
=> (array<ActivityIcon> icons);
// Requests a list of packages that can handle the URL.
[MinVersion=2] RequestUrlHandlerList@3(string url)
=> (array<UrlHandlerInfo> handlers);
// Requests a list of packages that can handle the list of files.
[MinVersion=4] RequestUrlListHandlerList@6(array<UrlWithMimeType> urls)
=> (array<UrlHandlerInfo> handlers);
// Send an Android broadcast message to the Android package and class
// specified. Data can be sent as extras by including a JSON map string which
// will be automatically converted to a bundle accessible by the receiver.
//
// Note: Broadcasts can only be sent to whitelisted packages. Packages can be
// added to the whitelist in ArcBridgeService.java in the Android source.
[MinVersion=1] SendBroadcast@1(string action,
string package_name,
string cls,
string extras);
};