| 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 25 matching lines...) Expand all Loading... |
| 36 #include "public/platform/WebFileSystemType.h" | 36 #include "public/platform/WebFileSystemType.h" |
| 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 WebCore { | 46 namespace blink { |
| 47 class GraphicsContext; | 47 class GraphicsContext; |
| 48 class HTMLInputElement; | 48 class HTMLInputElement; |
| 49 class HistoryItem; | 49 class HistoryItem; |
| 50 class IntSize; | 50 class IntSize; |
| 51 class KURL; | 51 class KURL; |
| 52 class Node; | 52 class Node; |
| 53 class Range; | 53 class Range; |
| 54 class SubstituteData; | 54 class SubstituteData; |
| 55 struct FrameLoadRequest; | 55 struct FrameLoadRequest; |
| 56 struct WindowFeatures; | 56 struct WindowFeatures; |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 virtual WebString layerTreeAsText(bool showDebugInfo = false) const OVERRIDE
; | 228 virtual WebString layerTreeAsText(bool showDebugInfo = false) const OVERRIDE
; |
| 229 | 229 |
| 230 // WebLocalFrame methods: | 230 // WebLocalFrame methods: |
| 231 virtual void addStyleSheetByURL(const WebString& url) OVERRIDE; | 231 virtual void addStyleSheetByURL(const WebString& url) OVERRIDE; |
| 232 | 232 |
| 233 void willDetachParent(); | 233 void willDetachParent(); |
| 234 | 234 |
| 235 static WebLocalFrameImpl* create(WebFrameClient*); | 235 static WebLocalFrameImpl* create(WebFrameClient*); |
| 236 virtual ~WebLocalFrameImpl(); | 236 virtual ~WebLocalFrameImpl(); |
| 237 | 237 |
| 238 PassRefPtr<WebCore::LocalFrame> initializeWebCoreFrame(WebCore::FrameHost*,
WebCore::FrameOwner*, const AtomicString& name, const AtomicString& fallbackName
); | 238 PassRefPtr<blink::LocalFrame> initializeWebCoreFrame(blink::FrameHost*, blin
k::FrameOwner*, const AtomicString& name, const AtomicString& fallbackName); |
| 239 | 239 |
| 240 PassRefPtr<WebCore::LocalFrame> createChildFrame( | 240 PassRefPtr<blink::LocalFrame> createChildFrame( |
| 241 const WebCore::FrameLoadRequest&, WebCore::HTMLFrameOwnerElement*); | 241 const blink::FrameLoadRequest&, blink::HTMLFrameOwnerElement*); |
| 242 | 242 |
| 243 void didChangeContentsSize(const WebCore::IntSize&); | 243 void didChangeContentsSize(const blink::IntSize&); |
| 244 | 244 |
| 245 void createFrameView(); | 245 void createFrameView(); |
| 246 | 246 |
| 247 static WebLocalFrameImpl* fromFrame(WebCore::LocalFrame*); | 247 static WebLocalFrameImpl* fromFrame(blink::LocalFrame*); |
| 248 static WebLocalFrameImpl* fromFrame(WebCore::LocalFrame&); | 248 static WebLocalFrameImpl* fromFrame(blink::LocalFrame&); |
| 249 static WebLocalFrameImpl* fromFrameOwnerElement(WebCore::Element*); | 249 static WebLocalFrameImpl* fromFrameOwnerElement(blink::Element*); |
| 250 | 250 |
| 251 // 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 |
| 252 // that hosts the plugin. | 252 // that hosts the plugin. |
| 253 static WebPluginContainerImpl* pluginContainerFromFrame(WebCore::LocalFrame*
); | 253 static WebPluginContainerImpl* pluginContainerFromFrame(blink::LocalFrame*); |
| 254 | 254 |
| 255 // 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 |
| 256 // 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 |
| 257 // WebPluginContainerImpl. | 257 // WebPluginContainerImpl. |
| 258 static WebPluginContainerImpl* pluginContainerFromNode(WebCore::LocalFrame*,
const WebNode&); | 258 static WebPluginContainerImpl* pluginContainerFromNode(blink::LocalFrame*, c
onst WebNode&); |
| 259 | 259 |
| 260 WebViewImpl* viewImpl() const; | 260 WebViewImpl* viewImpl() const; |
| 261 | 261 |
| 262 WebCore::FrameView* frameView() const { return frame() ? frame()->view() : 0
; } | 262 blink::FrameView* frameView() const { return frame() ? frame()->view() : 0;
} |
| 263 | 263 |
| 264 // Getters for the impls corresponding to Get(Provisional)DataSource. They | 264 // Getters for the impls corresponding to Get(Provisional)DataSource. They |
| 265 // may return 0 if there is no corresponding data source. | 265 // may return 0 if there is no corresponding data source. |
| 266 WebDataSourceImpl* dataSourceImpl() const; | 266 WebDataSourceImpl* dataSourceImpl() const; |
| 267 WebDataSourceImpl* provisionalDataSourceImpl() const; | 267 WebDataSourceImpl* provisionalDataSourceImpl() const; |
| 268 | 268 |
| 269 // 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 |
| 270 // 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 |
| 271 // value can be 0 if no frame has an active match. | 271 // value can be 0 if no frame has an active match. |
| 272 WebLocalFrameImpl* activeMatchFrame() const; | 272 WebLocalFrameImpl* activeMatchFrame() const; |
| 273 | 273 |
| 274 // 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 |
| 275 // the local frame has no active match. | 275 // the local frame has no active match. |
| 276 WebCore::Range* activeMatch() const; | 276 blink::Range* activeMatch() const; |
| 277 | 277 |
| 278 // 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 |
| 279 // 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 |
| 280 // 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 |
| 281 // 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 |
| 282 // 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 |
| 283 // 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. |
| 284 void setFindEndstateFocusAndSelection(); | 284 void setFindEndstateFocusAndSelection(); |
| 285 | 285 |
| 286 void didFail(const WebCore::ResourceError&, bool wasProvisional); | 286 void didFail(const blink::ResourceError&, bool wasProvisional); |
| 287 | 287 |
| 288 // Sets whether the WebLocalFrameImpl allows its document to be scrolled. | 288 // Sets whether the WebLocalFrameImpl allows its document to be scrolled. |
| 289 // If the parameter is true, allow the document to be scrolled. | 289 // If the parameter is true, allow the document to be scrolled. |
| 290 // Otherwise, disallow scrolling. | 290 // Otherwise, disallow scrolling. |
| 291 virtual void setCanHaveScrollbars(bool) OVERRIDE; | 291 virtual void setCanHaveScrollbars(bool) OVERRIDE; |
| 292 | 292 |
| 293 WebCore::LocalFrame* frame() const { return m_frame.get(); } | 293 blink::LocalFrame* frame() const { return m_frame.get(); } |
| 294 WebFrameClient* client() const { return m_client; } | 294 WebFrameClient* client() const { return m_client; } |
| 295 void setClient(WebFrameClient* client) { m_client = client; } | 295 void setClient(WebFrameClient* client) { m_client = client; } |
| 296 | 296 |
| 297 WebPermissionClient* permissionClient() { return m_permissionClient; } | 297 WebPermissionClient* permissionClient() { return m_permissionClient; } |
| 298 SharedWorkerRepositoryClientImpl* sharedWorkerRepositoryClient() const { ret
urn m_sharedWorkerRepositoryClient.get(); } | 298 SharedWorkerRepositoryClientImpl* sharedWorkerRepositoryClient() const { ret
urn m_sharedWorkerRepositoryClient.get(); } |
| 299 | 299 |
| 300 void setInputEventsTransformForEmulation(const WebCore::IntSize&, float); | 300 void setInputEventsTransformForEmulation(const blink::IntSize&, float); |
| 301 | 301 |
| 302 static void selectWordAroundPosition(WebCore::LocalFrame*, WebCore::VisibleP
osition); | 302 static void selectWordAroundPosition(blink::LocalFrame*, blink::VisiblePosit
ion); |
| 303 | 303 |
| 304 // Returns the text finder object if it already exists. | 304 // Returns the text finder object if it already exists. |
| 305 // Otherwise creates it and then returns. | 305 // Otherwise creates it and then returns. |
| 306 TextFinder& ensureTextFinder(); | 306 TextFinder& ensureTextFinder(); |
| 307 | 307 |
| 308 // Invalidates vertical scrollbar only. | 308 // Invalidates vertical scrollbar only. |
| 309 void invalidateScrollbar() const; | 309 void invalidateScrollbar() const; |
| 310 | 310 |
| 311 // Invalidates both content area and the scrollbar. | 311 // Invalidates both content area and the scrollbar. |
| 312 void invalidateAll() const; | 312 void invalidateAll() const; |
| 313 | 313 |
| 314 // Returns a hit-tested VisiblePosition for the given point | 314 // Returns a hit-tested VisiblePosition for the given point |
| 315 WebCore::VisiblePosition visiblePositionForWindowPoint(const WebPoint&); | 315 blink::VisiblePosition visiblePositionForWindowPoint(const WebPoint&); |
| 316 | 316 |
| 317 private: | 317 private: |
| 318 friend class FrameLoaderClientImpl; | 318 friend class FrameLoaderClientImpl; |
| 319 | 319 |
| 320 explicit WebLocalFrameImpl(WebFrameClient*); | 320 explicit WebLocalFrameImpl(WebFrameClient*); |
| 321 | 321 |
| 322 // Sets the local WebCore frame and registers destruction observers. | 322 // Sets the local WebCore frame and registers destruction observers. |
| 323 void setWebCoreFrame(PassRefPtr<WebCore::LocalFrame>); | 323 void setWebCoreFrame(PassRefPtr<blink::LocalFrame>); |
| 324 | 324 |
| 325 void loadJavaScriptURL(const WebCore::KURL&); | 325 void loadJavaScriptURL(const blink::KURL&); |
| 326 | 326 |
| 327 WebPlugin* focusedPluginIfInputMethodSupported(); | 327 WebPlugin* focusedPluginIfInputMethodSupported(); |
| 328 | 328 |
| 329 FrameLoaderClientImpl m_frameLoaderClientImpl; | 329 FrameLoaderClientImpl m_frameLoaderClientImpl; |
| 330 | 330 |
| 331 // 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 |
| 332 // 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. |
| 333 // 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. |
| 334 RefPtr<WebCore::LocalFrame> m_frame; | 334 RefPtr<blink::LocalFrame> m_frame; |
| 335 | 335 |
| 336 // 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 |
| 337 // rendered in a different process from their parent frames. | 337 // rendered in a different process from their parent frames. |
| 338 bool m_isRemote; | 338 bool m_isRemote; |
| 339 | 339 |
| 340 WebFrameClient* m_client; | 340 WebFrameClient* m_client; |
| 341 WebPermissionClient* m_permissionClient; | 341 WebPermissionClient* m_permissionClient; |
| 342 OwnPtr<SharedWorkerRepositoryClientImpl> m_sharedWorkerRepositoryClient; | 342 OwnPtr<SharedWorkerRepositoryClientImpl> m_sharedWorkerRepositoryClient; |
| 343 | 343 |
| 344 // Will be initialized after first call to find() or scopeStringMatches(). | 344 // Will be initialized after first call to find() or scopeStringMatches(). |
| 345 OwnPtr<TextFinder> m_textFinder; | 345 OwnPtr<TextFinder> m_textFinder; |
| 346 | 346 |
| 347 // Valid between calls to BeginPrint() and EndPrint(). Containts the print | 347 // Valid between calls to BeginPrint() and EndPrint(). Containts the print |
| 348 // information. Is used by PrintPage(). | 348 // information. Is used by PrintPage(). |
| 349 OwnPtrWillBePersistent<ChromePrintContext> m_printContext; | 349 OwnPtrWillBePersistent<ChromePrintContext> m_printContext; |
| 350 | 350 |
| 351 // 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. |
| 352 WebCore::IntSize m_inputEventsOffsetForEmulation; | 352 blink::IntSize m_inputEventsOffsetForEmulation; |
| 353 float m_inputEventsScaleFactorForEmulation; | 353 float m_inputEventsScaleFactorForEmulation; |
| 354 | 354 |
| 355 UserMediaClientImpl m_userMediaClientImpl; | 355 UserMediaClientImpl m_userMediaClientImpl; |
| 356 | 356 |
| 357 OwnPtr<GeolocationClientProxy> m_geolocationClientProxy; | 357 OwnPtr<GeolocationClientProxy> m_geolocationClientProxy; |
| 358 }; | 358 }; |
| 359 | 359 |
| 360 DEFINE_TYPE_CASTS(WebLocalFrameImpl, WebFrame, frame, frame->isWebLocalFrame(),
frame.isWebLocalFrame()); | 360 DEFINE_TYPE_CASTS(WebLocalFrameImpl, WebFrame, frame, frame->isWebLocalFrame(),
frame.isWebLocalFrame()); |
| 361 | 361 |
| 362 } // namespace blink | 362 } // namespace blink |
| 363 | 363 |
| 364 #endif | 364 #endif |
| OLD | NEW |