naiveproxy/third_party/blink/public/web/remote_objects.mojom
2018-08-11 05:35:24 +00:00

57 lines
1.5 KiB
Plaintext

// Copyright 2018 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 blink.mojom;
import "mojo/public/mojom/base/string16.mojom";
// These interfaces allow an object implemented outside the Blink renderer
// process to be exposed to JavaScript via synchronous IPC.
//
// See also this design doc:
// https://docs.google.com/document/d/1T8Zj_gZK7jHsy80Etk-Rw4hXMIW4QeaTtXjy5ZKP3X0/edit
// Implemented in the process hosting the remote object.
// Allows methods to be synchronously invoked on the object.
interface RemoteObject {
[Sync] HasMethod(string name) => (bool method_exists);
[Sync] GetMethods() => (array<string> method_names);
[Sync] InvokeMethod(string name, array<RemoteInvocationArgument> arguments)
=> (RemoteInvocationResult result);
};
enum SingletonJavaScriptValue {
kNull,
kUndefined,
};
union RemoteInvocationArgument {
double number_value;
bool boolean_value;
mojo_base.mojom.String16 string_value;
SingletonJavaScriptValue singleton_value;
array<RemoteInvocationArgument> array_value;
};
enum RemoteInvocationError {
OK = 0,
METHOD_NOT_FOUND,
OBJECT_GET_CLASS_BLOCKED,
EXCEPTION_THROWN,
};
union RemoteInvocationResultValue {
double number_value;
bool boolean_value;
mojo_base.mojom.String16 string_value;
SingletonJavaScriptValue singleton_value;
};
struct RemoteInvocationResult {
RemoteInvocationError error = OK;
// Must be set if |error == OK|.
RemoteInvocationResultValue? value;
};