| 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 RemoteFrameOwner_h | 5 #ifndef RemoteFrameOwner_h |
| 6 #define RemoteFrameOwner_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 RemoteFrameOwner final : public RefCountedWillBeGarbageCollectedFinalized<
RemoteFrameOwner>, public FrameOwner { | 19 class RemoteFrameOwner final : public GarbageCollectedFinalized<RemoteFrameOwner
>, public FrameOwner { |
| 20 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(RemoteFrameOwner); | 20 USING_GARBAGE_COLLECTED_MIXIN(RemoteFrameOwner); |
| 21 public: | 21 public: |
| 22 static PassRefPtrWillBeRawPtr<RemoteFrameOwner> create(SandboxFlags flags, c
onst WebFrameOwnerProperties& frameOwnerProperties) | 22 static RawPtr<RemoteFrameOwner> create(SandboxFlags flags, const WebFrameOwn
erProperties& frameOwnerProperties) |
| 23 { | 23 { |
| 24 return adoptRefWillBeNoop(new RemoteFrameOwner(flags, frameOwnerProperti
es)); | 24 return new RemoteFrameOwner(flags, frameOwnerProperties); |
| 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 bool isRemote() const override { return true; } |
| 30 void setContentFrame(Frame&) override; | 30 void setContentFrame(Frame&) override; |
| 31 void clearContentFrame() override; | 31 void clearContentFrame() override; |
| 32 SandboxFlags getSandboxFlags() const override { return m_sandboxFlags; } | 32 SandboxFlags getSandboxFlags() const override { return m_sandboxFlags; } |
| 33 void setSandboxFlags(SandboxFlags flags) { m_sandboxFlags = flags; } | 33 void setSandboxFlags(SandboxFlags flags) { m_sandboxFlags = flags; } |
| 34 void dispatchLoad() override; | 34 void dispatchLoad() override; |
| 35 // TODO(dcheng): Implement. | 35 // TODO(dcheng): Implement. |
| 36 void renderFallbackContent() override { } | 36 void renderFallbackContent() override { } |
| 37 ScrollbarMode scrollingMode() const override { return m_scrolling; } | 37 ScrollbarMode scrollingMode() const override { return m_scrolling; } |
| 38 int marginWidth() const override { return m_marginWidth; } | 38 int marginWidth() const override { return m_marginWidth; } |
| 39 int marginHeight() const override { return m_marginHeight; } | 39 int marginHeight() const override { return m_marginHeight; } |
| 40 | 40 |
| 41 void setScrollingMode(WebFrameOwnerProperties::ScrollingMode); | 41 void setScrollingMode(WebFrameOwnerProperties::ScrollingMode); |
| 42 void setMarginWidth(int marginWidth) { m_marginWidth = marginWidth; } | 42 void setMarginWidth(int marginWidth) { m_marginWidth = marginWidth; } |
| 43 void setMarginHeight(int marginHeight) { m_marginHeight = marginHeight; } | 43 void setMarginHeight(int marginHeight) { m_marginHeight = marginHeight; } |
| 44 | 44 |
| 45 DECLARE_VIRTUAL_TRACE(); | 45 DECLARE_VIRTUAL_TRACE(); |
| 46 | 46 |
| 47 private: | 47 private: |
| 48 RemoteFrameOwner(SandboxFlags, const WebFrameOwnerProperties&); | 48 RemoteFrameOwner(SandboxFlags, const WebFrameOwnerProperties&); |
| 49 | 49 |
| 50 RawPtrWillBeMember<Frame> m_frame; | 50 Member<Frame> m_frame; |
| 51 SandboxFlags m_sandboxFlags; | 51 SandboxFlags m_sandboxFlags; |
| 52 ScrollbarMode m_scrolling; | 52 ScrollbarMode m_scrolling; |
| 53 int m_marginWidth; | 53 int m_marginWidth; |
| 54 int m_marginHeight; | 54 int m_marginHeight; |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 DEFINE_TYPE_CASTS(RemoteFrameOwner, FrameOwner, owner, owner->isRemote(), owner.
isRemote()); | 57 DEFINE_TYPE_CASTS(RemoteFrameOwner, FrameOwner, owner, owner->isRemote(), owner.
isRemote()); |
| 58 | 58 |
| 59 } // namespace blink | 59 } // namespace blink |
| 60 | 60 |
| 61 #endif // RemoteFrameOwner_h | 61 #endif // RemoteFrameOwner_h |
| OLD | NEW |