Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(603)

Side by Side Diff: third_party/WebKit/Source/core/frame/FrameOwner.h

Issue 2631233003: Avoid mutating frame owner when detaching a provisional frame. (Closed)
Patch Set: Fix test to actually test the changed behavior. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef FrameOwner_h 5 #ifndef FrameOwner_h
6 #define FrameOwner_h 6 #define FrameOwner_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "core/dom/SandboxFlags.h" 9 #include "core/dom/SandboxFlags.h"
10 #include "platform/heap/Handle.h" 10 #include "platform/heap/Handle.h"
11 #include "platform/scroll/ScrollTypes.h" 11 #include "platform/scroll/ScrollTypes.h"
12 #include "public/platform/WebVector.h" 12 #include "public/platform/WebVector.h"
13 #include "public/platform/modules/permissions/WebPermissionType.h" 13 #include "public/platform/modules/permissions/WebPermissionType.h"
14 14
15 namespace blink { 15 namespace blink {
16 16
17 class Frame; 17 class Frame;
18 18
19 // Oilpan: all FrameOwner instances are GCed objects. FrameOwner additionally 19 // Oilpan: all FrameOwner instances are GCed objects. FrameOwner additionally
20 // derives from GarbageCollectedMixin so that Member<FrameOwner> references can 20 // derives from GarbageCollectedMixin so that Member<FrameOwner> references can
21 // be kept (e.g., Frame::m_owner.) 21 // be kept (e.g., Frame::m_owner.)
22 class CORE_EXPORT FrameOwner : public GarbageCollectedMixin { 22 class CORE_EXPORT FrameOwner : public GarbageCollectedMixin {
23 public: 23 public:
24 virtual ~FrameOwner() {} 24 virtual ~FrameOwner() {}
25 DEFINE_INLINE_VIRTUAL_TRACE() {} 25 DEFINE_INLINE_VIRTUAL_TRACE() {}
26 26
27 virtual bool isLocal() const = 0; 27 virtual bool isLocal() const = 0;
28 virtual bool isRemote() const = 0; 28 virtual bool isRemote() const = 0;
29 29
30 virtual Frame* contentFrame() const = 0;
30 virtual void setContentFrame(Frame&) = 0; 31 virtual void setContentFrame(Frame&) = 0;
31 virtual void clearContentFrame() = 0; 32 virtual void clearContentFrame() = 0;
32 33
33 virtual SandboxFlags getSandboxFlags() const = 0; 34 virtual SandboxFlags getSandboxFlags() const = 0;
34 virtual void dispatchLoad() = 0; 35 virtual void dispatchLoad() = 0;
35 36
36 // On load failure, a frame can ask its owner to render fallback content 37 // On load failure, a frame can ask its owner to render fallback content
37 // which replaces the frame contents. 38 // which replaces the frame contents.
38 virtual bool canRenderFallbackContent() const = 0; 39 virtual bool canRenderFallbackContent() const = 0;
39 virtual void renderFallbackContent() = 0; 40 virtual void renderFallbackContent() = 0;
40 41
41 virtual ScrollbarMode scrollingMode() const = 0; 42 virtual ScrollbarMode scrollingMode() const = 0;
42 virtual int marginWidth() const = 0; 43 virtual int marginWidth() const = 0;
43 virtual int marginHeight() const = 0; 44 virtual int marginHeight() const = 0;
44 virtual bool allowFullscreen() const = 0; 45 virtual bool allowFullscreen() const = 0;
45 virtual bool allowPaymentRequest() const = 0; 46 virtual bool allowPaymentRequest() const = 0;
46 virtual AtomicString csp() const = 0; 47 virtual AtomicString csp() const = 0;
47 virtual const WebVector<WebPermissionType>& delegatedPermissions() const = 0; 48 virtual const WebVector<WebPermissionType>& delegatedPermissions() const = 0;
48 }; 49 };
49 50
51 // TODO(dcheng): This class is an internal implementation detail of provisional
52 // frames. Move this into WebLocalFrameImpl.cpp and remove existing dependencies
53 // on it.
50 class CORE_EXPORT DummyFrameOwner 54 class CORE_EXPORT DummyFrameOwner
51 : public GarbageCollectedFinalized<DummyFrameOwner>, 55 : public GarbageCollectedFinalized<DummyFrameOwner>,
52 public FrameOwner { 56 public FrameOwner {
53 USING_GARBAGE_COLLECTED_MIXIN(DummyFrameOwner); 57 USING_GARBAGE_COLLECTED_MIXIN(DummyFrameOwner);
54 58
55 public: 59 public:
56 static DummyFrameOwner* create() { return new DummyFrameOwner; } 60 static DummyFrameOwner* create() { return new DummyFrameOwner; }
57 61
58 DEFINE_INLINE_VIRTUAL_TRACE() { FrameOwner::trace(visitor); } 62 DEFINE_INLINE_VIRTUAL_TRACE() { FrameOwner::trace(visitor); }
59 63
60 // FrameOwner overrides: 64 // FrameOwner overrides:
65 Frame* contentFrame() const override { return nullptr; }
61 void setContentFrame(Frame&) override {} 66 void setContentFrame(Frame&) override {}
62 void clearContentFrame() override {} 67 void clearContentFrame() override {}
63 SandboxFlags getSandboxFlags() const override { return SandboxNone; } 68 SandboxFlags getSandboxFlags() const override { return SandboxNone; }
64 void dispatchLoad() override {} 69 void dispatchLoad() override {}
65 bool canRenderFallbackContent() const override { return false; } 70 bool canRenderFallbackContent() const override { return false; }
66 void renderFallbackContent() override {} 71 void renderFallbackContent() override {}
67 ScrollbarMode scrollingMode() const override { return ScrollbarAuto; } 72 ScrollbarMode scrollingMode() const override { return ScrollbarAuto; }
68 int marginWidth() const override { return -1; } 73 int marginWidth() const override { return -1; }
69 int marginHeight() const override { return -1; } 74 int marginHeight() const override { return -1; }
70 bool allowFullscreen() const override { return false; } 75 bool allowFullscreen() const override { return false; }
71 bool allowPaymentRequest() const override { return false; } 76 bool allowPaymentRequest() const override { return false; }
72 AtomicString csp() const override { return nullAtom; } 77 AtomicString csp() const override { return nullAtom; }
73 const WebVector<WebPermissionType>& delegatedPermissions() const override { 78 const WebVector<WebPermissionType>& delegatedPermissions() const override {
74 DEFINE_STATIC_LOCAL(WebVector<WebPermissionType>, permissions, ()); 79 DEFINE_STATIC_LOCAL(WebVector<WebPermissionType>, permissions, ());
75 return permissions; 80 return permissions;
76 } 81 }
77 82
78 private: 83 private:
79 // Intentionally private to prevent redundant checks when the type is 84 // Intentionally private to prevent redundant checks when the type is
80 // already DummyFrameOwner. 85 // already DummyFrameOwner.
81 bool isLocal() const override { return false; } 86 bool isLocal() const override { return false; }
82 bool isRemote() const override { return false; } 87 bool isRemote() const override { return false; }
83 }; 88 };
84 89
85 } // namespace blink 90 } // namespace blink
86 91
87 #endif // FrameOwner_h 92 #endif // FrameOwner_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698