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 found
3 // in the LICENSE file.
5 #ifndef RemoteBridgeFrameOwner_h
6 #define RemoteBridgeFrameOwner_h
8 #include "core/frame/FrameOwner.h"
9 #include "web/WebLocalFrameImpl.h"
13 // Helper class to bridge communication for a frame with a remote parent.
14 // Currently, it serves two purposes:
15 // 1. Allows the local frame's loader to retrieve sandbox flags associated with
16 // its owner element in another process.
17 // 2. Trigger a load event on its owner element once it finishes a load.
18 class RemoteBridgeFrameOwner final
: public NoBaseWillBeGarbageCollectedFinalized
<RemoteBridgeFrameOwner
>, public FrameOwner
{
19 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(RemoteBridgeFrameOwner
);
21 static PassOwnPtrWillBeRawPtr
<RemoteBridgeFrameOwner
> create(PassRefPtrWillBeRawPtr
<WebLocalFrameImpl
> frame
, SandboxFlags flags
)
23 return adoptPtrWillBeNoop(new RemoteBridgeFrameOwner(frame
, flags
));
26 bool isLocal() const override
31 SandboxFlags
sandboxFlags() const override
33 return m_sandboxFlags
;
36 void setSandboxFlags(SandboxFlags flags
)
38 m_sandboxFlags
= flags
;
41 void setContentFrame(PassRefPtrWillBeRawPtr
<WebLocalFrameImpl
> frame
)
46 void dispatchLoad() override
;
48 void renderFallbackContent() override
50 // TODO(dcheng): Implement.
53 DECLARE_VIRTUAL_TRACE();
56 RemoteBridgeFrameOwner(PassRefPtrWillBeRawPtr
<WebLocalFrameImpl
>, SandboxFlags
);
58 RefPtrWillBeMember
<WebLocalFrameImpl
> m_frame
;
59 SandboxFlags m_sandboxFlags
;
62 DEFINE_TYPE_CASTS(RemoteBridgeFrameOwner
, FrameOwner
, owner
, !owner
->isLocal(), !owner
.isLocal());
66 #endif // RemoteBridgeFrameOwner_h