Add a bool to indicate whether we're in MojoShell

In MojoShell, we can connect to other applications. This patch adds a bool that
clients can use to check whether that feature is available without needing to
try to connect to an application.
This commit is contained in:
Adam Barth 2016-03-17 10:17:47 -07:00
parent 80423ae922
commit 23a7604829

View File

@ -48,6 +48,9 @@ class MojoShell {
} }
final ApplicationConnection _embedderConnection = _initEmbedderConnection(); final ApplicationConnection _embedderConnection = _initEmbedderConnection();
/// Whether [connectToApplication] is able to connect to other applications.
bool get canConnectToOtherApplications => _shell != null;
/// Attempts to connect to an application via the Mojo shell. /// Attempts to connect to an application via the Mojo shell.
ApplicationConnection connectToApplication(String url) { ApplicationConnection connectToApplication(String url) {
if (_shell == null) if (_shell == null)