Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> | 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> |
| 3 * 1999-2001 Lars Knoll <knoll@kde.org> | 3 * 1999-2001 Lars Knoll <knoll@kde.org> |
| 4 * 1999-2001 Antti Koivisto <koivisto@kde.org> | 4 * 1999-2001 Antti Koivisto <koivisto@kde.org> |
| 5 * 2000-2001 Simon Hausmann <hausmann@kde.org> | 5 * 2000-2001 Simon Hausmann <hausmann@kde.org> |
| 6 * 2000-2001 Dirk Mueller <mueller@kde.org> | 6 * 2000-2001 Dirk Mueller <mueller@kde.org> |
| 7 * 2000 Stefan Schimanski <1Stein@gmx.de> | 7 * 2000 Stefan Schimanski <1Stein@gmx.de> |
| 8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights | 8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights |
| 9 * reserved. | 9 * reserved. |
| 10 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 10 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 47 class FrameHost; | 47 class FrameHost; |
| 48 class FrameOwner; | 48 class FrameOwner; |
| 49 class HTMLFrameOwnerElement; | 49 class HTMLFrameOwnerElement; |
| 50 class LayoutPart; | 50 class LayoutPart; |
| 51 class LayoutPartItem; | 51 class LayoutPartItem; |
| 52 class KURL; | 52 class KURL; |
| 53 class Page; | 53 class Page; |
| 54 class SecurityContext; | 54 class SecurityContext; |
| 55 class Settings; | 55 class Settings; |
| 56 class WindowProxy; | 56 class WindowProxy; |
| 57 class WindowProxyManagerBase; | 57 class WindowProxyManager; |
| 58 struct FrameLoadRequest; | 58 struct FrameLoadRequest; |
| 59 | 59 |
| 60 enum class FrameDetachType { Remove, Swap }; | 60 enum class FrameDetachType { Remove, Swap }; |
| 61 | 61 |
| 62 // Status of user gesture. | 62 // Status of user gesture. |
| 63 enum class UserGestureStatus { Active, None }; | 63 enum class UserGestureStatus { Active, None }; |
| 64 | 64 |
| 65 // Frame is the base class of LocalFrame and RemoteFrame and should only contain | 65 // Frame is the base class of LocalFrame and RemoteFrame and should only contain |
| 66 // functionality shared between both. In particular, any method related to | 66 // functionality shared between both. In particular, any method related to |
| 67 // input, layout, or painting probably belongs on LocalFrame. | 67 // input, layout, or painting probably belongs on LocalFrame. |
| 68 class CORE_EXPORT Frame : public GarbageCollectedFinalized<Frame> { | 68 class CORE_EXPORT Frame : public GarbageCollectedFinalized<Frame> { |
| 69 public: | 69 public: |
| 70 virtual ~Frame(); | 70 virtual ~Frame(); |
| 71 | 71 |
| 72 DECLARE_VIRTUAL_TRACE(); | 72 DECLARE_VIRTUAL_TRACE(); |
| 73 | 73 |
| 74 virtual bool isLocalFrame() const = 0; | 74 virtual bool isLocalFrame() const = 0; |
| 75 virtual bool isRemoteFrame() const = 0; | 75 virtual bool isRemoteFrame() const = 0; |
| 76 | 76 |
| 77 virtual WindowProxy* windowProxy(DOMWrapperWorld&) = 0; | |
| 78 | |
| 79 virtual void navigate(Document& originDocument, | 77 virtual void navigate(Document& originDocument, |
| 80 const KURL&, | 78 const KURL&, |
| 81 bool replaceCurrentItem, | 79 bool replaceCurrentItem, |
| 82 UserGestureStatus) = 0; | 80 UserGestureStatus) = 0; |
| 83 // This version of Frame::navigate assumes the resulting navigation is not | 81 // This version of Frame::navigate assumes the resulting navigation is not |
| 84 // to be started on a timer. Use the method above in such cases. | 82 // to be started on a timer. Use the method above in such cases. |
| 85 virtual void navigate(const FrameLoadRequest&) = 0; | 83 virtual void navigate(const FrameLoadRequest&) = 0; |
| 86 virtual void reload(FrameLoadType, ClientRedirectPolicy) = 0; | 84 virtual void reload(FrameLoadType, ClientRedirectPolicy) = 0; |
| 87 | 85 |
| 88 virtual void detach(FrameDetachType); | 86 virtual void detach(FrameDetachType); |
| 89 void disconnectOwnerElement(); | 87 void disconnectOwnerElement(); |
| 90 virtual bool shouldClose() = 0; | 88 virtual bool shouldClose() = 0; |
| 91 | 89 |
| 92 FrameClient* client() const; | 90 FrameClient* client() const { return m_client; } |
| 93 | 91 |
| 94 // NOTE: Page is moving out of Blink up into the browser process as | 92 // NOTE: Page is moving out of Blink up into the browser process as |
| 95 // part of the site-isolation (out of process iframes) work. | 93 // part of the site-isolation (out of process iframes) work. |
| 96 // FrameHost should be used instead where possible. | 94 // FrameHost should be used instead where possible. |
| 97 Page* page() const; | 95 Page* page() const; |
| 98 FrameHost* host() const; // Null when the frame is detached. | 96 FrameHost* host() const; // Null when the frame is detached. |
| 99 | 97 |
| 100 bool isMainFrame() const; | 98 bool isMainFrame() const; |
| 101 bool isLocalRoot() const; | 99 bool isLocalRoot() const; |
| 102 | 100 |
| 103 FrameOwner* owner() const; | 101 FrameOwner* owner() const { return m_owner; } |
|
dcheng
2017/02/22 01:07:06
Maybe split cleanup changes like this into a separ
Yuki
2017/02/22 09:01:33
Agreed. Reverted these part.
| |
| 104 void setOwner(FrameOwner* owner) { m_owner = owner; } | 102 void setOwner(FrameOwner* owner) { m_owner = owner; } |
| 105 HTMLFrameOwnerElement* deprecatedLocalOwner() const; | 103 HTMLFrameOwnerElement* deprecatedLocalOwner() const; |
| 106 | 104 |
| 105 WindowProxy* windowProxy(DOMWrapperWorld&); | |
| 106 | |
| 107 DOMWindow* domWindow() const { return m_domWindow; } | 107 DOMWindow* domWindow() const { return m_domWindow; } |
| 108 | 108 |
| 109 FrameTree& tree() const; | 109 FrameTree& tree() const { return m_treeNode; } |
| 110 ChromeClient& chromeClient() const; | 110 ChromeClient& chromeClient() const; |
| 111 | 111 |
| 112 virtual SecurityContext* securityContext() const = 0; | 112 virtual SecurityContext* securityContext() const = 0; |
| 113 | 113 |
| 114 Frame* findFrameForNavigation(const AtomicString& name, Frame& activeFrame); | 114 Frame* findFrameForNavigation(const AtomicString& name, Frame& activeFrame); |
| 115 Frame* findUnsafeParentScrollPropagationBoundary(); | 115 Frame* findUnsafeParentScrollPropagationBoundary(); |
| 116 | 116 |
| 117 // This prepares the Frame for the next commit. It will detach children, | 117 // This prepares the Frame for the next commit. It will detach children, |
| 118 // dispatch unload events, abort XHR requests and detach the document. | 118 // dispatch unload events, abort XHR requests and detach the document. |
| 119 // Returns true if the frame is ready to receive the next commit, or false | 119 // Returns true if the frame is ready to receive the next commit, or false |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 134 | 134 |
| 135 Settings* settings() const; // can be null | 135 Settings* settings() const; // can be null |
| 136 | 136 |
| 137 // isLoading() is true when the embedder should think a load is in progress. | 137 // isLoading() is true when the embedder should think a load is in progress. |
| 138 // In the case of LocalFrames, it means that the frame has sent a | 138 // In the case of LocalFrames, it means that the frame has sent a |
| 139 // didStartLoading() callback, but not the matching didStopLoading(). Inside | 139 // didStartLoading() callback, but not the matching didStopLoading(). Inside |
| 140 // blink, you probably want Document::loadEventFinished() instead. | 140 // blink, you probably want Document::loadEventFinished() instead. |
| 141 void setIsLoading(bool isLoading) { m_isLoading = isLoading; } | 141 void setIsLoading(bool isLoading) { m_isLoading = isLoading; } |
| 142 bool isLoading() const { return m_isLoading; } | 142 bool isLoading() const { return m_isLoading; } |
| 143 | 143 |
| 144 virtual WindowProxyManagerBase* getWindowProxyManager() const = 0; | 144 WindowProxyManager* getWindowProxyManager() const { |
| 145 return m_windowProxyManager; | |
| 146 } | |
| 145 | 147 |
| 146 virtual void didChangeVisibilityState(); | 148 virtual void didChangeVisibilityState(); |
| 147 | 149 |
| 148 void setDocumentHasReceivedUserGesture(); | 150 void setDocumentHasReceivedUserGesture(); |
| 149 bool hasReceivedUserGesture() const { return m_hasReceivedUserGesture; } | 151 bool hasReceivedUserGesture() const { return m_hasReceivedUserGesture; } |
| 150 | 152 |
| 151 bool isDetaching() const { return m_isDetaching; } | 153 bool isDetaching() const { return m_isDetaching; } |
| 152 | 154 |
| 153 protected: | 155 protected: |
| 154 Frame(FrameClient*, FrameHost*, FrameOwner*); | 156 Frame(FrameClient*, FrameHost*, FrameOwner*, WindowProxyManager*); |
| 155 | 157 |
| 156 mutable FrameTree m_treeNode; | 158 mutable FrameTree m_treeNode; |
| 157 | 159 |
| 158 Member<FrameHost> m_host; | 160 Member<FrameHost> m_host; |
| 159 Member<FrameOwner> m_owner; | 161 Member<FrameOwner> m_owner; |
| 160 Member<DOMWindow> m_domWindow; | 162 Member<DOMWindow> m_domWindow; |
| 161 | 163 |
| 162 bool m_hasReceivedUserGesture = false; | 164 bool m_hasReceivedUserGesture = false; |
| 163 bool m_isDetaching = false; | 165 bool m_isDetaching = false; |
| 164 | 166 |
| 165 private: | 167 private: |
| 166 bool canNavigateWithoutFramebusting(const Frame&, String& errorReason); | 168 bool canNavigateWithoutFramebusting(const Frame&, String& errorReason); |
| 167 | 169 |
| 168 Member<FrameClient> m_client; | 170 Member<FrameClient> m_client; |
| 171 const Member<WindowProxyManager> m_windowProxyManager; | |
| 169 bool m_isLoading; | 172 bool m_isLoading; |
| 170 }; | 173 }; |
| 171 | 174 |
| 172 inline FrameClient* Frame::client() const { | |
| 173 return m_client; | |
| 174 } | |
| 175 | |
| 176 inline FrameOwner* Frame::owner() const { | |
| 177 return m_owner; | |
| 178 } | |
| 179 | |
| 180 inline FrameTree& Frame::tree() const { | |
| 181 return m_treeNode; | |
| 182 } | |
| 183 | |
| 184 // Allow equality comparisons of Frames by reference or pointer, | 175 // Allow equality comparisons of Frames by reference or pointer, |
| 185 // interchangeably. | 176 // interchangeably. |
| 186 DEFINE_COMPARISON_OPERATORS_WITH_REFERENCES(Frame) | 177 DEFINE_COMPARISON_OPERATORS_WITH_REFERENCES(Frame) |
| 187 | 178 |
| 188 } // namespace blink | 179 } // namespace blink |
| 189 | 180 |
| 190 #endif // Frame_h | 181 #endif // Frame_h |
| OLD | NEW |