| 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 RemoteBridgeFrameOwner_h |
| 6 #define RemoteBridgeFrameOwner_h | 6 #define RemoteBridgeFrameOwner_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 #include "web/WebLocalFrameImpl.h" | |
| 12 | 11 |
| 13 namespace blink { | 12 namespace blink { |
| 14 | 13 |
| 15 // 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. |
| 16 // Currently, it serves two purposes: | 15 // Currently, it serves two purposes: |
| 17 // 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 |
| 18 // its owner element in another process. | 17 // its owner element in another process. |
| 19 // 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. |
| 20 class RemoteBridgeFrameOwner final : public NoBaseWillBeGarbageCollectedFinalize
d<RemoteBridgeFrameOwner>, public FrameOwner { | 19 class RemoteBridgeFrameOwner final : public NoBaseWillBeGarbageCollectedFinalize
d<RemoteBridgeFrameOwner>, public FrameOwner { |
| 21 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(RemoteBridgeFrameOwner); | 20 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(RemoteBridgeFrameOwner); |
| 22 public: | 21 public: |
| 23 static PassOwnPtrWillBeRawPtr<RemoteBridgeFrameOwner> create(PassRefPtrWillB
eRawPtr<WebLocalFrameImpl> frame, SandboxFlags flags, const WebFrameOwnerPropert
ies& frameOwnerProperties) | 22 static PassOwnPtrWillBeRawPtr<RemoteBridgeFrameOwner> create(SandboxFlags fl
ags, const WebFrameOwnerProperties& frameOwnerProperties) |
| 24 { | 23 { |
| 25 return adoptPtrWillBeNoop(new RemoteBridgeFrameOwner(frame, flags, frame
OwnerProperties)); | 24 return adoptPtrWillBeNoop(new RemoteBridgeFrameOwner(flags, frameOwnerPr
operties)); |
| 26 } | 25 } |
| 27 | 26 |
| 28 bool isLocal() const override | 27 // FrameOwner overrides: |
| 29 { | 28 bool isLocal() const override { return false; } |
| 30 return false; | 29 void setContentFrame(Frame&) override; |
| 31 } | 30 void clearContentFrame() override; |
| 32 | 31 SandboxFlags getSandboxFlags() const override { return m_sandboxFlags; } |
| 33 SandboxFlags getSandboxFlags() const override | 32 void setSandboxFlags(SandboxFlags flags) { m_sandboxFlags = flags; } |
| 34 { | |
| 35 return m_sandboxFlags; | |
| 36 } | |
| 37 | |
| 38 void setSandboxFlags(SandboxFlags flags) | |
| 39 { | |
| 40 m_sandboxFlags = flags; | |
| 41 } | |
| 42 | |
| 43 void setContentFrame(PassRefPtrWillBeRawPtr<WebLocalFrameImpl> frame) | |
| 44 { | |
| 45 m_frame = frame; | |
| 46 } | |
| 47 | |
| 48 void dispatchLoad() override; | 33 void dispatchLoad() override; |
| 49 | 34 // TODO(dcheng): Implement. |
| 50 void renderFallbackContent() override | 35 void renderFallbackContent() override { } |
| 51 { | 36 ScrollbarMode scrollingMode() const override { return m_scrolling; } |
| 52 // TODO(dcheng): Implement. | 37 int marginWidth() const override { return m_marginWidth; } |
| 53 } | 38 int marginHeight() const override { return m_marginHeight; } |
| 54 | 39 |
| 55 void setScrollingMode(WebFrameOwnerProperties::ScrollingMode); | 40 void setScrollingMode(WebFrameOwnerProperties::ScrollingMode); |
| 56 void setMarginWidth(int marginWidth) { m_marginWidth = marginWidth; } | 41 void setMarginWidth(int marginWidth) { m_marginWidth = marginWidth; } |
| 57 void setMarginHeight(int marginHeight) { m_marginHeight = marginHeight; } | 42 void setMarginHeight(int marginHeight) { m_marginHeight = marginHeight; } |
| 58 | 43 |
| 59 ScrollbarMode scrollingMode() const override { return m_scrolling; } | |
| 60 int marginWidth() const override { return m_marginWidth; } | |
| 61 int marginHeight() const override { return m_marginHeight; } | |
| 62 | |
| 63 DECLARE_VIRTUAL_TRACE(); | 44 DECLARE_VIRTUAL_TRACE(); |
| 64 | 45 |
| 65 private: | 46 private: |
| 66 RemoteBridgeFrameOwner(PassRefPtrWillBeRawPtr<WebLocalFrameImpl>, SandboxFla
gs, const WebFrameOwnerProperties&); | 47 RemoteBridgeFrameOwner(SandboxFlags, const WebFrameOwnerProperties&); |
| 67 | 48 |
| 68 RefPtrWillBeMember<WebLocalFrameImpl> m_frame; | 49 RawPtrWillBeMember<Frame> m_frame; |
| 69 SandboxFlags m_sandboxFlags; | 50 SandboxFlags m_sandboxFlags; |
| 70 ScrollbarMode m_scrolling; | 51 ScrollbarMode m_scrolling; |
| 71 int m_marginWidth; | 52 int m_marginWidth; |
| 72 int m_marginHeight; | 53 int m_marginHeight; |
| 73 }; | 54 }; |
| 74 | 55 |
| 75 DEFINE_TYPE_CASTS(RemoteBridgeFrameOwner, FrameOwner, owner, !owner->isLocal(),
!owner.isLocal()); | 56 DEFINE_TYPE_CASTS(RemoteBridgeFrameOwner, FrameOwner, owner, !owner->isLocal(),
!owner.isLocal()); |
| 76 | 57 |
| 77 } // namespace blink | 58 } // namespace blink |
| 78 | 59 |
| 79 #endif // RemoteBridgeFrameOwner_h | 60 #endif // RemoteBridgeFrameOwner_h |
| OLD | NEW |