Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / frame / Frame.h
index 8eda83f..498cb77 100644 (file)
 #ifndef Frame_h
 #define Frame_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 DOMWindow;
 class ChromeClient;
-class FrameDestructionObserver;
+class FrameClient;
 class FrameHost;
+class FrameOwner;
 class HTMLFrameOwnerElement;
+class LocalDOMWindow;
 class Page;
 class RenderPart;
 class Settings;
@@ -55,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.
@@ -68,24 +69,25 @@ public:
     FrameHost* host() const; // Null when the frame is detached.
 
     bool isMainFrame() const;
+    bool isLocalRoot() const;
 
     virtual void disconnectOwnerElement();
 
-    HTMLFrameOwnerElement* ownerElement() const;
+    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;
+    virtual void setDOMWindow(PassRefPtrWillBeRawPtr<LocalDOMWindow>);
+    LocalDOMWindow* domWindow() const;
 
+    FrameTree& tree() const;
     ChromeClient& chromeClient() const;
 
     RenderPart* ownerRenderer() const; // Renderer for the element that contains this frame.
 
-    int64_t frameID() const { return m_frameID; }
-
     // 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
@@ -97,33 +99,48 @@ public:
     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();
 }
 
-inline HTMLFrameOwnerElement* Frame::ownerElement() const
+inline FrameOwner* Frame::owner() const
 {
-    return m_ownerElement;
+    return m_owner;
 }
 
-} // namespace WebCore
+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