Chromium Code Reviews| Index: Source/core/frame/Frame.h |
| diff --git a/Source/core/frame/Frame.h b/Source/core/frame/Frame.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..76c26a4d3ba06875dd84e0263dea0abfd5007731 |
| --- /dev/null |
| +++ b/Source/core/frame/Frame.h |
| @@ -0,0 +1,127 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef Frame_h |
| +#define Frame_h |
| + |
| +#include "wtf/Forward.h" |
| +#include "wtf/HashSet.h" |
| +#include "wtf/RefCounted.h" |
| + |
| +namespace blink { |
| +class WebLayer; |
| +} |
| + |
| +namespace WebCore { |
| + |
| +class Document; |
| +class DOMWindow; |
| +class ChromeClient; |
| +class FrameDestructionObserver; |
| +class FrameHost; |
| +class FrameLoaderClient; |
| +class HTMLFrameOwnerElement; |
| +class Page; |
| +class RenderView; |
| +class Settings; |
| + |
| +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
|
| +public: |
| + // For creating a dummy Frame |
| + static PassRefPtr<FrameInit> create(FrameHost* host, FrameLoaderClient* client) |
| + { |
| + return adoptRef(new FrameInit(host, client)); |
| + } |
| + |
| + void setFrameHost(FrameHost* host) { m_frameHost = host; } |
| + FrameHost* frameHost() const { return m_frameHost; } |
| + |
| + void setFrameLoaderClient(FrameLoaderClient* client) { m_client = client; } |
| + FrameLoaderClient* frameLoaderClient() const { return m_client; } |
| + |
| + void setOwnerElement(HTMLFrameOwnerElement* ownerElement) { m_ownerElement = ownerElement; } |
| + HTMLFrameOwnerElement* ownerElement() const { return m_ownerElement; } |
| + |
| +protected: |
| + FrameInit(FrameHost* host = 0, FrameLoaderClient* client = 0) |
| + : m_client(client) |
| + , m_frameHost(host) |
| + , m_ownerElement(0) |
| + { |
| + } |
| + |
| +private: |
| + FrameLoaderClient* m_client; |
| + FrameHost* m_frameHost; |
| + HTMLFrameOwnerElement* m_ownerElement; |
| +}; |
| + |
| +class Frame : public RefCounted<Frame> { |
| +public: |
| + virtual bool isLocalFrame() const { return false; } |
| + virtual bool isRemoteFrame() const { return false; } |
| + |
| + virtual ~Frame(); |
| + |
| + void addDestructionObserver(FrameDestructionObserver*); |
| + void removeDestructionObserver(FrameDestructionObserver*); |
| + |
| + virtual void willDetachFrameHost(); |
| + virtual void detachFromFrameHost(); |
| + |
| + // NOTE: Page is moving out of Blink up into the browser process as |
| + // part of the site-isolation (out of process iframes) work. |
| + // FrameHost should be used instead where possible. |
| + Page* page() const; |
| + FrameHost* host() const; // Null when the frame is detached. |
| + |
| + bool isMainFrame() const; |
| + |
| + virtual void setDOMWindow(PassRefPtr<DOMWindow>); |
| + DOMWindow* domWindow() const; |
| + Document* document() const; |
| + |
| + ChromeClient& chromeClient() const; |
| + |
| + RenderView* contentRenderer() const; // Root of the render tree for the document contained in this frame. |
| + |
| + int64_t frameID() const { return m_frameID; } |
| + |
| + // FIXME: These should move to RemoteFrame once that exists. |
| + void setRemotePlatformLayer(blink::WebLayer* remotePlatformLayer) { m_remotePlatformLayer = remotePlatformLayer; } |
| + blink::WebLayer* remotePlatformLayer() const { return m_remotePlatformLayer; } |
| + |
| +// ======== 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
|
| + |
| + Settings* settings() const; // can be null |
| + |
| + double devicePixelRatio() const; |
| + |
| +// ======== |
| + |
| +protected: |
| + Frame(PassRefPtr<FrameInit>); |
| + |
| + RefPtr<FrameInit> m_frameInit; |
| + FrameHost* m_host; |
| + |
| + 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
|
| + |
| +private: |
| + |
| + HashSet<FrameDestructionObserver*> m_destructionObservers; |
| + |
| + // Temporary hack for history. |
| + int64_t m_frameID; |
| + |
| + 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
|
| +}; |
| + |
| +inline DOMWindow* Frame::domWindow() const |
| +{ |
| + return m_domWindow.get(); |
| +} |
| +} // namespace WebCore |
| + |
| +#endif // Frame_h |