Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 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> | |
| 11 * | |
| 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. | |
| 16 * | |
| 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. | |
| 21 * | |
| 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. | |
| 26 */ | |
| 27 | |
| 28 #ifndef Frame_h | |
| 29 #define Frame_h | |
| 30 | |
| 31 #include "wtf/Forward.h" | |
| 32 #include "wtf/HashSet.h" | |
| 33 #include "wtf/RefCounted.h" | |
| 34 | |
| 35 namespace blink { | |
| 36 class WebLayer; | |
| 37 } | |
| 38 | |
| 39 namespace WebCore { | |
| 40 | |
| 41 class Document; | |
| 42 class DOMWindow; | |
| 43 class ChromeClient; | |
| 44 class FrameDestructionObserver; | |
| 45 class FrameHost; | |
| 46 class FrameLoaderClient; | |
| 47 class HTMLFrameOwnerElement; | |
| 48 class Page; | |
| 49 class RenderView; | |
| 50 class Settings; | |
| 51 | |
| 52 class FrameInit : public RefCounted<FrameInit> { | |
| 53 public: | |
| 54 // For creating a dummy Frame | |
| 55 static PassRefPtr<FrameInit> create(FrameHost* host, FrameLoaderClient* clie nt) | |
| 56 { | |
| 57 return adoptRef(new FrameInit(host, client)); | |
| 58 } | |
| 59 | |
| 60 void setFrameHost(FrameHost* host) { m_frameHost = host; } | |
| 61 FrameHost* frameHost() const { return m_frameHost; } | |
| 62 | |
| 63 void setFrameLoaderClient(FrameLoaderClient* client) { m_client = client; } | |
| 64 FrameLoaderClient* frameLoaderClient() const { return m_client; } | |
| 65 | |
| 66 void setOwnerElement(HTMLFrameOwnerElement* ownerElement) { m_ownerElement = ownerElement; } | |
| 67 HTMLFrameOwnerElement* ownerElement() const { return m_ownerElement; } | |
| 68 | |
| 69 protected: | |
| 70 FrameInit(FrameHost* host = 0, FrameLoaderClient* client = 0) | |
| 71 : m_client(client) | |
| 72 , m_frameHost(host) | |
| 73 , m_ownerElement(0) | |
| 74 { | |
| 75 } | |
| 76 | |
| 77 private: | |
| 78 FrameLoaderClient* m_client; | |
| 79 FrameHost* m_frameHost; | |
| 80 HTMLFrameOwnerElement* m_ownerElement; | |
| 81 }; | |
| 82 | |
| 83 class Frame : public RefCounted<Frame> { | |
| 84 public: | |
| 85 virtual bool isLocalFrame() const { return false; } | |
| 86 virtual bool isRemoteFrame() const { return false; } | |
| 87 | |
| 88 virtual ~Frame(); | |
| 89 | |
| 90 void addDestructionObserver(FrameDestructionObserver*); | |
| 91 void removeDestructionObserver(FrameDestructionObserver*); | |
| 92 | |
| 93 virtual void willDetachFrameHost(); | |
| 94 virtual void detachFromFrameHost(); | |
| 95 | |
| 96 // NOTE: Page is moving out of Blink up into the browser process as | |
| 97 // part of the site-isolation (out of process iframes) work. | |
| 98 // FrameHost should be used instead where possible. | |
| 99 Page* page() const; | |
| 100 FrameHost* host() const; // Null when the frame is detached. | |
| 101 | |
| 102 bool isMainFrame() const; | |
| 103 | |
| 104 // FIXME: DOMWindow and Document should both be moved to LocalFrame | |
| 105 // after RemoteFrame is complete enough to exist without them. | |
| 106 virtual void setDOMWindow(PassRefPtr<DOMWindow>); | |
| 107 DOMWindow* domWindow() const; | |
| 108 Document* document() const; | |
| 109 | |
| 110 ChromeClient& chromeClient() const; | |
| 111 | |
| 112 RenderView* contentRenderer() const; // Root of the render tree for the docu ment contained in this frame. | |
| 113 | |
| 114 int64_t frameID() const { return m_frameID; } | |
| 115 | |
| 116 // FIXME: These should move to RemoteFrame when that is instantiated. | |
| 117 void setRemotePlatformLayer(blink::WebLayer* remotePlatformLayer) { m_remote PlatformLayer = remotePlatformLayer; } | |
| 118 blink::WebLayer* remotePlatformLayer() const { return m_remotePlatformLayer; } | |
| 119 | |
| 120 // ======== All public functions below this point are candidates to move out of Frame into another class. ======== | |
| 121 | |
| 122 Settings* settings() const; // can be null | |
| 123 | |
| 124 double devicePixelRatio() const; | |
|
dcheng
2014/03/04 19:03:03
I don't see an actual implementation for this func
kenrb
2014/03/04 19:36:51
Good catch, it was an oversight. Removed.
| |
| 125 | |
| 126 // ======== | |
| 127 | |
| 128 protected: | |
| 129 Frame(PassRefPtr<FrameInit>); | |
| 130 | |
| 131 RefPtr<FrameInit> m_frameInit; | |
| 132 FrameHost* m_host; | |
| 133 | |
| 134 RefPtr<DOMWindow> m_domWindow; | |
| 135 | |
| 136 private: | |
| 137 | |
| 138 HashSet<FrameDestructionObserver*> m_destructionObservers; | |
| 139 | |
| 140 // Temporary hack for history. | |
| 141 int64_t m_frameID; | |
| 142 | |
| 143 blink::WebLayer* m_remotePlatformLayer; | |
| 144 }; | |
| 145 | |
| 146 inline DOMWindow* Frame::domWindow() const | |
| 147 { | |
| 148 return m_domWindow.get(); | |
| 149 } | |
| 150 } // namespace WebCore | |
| 151 | |
| 152 #endif // Frame_h | |
| OLD | NEW |