1*635a8641SAndroid Build Coastguard Worker // Copyright 2018 The Chromium Authors. All rights reserved. 2*635a8641SAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be 3*635a8641SAndroid Build Coastguard Worker // found in the LICENSE file. 4*635a8641SAndroid Build Coastguard Worker 5*635a8641SAndroid Build Coastguard Worker #ifndef IPC_MESSAGE_MOJOM_TRAITS_H_ 6*635a8641SAndroid Build Coastguard Worker #define IPC_MESSAGE_MOJOM_TRAITS_H_ 7*635a8641SAndroid Build Coastguard Worker 8*635a8641SAndroid Build Coastguard Worker #include <vector> 9*635a8641SAndroid Build Coastguard Worker 10*635a8641SAndroid Build Coastguard Worker #include "base/optional.h" 11*635a8641SAndroid Build Coastguard Worker #include "ipc/ipc.mojom-shared.h" 12*635a8641SAndroid Build Coastguard Worker #include "ipc/message_view.h" 13*635a8641SAndroid Build Coastguard Worker #include "mojo/public/cpp/base/big_buffer.h" 14*635a8641SAndroid Build Coastguard Worker #include "mojo/public/cpp/bindings/struct_traits.h" 15*635a8641SAndroid Build Coastguard Worker #include "mojo/public/interfaces/bindings/native_struct.mojom.h" 16*635a8641SAndroid Build Coastguard Worker 17*635a8641SAndroid Build Coastguard Worker namespace mojo { 18*635a8641SAndroid Build Coastguard Worker 19*635a8641SAndroid Build Coastguard Worker template <> 20*635a8641SAndroid Build Coastguard Worker class StructTraits<IPC::mojom::MessageDataView, IPC::MessageView> { 21*635a8641SAndroid Build Coastguard Worker public: 22*635a8641SAndroid Build Coastguard Worker static mojo_base::BigBufferView buffer(IPC::MessageView& view); 23*635a8641SAndroid Build Coastguard Worker static base::Optional<std::vector<mojo::native::SerializedHandlePtr>> handles( 24*635a8641SAndroid Build Coastguard Worker IPC::MessageView& view); 25*635a8641SAndroid Build Coastguard Worker 26*635a8641SAndroid Build Coastguard Worker static bool Read(IPC::mojom::MessageDataView data, IPC::MessageView* out); 27*635a8641SAndroid Build Coastguard Worker }; 28*635a8641SAndroid Build Coastguard Worker 29*635a8641SAndroid Build Coastguard Worker } // namespace mojo 30*635a8641SAndroid Build Coastguard Worker 31*635a8641SAndroid Build Coastguard Worker #endif // IPC_MESSAGE_MOJOM_TRAITS_H_ 32