OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef Frame_h | |
6 #define Frame_h | |
7 | |
8 #include "wtf/Forward.h" | |
9 #include "wtf/HashSet.h" | |
10 #include "wtf/RefCounted.h" | |
11 | |
12 namespace blink { | |
13 class WebLayer; | |
14 } | |
15 | |
16 namespace WebCore { | |
17 | |
18 class Document; | |
19 class DOMWindow; | |
20 class ChromeClient; | |
21 class FrameDestructionObserver; | |
22 class FrameHost; | |
23 class FrameLoaderClient; | |
24 class HTMLFrameOwnerElement; | |
25 class Page; | |
26 class RenderView; | |
27 class Settings; | |
28 | |
29 class FrameInit : public RefCounted<FrameInit> { | |
eseidel
2014/02/27 23:52:38
I'm confused. Doesn't FrameInit only make sense f
kenrb
2014/02/28 16:32:38
We need to track the owner element and I think the
| |
30 public: | |
31 // For creating a dummy Frame | |
32 static PassRefPtr<FrameInit> create(FrameHost* host, FrameLoaderClient* clie nt) | |
33 { | |
34 return adoptRef(new FrameInit(host, client)); | |
35 } | |
36 | |
37 void setFrameHost(FrameHost* host) { m_frameHost = host; } | |
38 FrameHost* frameHost() const { return m_frameHost; } | |
39 | |
40 void setFrameLoaderClient(FrameLoaderClient* client) { m_client = client; } | |
41 FrameLoaderClient* frameLoaderClient() const { return m_client; } | |
42 | |
43 void setOwnerElement(HTMLFrameOwnerElement* ownerElement) { m_ownerElement = ownerElement; } | |
44 HTMLFrameOwnerElement* ownerElement() const { return m_ownerElement; } | |
45 | |
46 protected: | |
47 FrameInit(FrameHost* host = 0, FrameLoaderClient* client = 0) | |
48 : m_client(client) | |
49 , m_frameHost(host) | |
50 , m_ownerElement(0) | |
51 { | |
52 } | |
53 | |
54 private: | |
55 FrameLoaderClient* m_client; | |
56 FrameHost* m_frameHost; | |
57 HTMLFrameOwnerElement* m_ownerElement; | |
58 }; | |
59 | |
60 class Frame : public RefCounted<Frame> { | |
61 public: | |
62 virtual bool isLocalFrame() const { return false; } | |
63 virtual bool isRemoteFrame() const { return false; } | |
64 | |
65 virtual ~Frame(); | |
66 | |
67 void addDestructionObserver(FrameDestructionObserver*); | |
68 void removeDestructionObserver(FrameDestructionObserver*); | |
69 | |
70 virtual void willDetachFrameHost(); | |
71 virtual void detachFromFrameHost(); | |
72 | |
73 // NOTE: Page is moving out of Blink up into the browser process as | |
74 // part of the site-isolation (out of process iframes) work. | |
75 // FrameHost should be used instead where possible. | |
76 Page* page() const; | |
77 FrameHost* host() const; // Null when the frame is detached. | |
78 | |
79 bool isMainFrame() const; | |
80 | |
81 virtual void setDOMWindow(PassRefPtr<DOMWindow>); | |
82 DOMWindow* domWindow() const; | |
83 Document* document() const; | |
84 | |
85 ChromeClient& chromeClient() const; | |
86 | |
87 RenderView* contentRenderer() const; // Root of the render tree for the docu ment contained in this frame. | |
88 | |
89 int64_t frameID() const { return m_frameID; } | |
90 | |
91 // FIXME: These should move to RemoteFrame once that exists. | |
92 void setRemotePlatformLayer(blink::WebLayer* remotePlatformLayer) { m_remote PlatformLayer = remotePlatformLayer; } | |
93 blink::WebLayer* remotePlatformLayer() const { return m_remotePlatformLayer; } | |
94 | |
95 // ======== All public functions below this point are candidates to move out of Frame into another class. ======== | |
eseidel
2014/02/27 23:52:38
I'm not sure Settings is going anywhere. This is
kenrb
2014/02/28 16:32:38
I was just copying it from the section it was orig
| |
96 | |
97 Settings* settings() const; // can be null | |
98 | |
99 double devicePixelRatio() const; | |
100 | |
101 // ======== | |
102 | |
103 protected: | |
104 Frame(PassRefPtr<FrameInit>); | |
105 | |
106 RefPtr<FrameInit> m_frameInit; | |
107 FrameHost* m_host; | |
108 | |
109 RefPtr<DOMWindow> m_domWindow; | |
eseidel
2014/02/27 23:52:38
RemoteFrames don't have a DOMWindow, do they?
kenrb
2014/02/28 16:32:38
Scripts can still interact with an OOP iframe's wi
| |
110 | |
111 private: | |
112 | |
113 HashSet<FrameDestructionObserver*> m_destructionObservers; | |
114 | |
115 // Temporary hack for history. | |
116 int64_t m_frameID; | |
117 | |
118 blink::WebLayer* m_remotePlatformLayer; | |
eseidel
2014/02/27 23:52:38
This moves onto remote frame right?
kenrb
2014/02/28 16:32:38
Yes, when we get to the point where RemoteFrame ca
| |
119 }; | |
120 | |
121 inline DOMWindow* Frame::domWindow() const | |
122 { | |
123 return m_domWindow.get(); | |
124 } | |
125 } // namespace WebCore | |
126 | |
127 #endif // Frame_h | |
OLD | NEW |