diff options
Diffstat (limited to 'chromium/fuchsia/cast_streaming/cast_streaming.cc')
-rw-r--r-- | chromium/fuchsia/cast_streaming/cast_streaming.cc | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/chromium/fuchsia/cast_streaming/cast_streaming.cc b/chromium/fuchsia/cast_streaming/cast_streaming.cc new file mode 100644 index 00000000000..2044900b05b --- /dev/null +++ b/chromium/fuchsia/cast_streaming/cast_streaming.cc @@ -0,0 +1,24 @@ +// Copyright 2020 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. + +#include "fuchsia/cast_streaming/public/cast_streaming.h" + +#include "base/strings/string_piece.h" + +namespace cast_streaming { + +bool IsCastStreamingAppOrigin(base::StringPiece origin) { + constexpr char kCastStreamingMessagePortOrigin[] = "cast-streaming:receiver"; + return origin == kCastStreamingMessagePortOrigin; +} + +bool IsValidCastStreamingMessage(const fuchsia::web::WebMessage& message) { + // |message| should contain exactly one OutgoingTransferrable, with a single + // MessagePort. + return message.has_outgoing_transfer() && + message.outgoing_transfer().size() == 1u && + message.outgoing_transfer()[0].is_message_port(); +} + +} // namespace cast_streaming |