Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / frame / Frame.h
index a4b404a..498cb77 100644 (file)
 #ifndef Frame_h
 #define Frame_h
 
-#include "heap/Handle.h"
+#include "core/page/FrameTree.h"
+#include "platform/heap/Handle.h"
 #include "wtf/Forward.h"
-#include "wtf/HashSet.h"
 #include "wtf/RefCounted.h"
 
 namespace blink {
 class WebLayer;
 }
 
-namespace WebCore {
+namespace blink {
 
-class Document;
-class DOMWindow;
 class ChromeClient;
-class FrameDestructionObserver;
+class FrameClient;
 class FrameHost;
+class FrameOwner;
 class HTMLFrameOwnerElement;
+class LocalDOMWindow;
 class Page;
-class RenderView;
+class RenderPart;
 class Settings;
 
 class Frame : public RefCounted<Frame> {
@@ -56,11 +56,11 @@ public:
 
     virtual ~Frame();
 
-    void addDestructionObserver(FrameDestructionObserver*);
-    void removeDestructionObserver(FrameDestructionObserver*);
+    virtual void detach() = 0;
+    void detachChildren();
 
-    virtual void willDetachFrameHost();
-    virtual void detachFromFrameHost();
+    FrameClient* client() const;
+    void clearClient();
 
     // NOTE: Page is moving out of Blink up into the browser process as
     // part of the site-isolation (out of process iframes) work.
@@ -69,47 +69,78 @@ public:
     FrameHost* host() const; // Null when the frame is detached.
 
     bool isMainFrame() const;
+    bool isLocalRoot() const;
+
+    virtual void disconnectOwnerElement();
+
+    FrameOwner* owner() const;
+    HTMLFrameOwnerElement* deprecatedLocalOwner() const;
 
-    // FIXME: DOMWindow and Document should both be moved to LocalFrame
+    // FIXME: LocalDOMWindow and Document should both be moved to LocalFrame
     // after RemoteFrame is complete enough to exist without them.
-    virtual void setDOMWindow(PassRefPtrWillBeRawPtr<DOMWindow>);
-    DOMWindow* domWindow() const;
-    Document* document() const;
+    virtual void setDOMWindow(PassRefPtrWillBeRawPtr<LocalDOMWindow>);
+    LocalDOMWindow* domWindow() const;
 
+    FrameTree& tree() 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; }
+    RenderPart* ownerRenderer() const; // Renderer for the element that contains this frame.
 
     // FIXME: These should move to RemoteFrame when that is instantiated.
-    void setRemotePlatformLayer(blink::WebLayer* remotePlatformLayer) { m_remotePlatformLayer = remotePlatformLayer; }
+    void setRemotePlatformLayer(blink::WebLayer*);
     blink::WebLayer* remotePlatformLayer() const { return m_remotePlatformLayer; }
 
     Settings* settings() const; // can be null
 
+    // FIXME: This method identifies a LocalFrame that is acting as a RemoteFrame.
+    // It is necessary only until we can instantiate a RemoteFrame, at which point
+    // it can be removed and its callers can be converted to use the isRemoteFrame()
+    // method.
+    bool isRemoteFrameTemporary() const { return m_remotePlatformLayer; }
+
 protected:
-    Frame(FrameHost*, HTMLFrameOwnerElement*);
+    Frame(FrameClient*, FrameHost*, FrameOwner*);
+
+    mutable FrameTree m_treeNode;
 
     FrameHost* m_host;
-    HTMLFrameOwnerElement* m_ownerElement;
+    FrameOwner* m_owner;
 
-    RefPtrWillBePersistent<DOMWindow> m_domWindow;
+    RefPtrWillBePersistent<LocalDOMWindow> m_domWindow;
 
 private:
-
-    HashSet<FrameDestructionObserver*> m_destructionObservers;
-
-    // Temporary hack for history.
-    int64_t m_frameID;
-
+    FrameClient* m_client;
     blink::WebLayer* m_remotePlatformLayer;
 };
 
-inline DOMWindow* Frame::domWindow() const
+inline FrameClient* Frame::client() const
+{
+    return m_client;
+}
+
+inline void Frame::clearClient()
+{
+    m_client = 0;
+}
+
+inline LocalDOMWindow* Frame::domWindow() const
 {
     return m_domWindow.get();
 }
-} // namespace WebCore
+
+inline FrameOwner* Frame::owner() const
+{
+    return m_owner;
+}
+
+inline FrameTree& Frame::tree() const
+{
+    return m_treeNode;
+}
+
+// Allow equality comparisons of Frames by reference or pointer, interchangeably.
+DEFINE_COMPARISON_OPERATORS_WITH_REFERENCES_REFCOUNTED(Frame)
+
+} // namespace blink
 
 #endif // Frame_h