1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "components/guest_view/renderer/guest_view_container_dispatcher.h"
7 #include "components/guest_view/common/guest_view_constants.h"
8 #include "components/guest_view/renderer/guest_view_container.h"
9 #include "ipc/ipc_message_macros.h"
11 namespace guest_view
{
13 GuestViewContainerDispatcher::GuestViewContainerDispatcher() {
16 GuestViewContainerDispatcher::~GuestViewContainerDispatcher() {
19 bool GuestViewContainerDispatcher::HandlesMessage(const IPC::Message
& message
) {
20 return IPC_MESSAGE_CLASS(message
) == GuestViewMsgStart
;
23 bool GuestViewContainerDispatcher::OnControlMessageReceived(
24 const IPC::Message
& message
) {
25 if (!HandlesMessage(message
))
28 int element_instance_id
= kInstanceIDNone
;
29 base::PickleIterator
iter(message
);
30 bool success
= iter
.ReadInt(&element_instance_id
);
33 auto* container
= GuestViewContainer::FromID(element_instance_id
);
37 return container
->OnMessageReceived(message
);
40 } // namespace guest_view