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

Side by Side Diff: Source/web/WebFrameImpl.h

Issue 117493002: Invert the owning relationship between WebFrame and Frame. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Comment clarity? Created 7 years 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 17 matching lines...) Expand all
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef WebFrameImpl_h 31 #ifndef WebFrameImpl_h
32 #define WebFrameImpl_h 32 #define WebFrameImpl_h
33 33
34 #include "WebFrame.h" 34 #include "WebFrame.h"
35 35
36 #include "FrameLoaderClientImpl.h" 36 #include "FrameLoaderClientImpl.h"
37 #include "core/frame/Frame.h" 37 #include "core/frame/Frame.h"
38 #include "core/frame/FrameDestructionObserver.h"
39 #include "platform/geometry/FloatRect.h" 38 #include "platform/geometry/FloatRect.h"
40 #include "public/platform/WebFileSystemType.h" 39 #include "public/platform/WebFileSystemType.h"
41 #include "wtf/Compiler.h" 40 #include "wtf/Compiler.h"
42 #include "wtf/OwnPtr.h" 41 #include "wtf/OwnPtr.h"
43 #include "wtf/RefCounted.h" 42 #include "wtf/RefCounted.h"
44 #include "wtf/text/WTFString.h" 43 #include "wtf/text/WTFString.h"
45 44
46 namespace WebCore { 45 namespace WebCore {
47 class GraphicsContext; 46 class GraphicsContext;
48 class HTMLInputElement; 47 class HTMLInputElement;
(...skipping 17 matching lines...) Expand all
66 class WebPluginContainerImpl; 65 class WebPluginContainerImpl;
67 class WebView; 66 class WebView;
68 class WebViewImpl; 67 class WebViewImpl;
69 struct WebPrintParams; 68 struct WebPrintParams;
70 69
71 template <typename T> class WebVector; 70 template <typename T> class WebVector;
72 71
73 // Implementation of WebFrame, note that this is a reference counted object. 72 // Implementation of WebFrame, note that this is a reference counted object.
74 class WebFrameImpl 73 class WebFrameImpl
75 : public WebFrame 74 : public WebFrame
76 , public RefCounted<WebFrameImpl> 75 , public RefCounted<WebFrameImpl> {
77 , public WebCore::FrameDestructionObserver {
78 public: 76 public:
79 // WebFrame methods: 77 // WebFrame methods:
80 virtual void close(); 78 virtual void close();
81 virtual WebString uniqueName() const; 79 virtual WebString uniqueName() const;
82 virtual WebString assignedName() const; 80 virtual WebString assignedName() const;
83 virtual void setName(const WebString&); 81 virtual void setName(const WebString&);
84 virtual long long embedderIdentifier() const; 82 virtual long long embedderIdentifier() const;
85 virtual WebVector<WebIconURL> iconURLs(int iconTypesMask) const; 83 virtual WebVector<WebIconURL> iconURLs(int iconTypesMask) const;
86 virtual void setRemoteWebLayer(WebLayer*); 84 virtual void setRemoteWebLayer(WebLayer*);
87 virtual void setPermissionClient(WebPermissionClient*); 85 virtual void setPermissionClient(WebPermissionClient*);
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 228
231 virtual WebString contentAsText(size_t maxChars) const; 229 virtual WebString contentAsText(size_t maxChars) const;
232 virtual WebString contentAsMarkup() const; 230 virtual WebString contentAsMarkup() const;
233 virtual WebString renderTreeAsText(RenderAsTextControls toShow = RenderAsTex tNormal) const; 231 virtual WebString renderTreeAsText(RenderAsTextControls toShow = RenderAsTex tNormal) const;
234 virtual WebString markerTextForListItem(const WebElement&) const; 232 virtual WebString markerTextForListItem(const WebElement&) const;
235 virtual WebRect selectionBoundsRect() const; 233 virtual WebRect selectionBoundsRect() const;
236 234
237 virtual bool selectionStartHasSpellingMarkerFor(int from, int length) const; 235 virtual bool selectionStartHasSpellingMarkerFor(int from, int length) const;
238 virtual WebString layerTreeAsText(bool showDebugInfo = false) const; 236 virtual WebString layerTreeAsText(bool showDebugInfo = false) const;
239 237
240 // WebCore::FrameDestructionObserver methods. 238 void willDetachParent();
241 virtual void willDetachFrameHost();
242 239
243 static WebFrameImpl* create(WebFrameClient*); 240 static WebFrameImpl* create(WebFrameClient*);
244 // FIXME: Move the embedderIdentifier concept fully to the embedder and 241 // FIXME: Move the embedderIdentifier concept fully to the embedder and
245 // remove this factory method. 242 // remove this factory method.
246 static WebFrameImpl* create(WebFrameClient*, long long embedderIdentifier); 243 static WebFrameImpl* create(WebFrameClient*, long long embedderIdentifier);
247 virtual ~WebFrameImpl(); 244 virtual ~WebFrameImpl();
248 245
249 // Called by the WebViewImpl to initialize the main frame for the page. 246 // Called by the WebViewImpl to initialize the main frame for the page.
250 void initializeAsMainFrame(WebCore::Page*); 247 void initializeAsMainFrame(WebCore::Page*);
251 248
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 // allows us to navigate by pressing Enter after closing the Find box. 291 // allows us to navigate by pressing Enter after closing the Find box.
295 void setFindEndstateFocusAndSelection(); 292 void setFindEndstateFocusAndSelection();
296 293
297 void didFail(const WebCore::ResourceError&, bool wasProvisional); 294 void didFail(const WebCore::ResourceError&, bool wasProvisional);
298 295
299 // Sets whether the WebFrameImpl allows its document to be scrolled. 296 // Sets whether the WebFrameImpl allows its document to be scrolled.
300 // If the parameter is true, allow the document to be scrolled. 297 // If the parameter is true, allow the document to be scrolled.
301 // Otherwise, disallow scrolling. 298 // Otherwise, disallow scrolling.
302 void setCanHaveScrollbars(bool); 299 void setCanHaveScrollbars(bool);
303 300
301 WebCore::Frame* frame() const { return m_frame.get(); }
304 WebFrameClient* client() const { return m_client; } 302 WebFrameClient* client() const { return m_client; }
305 void setClient(WebFrameClient* client) { m_client = client; } 303 void setClient(WebFrameClient* client) { m_client = client; }
306 304
307 WebPermissionClient* permissionClient() { return m_permissionClient; } 305 WebPermissionClient* permissionClient() { return m_permissionClient; }
308 SharedWorkerRepositoryClientImpl* sharedWorkerRepositoryClient() const { ret urn m_sharedWorkerRepositoryClient.get(); } 306 SharedWorkerRepositoryClientImpl* sharedWorkerRepositoryClient() const { ret urn m_sharedWorkerRepositoryClient.get(); }
309 307
310 void setInputEventsTransformForEmulation(const WebCore::IntSize&, float); 308 void setInputEventsTransformForEmulation(const WebCore::IntSize&, float);
311 309
312 static void selectWordAroundPosition(WebCore::Frame*, WebCore::VisiblePositi on); 310 static void selectWordAroundPosition(WebCore::Frame*, WebCore::VisiblePositi on);
313 311
(...skipping 19 matching lines...) Expand all
333 enum AreaToInvalidate { 331 enum AreaToInvalidate {
334 InvalidateNothing, 332 InvalidateNothing,
335 InvalidateContentArea, 333 InvalidateContentArea,
336 InvalidateScrollbar, // Vertical scrollbar only. 334 InvalidateScrollbar, // Vertical scrollbar only.
337 InvalidateAll // Both content area and the scrollbar. 335 InvalidateAll // Both content area and the scrollbar.
338 }; 336 };
339 337
340 WebFrameImpl(WebFrameClient*, long long frame_identifier); 338 WebFrameImpl(WebFrameClient*, long long frame_identifier);
341 339
342 // Sets the local WebCore frame and registers destruction observers. 340 // Sets the local WebCore frame and registers destruction observers.
343 void setWebCoreFrame(WebCore::Frame*); 341 void setWebCoreFrame(PassRefPtr<WebCore::Frame>);
344 342
345 // Notifies the delegate about a new selection rect. 343 // Notifies the delegate about a new selection rect.
346 void reportFindInPageSelection( 344 void reportFindInPageSelection(
347 const WebRect& selectionRect, int activeMatchOrdinal, int identifier); 345 const WebRect& selectionRect, int activeMatchOrdinal, int identifier);
348 346
349 // Clear the find-in-page matches cache forcing rects to be fully 347 // Clear the find-in-page matches cache forcing rects to be fully
350 // calculated again next time updateFindMatchRects is called. 348 // calculated again next time updateFindMatchRects is called.
351 void clearFindMatchesCache(); 349 void clearFindMatchesCache();
352 350
353 // Check if the activeMatchFrame still exists in the frame tree. 351 // Check if the activeMatchFrame still exists in the frame tree.
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 : WebCore::FrameInit(frameID) 429 : WebCore::FrameInit(frameID)
432 , m_frameLoaderClientImpl(webFrameImpl) 430 , m_frameLoaderClientImpl(webFrameImpl)
433 { 431 {
434 setFrameLoaderClient(&m_frameLoaderClientImpl); 432 setFrameLoaderClient(&m_frameLoaderClientImpl);
435 } 433 }
436 434
437 FrameLoaderClientImpl m_frameLoaderClientImpl; 435 FrameLoaderClientImpl m_frameLoaderClientImpl;
438 }; 436 };
439 RefPtr<WebFrameInit> m_frameInit; 437 RefPtr<WebFrameInit> m_frameInit;
440 438
439 // The cycle of madness.
eseidel 2013/12/21 01:17:34 Something a bit more informative. :)
dcheng 2013/12/28 01:04:29 Oops. This was a leftover comment from my initial
440 RefPtr<WebCore::Frame> m_frame;
441
441 WebFrameClient* m_client; 442 WebFrameClient* m_client;
442 WebPermissionClient* m_permissionClient; 443 WebPermissionClient* m_permissionClient;
443 OwnPtr<SharedWorkerRepositoryClientImpl> m_sharedWorkerRepositoryClient; 444 OwnPtr<SharedWorkerRepositoryClientImpl> m_sharedWorkerRepositoryClient;
444 445
445 // A way for the main frame to keep track of which frame has an active 446 // A way for the main frame to keep track of which frame has an active
446 // match. Should be 0 for all other frames. 447 // match. Should be 0 for all other frames.
447 WebFrameImpl* m_currentActiveMatchFrame; 448 WebFrameImpl* m_currentActiveMatchFrame;
448 449
449 // The range of the active match for the current frame. 450 // The range of the active match for the current frame.
450 RefPtr<WebCore::Range> m_activeMatch; 451 RefPtr<WebCore::Range> m_activeMatch;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 // Stores the additional input events offset and scale when device metrics e mulation is enabled. 523 // Stores the additional input events offset and scale when device metrics e mulation is enabled.
523 WebCore::IntSize m_inputEventsOffsetForEmulation; 524 WebCore::IntSize m_inputEventsOffsetForEmulation;
524 float m_inputEventsScaleFactorForEmulation; 525 float m_inputEventsScaleFactorForEmulation;
525 }; 526 };
526 527
527 DEFINE_TYPE_CASTS(WebFrameImpl, WebFrame, frame, true, true); 528 DEFINE_TYPE_CASTS(WebFrameImpl, WebFrame, frame, true, true);
528 529
529 } // namespace blink 530 } // namespace blink
530 531
531 #endif 532 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698