OLD | NEW |
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 26 matching lines...) Expand all Loading... |
37 #include "public/web/WebLocalFrame.h" | 37 #include "public/web/WebLocalFrame.h" |
38 #include "web/FrameLoaderClientImpl.h" | 38 #include "web/FrameLoaderClientImpl.h" |
39 #include "web/NotificationPresenterImpl.h" | 39 #include "web/NotificationPresenterImpl.h" |
40 #include "web/UserMediaClientImpl.h" | 40 #include "web/UserMediaClientImpl.h" |
41 #include "wtf/Compiler.h" | 41 #include "wtf/Compiler.h" |
42 #include "wtf/OwnPtr.h" | 42 #include "wtf/OwnPtr.h" |
43 #include "wtf/RefCounted.h" | 43 #include "wtf/RefCounted.h" |
44 #include "wtf/text/WTFString.h" | 44 #include "wtf/text/WTFString.h" |
45 | 45 |
46 namespace blink { | 46 namespace blink { |
| 47 |
| 48 class ChromePrintContext; |
| 49 class GeolocationClientProxy; |
47 class GraphicsContext; | 50 class GraphicsContext; |
48 class HTMLInputElement; | 51 class HTMLInputElement; |
49 class HistoryItem; | 52 class HistoryItem; |
50 class IntSize; | 53 class IntSize; |
51 class KURL; | 54 class KURL; |
52 class Node; | 55 class Node; |
53 class Range; | 56 class Range; |
| 57 class SharedWorkerRepositoryClientImpl; |
54 class SubstituteData; | 58 class SubstituteData; |
55 struct FrameLoadRequest; | |
56 struct WindowFeatures; | |
57 } | |
58 | |
59 namespace blink { | |
60 class ChromePrintContext; | |
61 class GeolocationClientProxy; | |
62 class SharedWorkerRepositoryClientImpl; | |
63 class TextFinder; | 59 class TextFinder; |
64 class WebDataSourceImpl; | 60 class WebDataSourceImpl; |
65 class WebInputElement; | 61 class WebInputElement; |
66 class WebFrameClient; | 62 class WebFrameClient; |
67 class WebPerformance; | 63 class WebPerformance; |
68 class WebPlugin; | 64 class WebPlugin; |
69 class WebPluginContainerImpl; | 65 class WebPluginContainerImpl; |
70 class WebView; | 66 class WebView; |
71 class WebViewImpl; | 67 class WebViewImpl; |
| 68 struct FrameLoadRequest; |
72 struct WebPrintParams; | 69 struct WebPrintParams; |
| 70 struct WindowFeatures; |
73 | 71 |
74 template <typename T> class WebVector; | 72 template <typename T> class WebVector; |
75 | 73 |
76 // Implementation of WebFrame, note that this is a reference counted object. | 74 // Implementation of WebFrame, note that this is a reference counted object. |
77 class WebLocalFrameImpl FINAL | 75 class WebLocalFrameImpl FINAL |
78 : public WebLocalFrame | 76 : public WebLocalFrame |
79 , public RefCounted<WebLocalFrameImpl> { | 77 , public RefCounted<WebLocalFrameImpl> { |
80 public: | 78 public: |
81 // WebFrame methods: | 79 // WebFrame methods: |
82 virtual bool isWebLocalFrame() const OVERRIDE; | 80 virtual bool isWebLocalFrame() const OVERRIDE; |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 virtual WebString layerTreeAsText(bool showDebugInfo = false) const OVERRIDE
; | 228 virtual WebString layerTreeAsText(bool showDebugInfo = false) const OVERRIDE
; |
231 | 229 |
232 // WebLocalFrame methods: | 230 // WebLocalFrame methods: |
233 virtual void addStyleSheetByURL(const WebString& url) OVERRIDE; | 231 virtual void addStyleSheetByURL(const WebString& url) OVERRIDE; |
234 | 232 |
235 void willDetachParent(); | 233 void willDetachParent(); |
236 | 234 |
237 static WebLocalFrameImpl* create(WebFrameClient*); | 235 static WebLocalFrameImpl* create(WebFrameClient*); |
238 virtual ~WebLocalFrameImpl(); | 236 virtual ~WebLocalFrameImpl(); |
239 | 237 |
240 PassRefPtr<blink::LocalFrame> initializeWebCoreFrame(blink::FrameHost*, blin
k::FrameOwner*, const AtomicString& name, const AtomicString& fallbackName); | 238 PassRefPtr<LocalFrame> initializeWebCoreFrame(FrameHost*, FrameOwner*, const
AtomicString& name, const AtomicString& fallbackName); |
241 | 239 |
242 PassRefPtr<blink::LocalFrame> createChildFrame( | 240 PassRefPtr<LocalFrame> createChildFrame( |
243 const blink::FrameLoadRequest&, blink::HTMLFrameOwnerElement*); | 241 const FrameLoadRequest&, HTMLFrameOwnerElement*); |
244 | 242 |
245 void didChangeContentsSize(const blink::IntSize&); | 243 void didChangeContentsSize(const IntSize&); |
246 | 244 |
247 void createFrameView(); | 245 void createFrameView(); |
248 | 246 |
249 static WebLocalFrameImpl* fromFrame(blink::LocalFrame*); | 247 static WebLocalFrameImpl* fromFrame(LocalFrame*); |
250 static WebLocalFrameImpl* fromFrame(blink::LocalFrame&); | 248 static WebLocalFrameImpl* fromFrame(LocalFrame&); |
251 static WebLocalFrameImpl* fromFrameOwnerElement(blink::Element*); | 249 static WebLocalFrameImpl* fromFrameOwnerElement(Element*); |
252 | 250 |
253 // If the frame hosts a PluginDocument, this method returns the WebPluginCon
tainerImpl | 251 // If the frame hosts a PluginDocument, this method returns the WebPluginCon
tainerImpl |
254 // that hosts the plugin. | 252 // that hosts the plugin. |
255 static WebPluginContainerImpl* pluginContainerFromFrame(blink::LocalFrame*); | 253 static WebPluginContainerImpl* pluginContainerFromFrame(LocalFrame*); |
256 | 254 |
257 // If the frame hosts a PluginDocument, this method returns the WebPluginCon
tainerImpl | 255 // If the frame hosts a PluginDocument, this method returns the WebPluginCon
tainerImpl |
258 // that hosts the plugin. If the provided node is a plugin, then it runs its | 256 // that hosts the plugin. If the provided node is a plugin, then it runs its |
259 // WebPluginContainerImpl. | 257 // WebPluginContainerImpl. |
260 static WebPluginContainerImpl* pluginContainerFromNode(blink::LocalFrame*, c
onst WebNode&); | 258 static WebPluginContainerImpl* pluginContainerFromNode(LocalFrame*, const We
bNode&); |
261 | 259 |
262 WebViewImpl* viewImpl() const; | 260 WebViewImpl* viewImpl() const; |
263 | 261 |
264 blink::FrameView* frameView() const { return frame() ? frame()->view() : 0;
} | 262 FrameView* frameView() const { return frame() ? frame()->view() : 0; } |
265 | 263 |
266 // Getters for the impls corresponding to Get(Provisional)DataSource. They | 264 // Getters for the impls corresponding to Get(Provisional)DataSource. They |
267 // may return 0 if there is no corresponding data source. | 265 // may return 0 if there is no corresponding data source. |
268 WebDataSourceImpl* dataSourceImpl() const; | 266 WebDataSourceImpl* dataSourceImpl() const; |
269 WebDataSourceImpl* provisionalDataSourceImpl() const; | 267 WebDataSourceImpl* provisionalDataSourceImpl() const; |
270 | 268 |
271 // Returns which frame has an active match. This function should only be | 269 // Returns which frame has an active match. This function should only be |
272 // called on the main frame, as it is the only frame keeping track. Returned | 270 // called on the main frame, as it is the only frame keeping track. Returned |
273 // value can be 0 if no frame has an active match. | 271 // value can be 0 if no frame has an active match. |
274 WebLocalFrameImpl* activeMatchFrame() const; | 272 WebLocalFrameImpl* activeMatchFrame() const; |
275 | 273 |
276 // Returns the active match in the current frame. Could be a null range if | 274 // Returns the active match in the current frame. Could be a null range if |
277 // the local frame has no active match. | 275 // the local frame has no active match. |
278 blink::Range* activeMatch() const; | 276 Range* activeMatch() const; |
279 | 277 |
280 // When a Find operation ends, we want to set the selection to what was acti
ve | 278 // When a Find operation ends, we want to set the selection to what was acti
ve |
281 // and set focus to the first focusable node we find (starting with the firs
t | 279 // and set focus to the first focusable node we find (starting with the firs
t |
282 // node in the matched range and going up the inheritance chain). If we find | 280 // node in the matched range and going up the inheritance chain). If we find |
283 // nothing to focus we focus the first focusable node in the range. This | 281 // nothing to focus we focus the first focusable node in the range. This |
284 // allows us to set focus to a link (when we find text inside a link), which | 282 // allows us to set focus to a link (when we find text inside a link), which |
285 // allows us to navigate by pressing Enter after closing the Find box. | 283 // allows us to navigate by pressing Enter after closing the Find box. |
286 void setFindEndstateFocusAndSelection(); | 284 void setFindEndstateFocusAndSelection(); |
287 | 285 |
288 void didFail(const blink::ResourceError&, bool wasProvisional); | 286 void didFail(const ResourceError&, bool wasProvisional); |
289 | 287 |
290 // Sets whether the WebLocalFrameImpl allows its document to be scrolled. | 288 // Sets whether the WebLocalFrameImpl allows its document to be scrolled. |
291 // If the parameter is true, allow the document to be scrolled. | 289 // If the parameter is true, allow the document to be scrolled. |
292 // Otherwise, disallow scrolling. | 290 // Otherwise, disallow scrolling. |
293 virtual void setCanHaveScrollbars(bool) OVERRIDE; | 291 virtual void setCanHaveScrollbars(bool) OVERRIDE; |
294 | 292 |
295 blink::LocalFrame* frame() const { return m_frame.get(); } | 293 LocalFrame* frame() const { return m_frame.get(); } |
296 WebFrameClient* client() const { return m_client; } | 294 WebFrameClient* client() const { return m_client; } |
297 void setClient(WebFrameClient* client) { m_client = client; } | 295 void setClient(WebFrameClient* client) { m_client = client; } |
298 | 296 |
299 WebPermissionClient* permissionClient() { return m_permissionClient; } | 297 WebPermissionClient* permissionClient() { return m_permissionClient; } |
300 SharedWorkerRepositoryClientImpl* sharedWorkerRepositoryClient() const { ret
urn m_sharedWorkerRepositoryClient.get(); } | 298 SharedWorkerRepositoryClientImpl* sharedWorkerRepositoryClient() const { ret
urn m_sharedWorkerRepositoryClient.get(); } |
301 | 299 |
302 void setInputEventsTransformForEmulation(const blink::IntSize&, float); | 300 void setInputEventsTransformForEmulation(const IntSize&, float); |
303 | 301 |
304 static void selectWordAroundPosition(blink::LocalFrame*, blink::VisiblePosit
ion); | 302 static void selectWordAroundPosition(LocalFrame*, VisiblePosition); |
305 | 303 |
306 // Returns the text finder object if it already exists. | 304 // Returns the text finder object if it already exists. |
307 // Otherwise creates it and then returns. | 305 // Otherwise creates it and then returns. |
308 TextFinder& ensureTextFinder(); | 306 TextFinder& ensureTextFinder(); |
309 | 307 |
310 // Invalidates vertical scrollbar only. | 308 // Invalidates vertical scrollbar only. |
311 void invalidateScrollbar() const; | 309 void invalidateScrollbar() const; |
312 | 310 |
313 // Invalidates both content area and the scrollbar. | 311 // Invalidates both content area and the scrollbar. |
314 void invalidateAll() const; | 312 void invalidateAll() const; |
315 | 313 |
316 // Returns a hit-tested VisiblePosition for the given point | 314 // Returns a hit-tested VisiblePosition for the given point |
317 blink::VisiblePosition visiblePositionForWindowPoint(const WebPoint&); | 315 VisiblePosition visiblePositionForWindowPoint(const WebPoint&); |
318 | 316 |
319 private: | 317 private: |
320 friend class FrameLoaderClientImpl; | 318 friend class FrameLoaderClientImpl; |
321 | 319 |
322 explicit WebLocalFrameImpl(WebFrameClient*); | 320 explicit WebLocalFrameImpl(WebFrameClient*); |
323 | 321 |
324 // Sets the local WebCore frame and registers destruction observers. | 322 // Sets the local WebCore frame and registers destruction observers. |
325 void setWebCoreFrame(PassRefPtr<blink::LocalFrame>); | 323 void setWebCoreFrame(PassRefPtr<LocalFrame>); |
326 | 324 |
327 void loadJavaScriptURL(const blink::KURL&); | 325 void loadJavaScriptURL(const KURL&); |
328 | 326 |
329 WebPlugin* focusedPluginIfInputMethodSupported(); | 327 WebPlugin* focusedPluginIfInputMethodSupported(); |
330 | 328 |
331 FrameLoaderClientImpl m_frameLoaderClientImpl; | 329 FrameLoaderClientImpl m_frameLoaderClientImpl; |
332 | 330 |
333 // The embedder retains a reference to the WebCore LocalFrame while it is ac
tive in the DOM. This | 331 // The embedder retains a reference to the WebCore LocalFrame while it is ac
tive in the DOM. This |
334 // reference is released when the frame is removed from the DOM or the entir
e page is closed. | 332 // reference is released when the frame is removed from the DOM or the entir
e page is closed. |
335 // FIXME: These will need to change to WebFrame when we introduce WebFramePr
oxy. | 333 // FIXME: These will need to change to WebFrame when we introduce WebFramePr
oxy. |
336 RefPtr<blink::LocalFrame> m_frame; | 334 RefPtr<LocalFrame> m_frame; |
337 | 335 |
338 // Indicate whether the current LocalFrame is local or remote. Remote frames
are | 336 // Indicate whether the current LocalFrame is local or remote. Remote frames
are |
339 // rendered in a different process from their parent frames. | 337 // rendered in a different process from their parent frames. |
340 bool m_isRemote; | 338 bool m_isRemote; |
341 | 339 |
342 WebFrameClient* m_client; | 340 WebFrameClient* m_client; |
343 WebPermissionClient* m_permissionClient; | 341 WebPermissionClient* m_permissionClient; |
344 OwnPtr<SharedWorkerRepositoryClientImpl> m_sharedWorkerRepositoryClient; | 342 OwnPtr<SharedWorkerRepositoryClientImpl> m_sharedWorkerRepositoryClient; |
345 | 343 |
346 // Will be initialized after first call to find() or scopeStringMatches(). | 344 // Will be initialized after first call to find() or scopeStringMatches(). |
347 OwnPtr<TextFinder> m_textFinder; | 345 OwnPtr<TextFinder> m_textFinder; |
348 | 346 |
349 // Valid between calls to BeginPrint() and EndPrint(). Containts the print | 347 // Valid between calls to BeginPrint() and EndPrint(). Containts the print |
350 // information. Is used by PrintPage(). | 348 // information. Is used by PrintPage(). |
351 OwnPtrWillBePersistent<ChromePrintContext> m_printContext; | 349 OwnPtrWillBePersistent<ChromePrintContext> m_printContext; |
352 | 350 |
353 // Stores the additional input events offset and scale when device metrics e
mulation is enabled. | 351 // Stores the additional input events offset and scale when device metrics e
mulation is enabled. |
354 blink::IntSize m_inputEventsOffsetForEmulation; | 352 IntSize m_inputEventsOffsetForEmulation; |
355 float m_inputEventsScaleFactorForEmulation; | 353 float m_inputEventsScaleFactorForEmulation; |
356 | 354 |
357 UserMediaClientImpl m_userMediaClientImpl; | 355 UserMediaClientImpl m_userMediaClientImpl; |
358 | 356 |
359 OwnPtr<GeolocationClientProxy> m_geolocationClientProxy; | 357 OwnPtr<GeolocationClientProxy> m_geolocationClientProxy; |
360 }; | 358 }; |
361 | 359 |
362 DEFINE_TYPE_CASTS(WebLocalFrameImpl, WebFrame, frame, frame->isWebLocalFrame(),
frame.isWebLocalFrame()); | 360 DEFINE_TYPE_CASTS(WebLocalFrameImpl, WebFrame, frame, frame->isWebLocalFrame(),
frame.isWebLocalFrame()); |
363 | 361 |
364 } // namespace blink | 362 } // namespace blink |
365 | 363 |
366 #endif | 364 #endif |
OLD | NEW |