| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be found |
| 3 // in the LICENSE file. | 3 // in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef RemoteBridgeFrameOwner_h | 5 #ifndef RemoteFrameOwner_h |
| 6 #define RemoteBridgeFrameOwner_h | 6 #define RemoteFrameOwner_h |
| 7 | 7 |
| 8 #include "core/frame/FrameOwner.h" | 8 #include "core/frame/FrameOwner.h" |
| 9 #include "platform/scroll/ScrollTypes.h" | 9 #include "platform/scroll/ScrollTypes.h" |
| 10 #include "public/web/WebFrameOwnerProperties.h" | 10 #include "public/web/WebFrameOwnerProperties.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 // Helper class to bridge communication for a frame with a remote parent. | 14 // Helper class to bridge communication for a frame with a remote parent. |
| 15 // Currently, it serves two purposes: | 15 // Currently, it serves two purposes: |
| 16 // 1. Allows the local frame's loader to retrieve sandbox flags associated with | 16 // 1. Allows the local frame's loader to retrieve sandbox flags associated with |
| 17 // its owner element in another process. | 17 // its owner element in another process. |
| 18 // 2. Trigger a load event on its owner element once it finishes a load. | 18 // 2. Trigger a load event on its owner element once it finishes a load. |
| 19 class RemoteBridgeFrameOwner final : public NoBaseWillBeGarbageCollectedFinalize
d<RemoteBridgeFrameOwner>, public FrameOwner { | 19 class RemoteFrameOwner final : public RefCountedWillBeGarbageCollectedFinalized<
RemoteFrameOwner>, public FrameOwner { |
| 20 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(RemoteBridgeFrameOwner); | 20 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(RemoteFrameOwner); |
| 21 public: | 21 public: |
| 22 static PassOwnPtrWillBeRawPtr<RemoteBridgeFrameOwner> create(SandboxFlags fl
ags, const WebFrameOwnerProperties& frameOwnerProperties) | 22 static PassRefPtrWillBeRawPtr<RemoteFrameOwner> create(SandboxFlags flags, c
onst WebFrameOwnerProperties& frameOwnerProperties) |
| 23 { | 23 { |
| 24 return adoptPtrWillBeNoop(new RemoteBridgeFrameOwner(flags, frameOwnerPr
operties)); | 24 return adoptRefWillBeNoop(new RemoteFrameOwner(flags, frameOwnerProperti
es)); |
| 25 } | 25 } |
| 26 | 26 |
| 27 // FrameOwner overrides: | 27 // FrameOwner overrides: |
| 28 bool isLocal() const override { return false; } | 28 bool isLocal() const override { return false; } |
| 29 bool isRemote() const override { return true; } |
| 29 void setContentFrame(Frame&) override; | 30 void setContentFrame(Frame&) override; |
| 30 void clearContentFrame() override; | 31 void clearContentFrame() override; |
| 31 SandboxFlags getSandboxFlags() const override { return m_sandboxFlags; } | 32 SandboxFlags getSandboxFlags() const override { return m_sandboxFlags; } |
| 32 void setSandboxFlags(SandboxFlags flags) { m_sandboxFlags = flags; } | 33 void setSandboxFlags(SandboxFlags flags) { m_sandboxFlags = flags; } |
| 33 void dispatchLoad() override; | 34 void dispatchLoad() override; |
| 34 // TODO(dcheng): Implement. | 35 // TODO(dcheng): Implement. |
| 35 void renderFallbackContent() override { } | 36 void renderFallbackContent() override { } |
| 36 ScrollbarMode scrollingMode() const override { return m_scrolling; } | 37 ScrollbarMode scrollingMode() const override { return m_scrolling; } |
| 37 int marginWidth() const override { return m_marginWidth; } | 38 int marginWidth() const override { return m_marginWidth; } |
| 38 int marginHeight() const override { return m_marginHeight; } | 39 int marginHeight() const override { return m_marginHeight; } |
| 39 | 40 |
| 40 void setScrollingMode(WebFrameOwnerProperties::ScrollingMode); | 41 void setScrollingMode(WebFrameOwnerProperties::ScrollingMode); |
| 41 void setMarginWidth(int marginWidth) { m_marginWidth = marginWidth; } | 42 void setMarginWidth(int marginWidth) { m_marginWidth = marginWidth; } |
| 42 void setMarginHeight(int marginHeight) { m_marginHeight = marginHeight; } | 43 void setMarginHeight(int marginHeight) { m_marginHeight = marginHeight; } |
| 43 | 44 |
| 44 DECLARE_VIRTUAL_TRACE(); | 45 DECLARE_VIRTUAL_TRACE(); |
| 45 | 46 |
| 46 private: | 47 private: |
| 47 RemoteBridgeFrameOwner(SandboxFlags, const WebFrameOwnerProperties&); | 48 RemoteFrameOwner(SandboxFlags, const WebFrameOwnerProperties&); |
| 48 | 49 |
| 49 RawPtrWillBeMember<Frame> m_frame; | 50 RawPtrWillBeMember<Frame> m_frame; |
| 50 SandboxFlags m_sandboxFlags; | 51 SandboxFlags m_sandboxFlags; |
| 51 ScrollbarMode m_scrolling; | 52 ScrollbarMode m_scrolling; |
| 52 int m_marginWidth; | 53 int m_marginWidth; |
| 53 int m_marginHeight; | 54 int m_marginHeight; |
| 54 }; | 55 }; |
| 55 | 56 |
| 56 DEFINE_TYPE_CASTS(RemoteBridgeFrameOwner, FrameOwner, owner, !owner->isLocal(),
!owner.isLocal()); | 57 DEFINE_TYPE_CASTS(RemoteFrameOwner, FrameOwner, owner, owner->isRemote(), owner.
isRemote()); |
| 57 | 58 |
| 58 } // namespace blink | 59 } // namespace blink |
| 59 | 60 |
| 60 #endif // RemoteBridgeFrameOwner_h | 61 #endif // RemoteFrameOwner_h |
| OLD | NEW |