Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(259)

Side by Side Diff: third_party/WebKit/Source/core/frame/LocalFrame.h

Issue 1444183003: Cancel javascript: URL navigations if the frame was navigated. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More comments Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 reserved. 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) 9 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 10 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 #if ENABLE(OILPAN) 177 #if ENABLE(OILPAN)
178 void registerPluginElement(HTMLPlugInElement*); 178 void registerPluginElement(HTMLPlugInElement*);
179 void unregisterPluginElement(HTMLPlugInElement*); 179 void unregisterPluginElement(HTMLPlugInElement*);
180 void clearWeakMembers(Visitor*); 180 void clearWeakMembers(Visitor*);
181 #endif 181 #endif
182 DisplayItemClient displayItemClient() const { return toDisplayItemClient(thi s); } 182 DisplayItemClient displayItemClient() const { return toDisplayItemClient(thi s); }
183 String debugName() const { return "LocalFrame"; } 183 String debugName() const { return "LocalFrame"; }
184 184
185 bool shouldThrottleRendering() const; 185 bool shouldThrottleRendering() const;
186 186
187 // ========
188
189 // Returns the frame scheduler, creating one if needed. 187 // Returns the frame scheduler, creating one if needed.
190 WebFrameScheduler* frameScheduler(); 188 WebFrameScheduler* frameScheduler();
191 void updateFrameSecurityOrigin(); 189 void updateFrameSecurityOrigin();
192 190
191 bool isNavigationAllowed() const { return m_navigationDisableCount == 0; }
192
193 private: 193 private:
194 friend class FrameNavigationDisabler;
195
194 LocalFrame(FrameLoaderClient*, FrameHost*, FrameOwner*); 196 LocalFrame(FrameLoaderClient*, FrameHost*, FrameOwner*);
195 197
196 // Internal Frame helper overrides: 198 // Internal Frame helper overrides:
197 WindowProxyManager* windowProxyManager() const override; 199 WindowProxyManager* windowProxyManager() const override;
198 200
199 String localLayerTreeAsText(unsigned flags) const; 201 String localLayerTreeAsText(unsigned flags) const;
200 202
201 // Paints the area for the given rect into a DragImage, with the given displ ayItemClient id attached. 203 // Paints the area for the given rect into a DragImage, with the given displ ayItemClient id attached.
202 // The rect is in the coordinate space of the frame. 204 // The rect is in the coordinate space of the frame.
203 PassOwnPtr<DragImage> paintIntoDragImage(const DisplayItemClientWrapper&, 205 PassOwnPtr<DragImage> paintIntoDragImage(const DisplayItemClientWrapper&,
204 RespectImageOrientationEnum shouldRespectImageOrientation, const GlobalP aintFlags, 206 RespectImageOrientationEnum shouldRespectImageOrientation, const GlobalP aintFlags,
205 IntRect paintingRect, float opacity = 1); 207 IntRect paintingRect, float opacity = 1);
206 208
209 void enableNavigation() { --m_navigationDisableCount; }
210 void disableNavigation() { ++m_navigationDisableCount; }
211
207 mutable FrameLoader m_loader; 212 mutable FrameLoader m_loader;
208 OwnPtrWillBeMember<NavigationScheduler> m_navigationScheduler; 213 OwnPtrWillBeMember<NavigationScheduler> m_navigationScheduler;
209 214
210 RefPtrWillBeMember<FrameView> m_view; 215 RefPtrWillBeMember<FrameView> m_view;
211 RefPtrWillBeMember<LocalDOMWindow> m_domWindow; 216 RefPtrWillBeMember<LocalDOMWindow> m_domWindow;
212 // Usually 0. Non-null if this is the top frame of PagePopup. 217 // Usually 0. Non-null if this is the top frame of PagePopup.
213 RefPtrWillBeMember<Element> m_pagePopupOwner; 218 RefPtrWillBeMember<Element> m_pagePopupOwner;
214 219
215 const OwnPtrWillBeMember<ScriptController> m_script; 220 const OwnPtrWillBeMember<ScriptController> m_script;
216 const OwnPtrWillBeMember<Editor> m_editor; 221 const OwnPtrWillBeMember<Editor> m_editor;
217 const OwnPtrWillBeMember<SpellChecker> m_spellChecker; 222 const OwnPtrWillBeMember<SpellChecker> m_spellChecker;
218 const OwnPtrWillBeMember<FrameSelection> m_selection; 223 const OwnPtrWillBeMember<FrameSelection> m_selection;
219 const OwnPtrWillBeMember<EventHandler> m_eventHandler; 224 const OwnPtrWillBeMember<EventHandler> m_eventHandler;
220 const OwnPtrWillBeMember<FrameConsole> m_console; 225 const OwnPtrWillBeMember<FrameConsole> m_console;
221 const OwnPtrWillBeMember<InputMethodController> m_inputMethodController; 226 const OwnPtrWillBeMember<InputMethodController> m_inputMethodController;
222 OwnPtr<WebFrameScheduler> m_frameScheduler; 227 OwnPtr<WebFrameScheduler> m_frameScheduler;
223 228
229 int m_navigationDisableCount;
230
224 #if ENABLE(OILPAN) 231 #if ENABLE(OILPAN)
225 // Oilpan: in order to reliably finalize plugin elements with 232 // Oilpan: in order to reliably finalize plugin elements with
226 // renderer-less plugins, the frame keeps track of them. When 233 // renderer-less plugins, the frame keeps track of them. When
227 // the frame is detached and disposed, these will be disposed 234 // the frame is detached and disposed, these will be disposed
228 // of in the process. This is needed as the plugin element 235 // of in the process. This is needed as the plugin element
229 // might not itself be attached to a DOM tree and be 236 // might not itself be attached to a DOM tree and be
230 // explicitly detached&disposed of. 237 // explicitly detached&disposed of.
231 // 238 //
232 // A weak reference is all wanted; the plugin element must 239 // A weak reference is all wanted; the plugin element must
233 // otherwise be referenced and kept alive. So as to be able 240 // otherwise be referenced and kept alive. So as to be able
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 inline EventHandler& LocalFrame::eventHandler() const 327 inline EventHandler& LocalFrame::eventHandler() const
321 { 328 {
322 ASSERT(m_eventHandler); 329 ASSERT(m_eventHandler);
323 return *m_eventHandler; 330 return *m_eventHandler;
324 } 331 }
325 332
326 DEFINE_TYPE_CASTS(LocalFrame, Frame, localFrame, localFrame->isLocalFrame(), loc alFrame.isLocalFrame()); 333 DEFINE_TYPE_CASTS(LocalFrame, Frame, localFrame, localFrame->isLocalFrame(), loc alFrame.isLocalFrame());
327 334
328 DECLARE_WEAK_IDENTIFIER_MAP(LocalFrame); 335 DECLARE_WEAK_IDENTIFIER_MAP(LocalFrame);
329 336
337 class FrameNavigationDisabler {
338 WTF_MAKE_NONCOPYABLE(FrameNavigationDisabler);
339 STACK_ALLOCATED();
340 public:
341 explicit FrameNavigationDisabler(LocalFrame&);
342 ~FrameNavigationDisabler();
343
344 private:
345 RawPtrWillBeMember<LocalFrame> m_frame;
346 };
347
330 } // namespace blink 348 } // namespace blink
331 349
332 // During refactoring, there are some places where we need to do type conversion s that 350 // During refactoring, there are some places where we need to do type conversion s that
333 // will not be needed once all instances of LocalFrame and RemoteFrame are sorte d out. 351 // will not be needed once all instances of LocalFrame and RemoteFrame are sorte d out.
334 // At that time this #define will be removed and all the uses of it will need to be corrected. 352 // At that time this #define will be removed and all the uses of it will need to be corrected.
335 #define toLocalFrameTemporary toLocalFrame 353 #define toLocalFrameTemporary toLocalFrame
336 354
337 #endif // LocalFrame_h 355 #endif // LocalFrame_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.cpp ('k') | third_party/WebKit/Source/core/frame/LocalFrame.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698