// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module sharing.mojom;
import "chromeos/ash/services/nearby/public/mojom/firewall_hole.mojom";
import "chromeos/ash/services/nearby/public/mojom/mdns.mojom";
import "chromeos/ash/services/nearby/public/mojom/nearby_connections.mojom";
import "chromeos/ash/services/nearby/public/mojom/nearby_presence.mojom";
import "chromeos/ash/services/nearby/public/mojom/nearby_connections_types.mojom";
import "chromeos/ash/services/nearby/public/mojom/nearby_decoder.mojom";
import "chromeos/ash/services/nearby/public/mojom/tcp_socket_factory.mojom";
import "chromeos/ash/services/nearby/public/mojom/webrtc.mojom";
import "chromeos/services/network_config/public/mojom/cros_network_config.mojom";
import "chromeos/ash/services/nearby/public/mojom/quick_start_decoder.mojom";
import "chromeos/ash/services/nearby/public/mojom/nearby_presence_credential_storage.mojom";
import "chromeos/ash/services/wifi_direct/public/mojom/wifi_direct_manager.mojom";
import "device/bluetooth/public/mojom/adapter.mojom";
import "sandbox/policy/mojom/sandbox.mojom";
// Collection of dependencies required by WifiLan medium.
struct WifiLanDependencies {
// Used to fetch the local device's IP address; needed for TCP server sockets.
pending_remote<chromeos.network_config.mojom.CrosNetworkConfig>
cros_network_config;
// Used to open a firewall hole for a TCP server socket.
pending_remote<FirewallHoleFactory> firewall_hole_factory;
// A proxy for NetworkContext, used to create TCP sockets.
pending_remote<TcpSocketFactory> tcp_socket_factory;
// Used to manage mDNS discovery and advertising.
pending_remote<MdnsManager>? mdns_manager;
};
// Collection of dependencies required by WifiDirect medium.
struct WifiDirectDependencies {
pending_remote<ash.wifi_direct.mojom.WifiDirectManager> wifi_direct_manager;
// Used to open a firewall hole for a TCP server socket.
pending_remote<FirewallHoleFactory> firewall_hole_factory;
};
// A collection of dependencies required by the Nearby Presence and
// Nearby Connections libraries. These are generally system resources that
// the utility process (which the Nearby libraries are hosted in) does not
// have privileges to directly access. This collection is provided once
// during start-up of the utility process and its hosted libraries.
struct NearbyDependencies {
pending_remote<bluetooth.mojom.Adapter>? bluetooth_adapter;
WebRtcDependencies webrtc_dependencies;
// Null if the WifiLan feature flag is disabled.
WifiLanDependencies? wifilan_dependencies;
// Null if the WifiDirect feature flag is disabled.
WifiDirectDependencies? wifidirect_dependencies;
pending_remote<ash.nearby.presence.mojom.NearbyPresenceCredentialStorage>?
nearby_presence_credential_storage;
nearby.connections.mojom.LogSeverity min_log_severity =
nearby.connections.mojom.LogSeverity.kInfo;
};
// Interface for sharing related services. Lives in a sandboxed utility process
// and is used by the browser process to offload unsafe protocol parsing.
[ServiceSandbox=sandbox.mojom.Sandbox.kNearby]
interface Sharing {
// Connects to Nearby functionality. All dependencies should be provided via
// the |dependencies| struct. Shutdown of Nearby functionality is
// asynchronous; to shut down the process, call ShutDown() and wait for the
// operation to complete before disconnecting the Sharing Mojo connection.
Connect(
NearbyDependencies deps,
pending_receiver<
nearby.connections.mojom.NearbyConnections>
nearby_connections,
pending_receiver<
ash.nearby.presence.mojom.NearbyPresence>
nearby_presence,
pending_receiver<sharing.mojom.NearbySharingDecoder>
decoder,
pending_receiver<ash.quick_start.mojom.QuickStartDecoder>
quick_start_decoder
);
// Shuts down Nearby functionality; once this operation returns, it is safe to
// disconnect active Mojo connections.
ShutDown() => ();
};