2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 * 1999-2001 Lars Knoll <knoll@kde.org>
4 * 1999-2001 Antti Koivisto <koivisto@kde.org>
5 * 2000-2001 Simon Hausmann <hausmann@kde.org>
6 * 2000-2001 Dirk Mueller <mueller@kde.org>
7 * 2000 Stefan Schimanski <1Stein@gmx.de>
8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
9 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Library General Public
14 * License as published by the Free Software Foundation; either
15 * version 2 of the License, or (at your option) any later version.
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Library General Public License for more details.
22 * You should have received a copy of the GNU Library General Public License
23 * along with this library; see the file COPYING.LIB. If not, write to
24 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
25 * Boston, MA 02110-1301, USA.
31 #include "core/page/FrameTree.h"
32 #include "platform/heap/Handle.h"
33 #include "wtf/Forward.h"
34 #include "wtf/RefCounted.h"
43 class HTMLFrameOwnerElement;
53 class Frame : public RefCountedWillBeGarbageCollectedFinalized<Frame> {
57 virtual void trace(Visitor*);
59 virtual bool isLocalFrame() const { return false; }
60 virtual bool isRemoteFrame() const { return false; }
62 // FIXME: This should return a DOMWindow*.
63 virtual LocalDOMWindow* domWindow() const = 0;
65 virtual void navigate(Document& originDocument, const KURL&, bool lockBackForwardList) = 0;
67 virtual void detach();
68 void detachChildren();
69 virtual void disconnectOwnerElement();
71 FrameClient* client() const;
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.
77 FrameHost* host() const; // Null when the frame is detached.
79 bool isMainFrame() const;
80 bool isLocalRoot() const;
82 FrameOwner* owner() const;
83 void setOwner(FrameOwner* owner) { m_owner = owner; }
84 HTMLFrameOwnerElement* deprecatedLocalOwner() const;
86 FrameTree& tree() const;
87 ChromeClient& chromeClient() const;
89 RenderPart* ownerRenderer() const; // Renderer for the element that contains this frame.
91 // FIXME: These should move to RemoteFrame when that is instantiated.
92 void setRemotePlatformLayer(WebLayer*);
93 WebLayer* remotePlatformLayer() const { return m_remotePlatformLayer; }
95 Settings* settings() const; // can be null
97 // FIXME: This method identifies a LocalFrame that is acting as a RemoteFrame.
98 // It is necessary only until we can instantiate a RemoteFrame, at which point
99 // it can be removed and its callers can be converted to use the isRemoteFrame()
101 bool isRemoteFrameTemporary() const { return m_remotePlatformLayer; }
104 Frame(FrameClient*, FrameHost*, FrameOwner*);
106 mutable FrameTree m_treeNode;
108 RawPtrWillBeMember<FrameHost> m_host;
109 RawPtrWillBeMember<FrameOwner> m_owner;
112 FrameClient* m_client;
113 WebLayer* m_remotePlatformLayer;
116 inline FrameClient* Frame::client() const
121 inline FrameOwner* Frame::owner() const
126 inline FrameTree& Frame::tree() const
131 // Allow equality comparisons of Frames by reference or pointer, interchangeably.
132 DEFINE_COMPARISON_OPERATORS_WITH_REFERENCES_REFCOUNTED(Frame)