| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2011 Apple Inc. All rights reserved. | 3 * Copyright (C) 2011 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 #include "web/WebDevToolsAgentPrivate.h" | 90 #include "web/WebDevToolsAgentPrivate.h" |
| 91 #include "web/WebLocalFrameImpl.h" | 91 #include "web/WebLocalFrameImpl.h" |
| 92 #include "web/WebPluginContainerImpl.h" | 92 #include "web/WebPluginContainerImpl.h" |
| 93 #include "web/WebPluginLoadObserver.h" | 93 #include "web/WebPluginLoadObserver.h" |
| 94 #include "web/WebViewImpl.h" | 94 #include "web/WebViewImpl.h" |
| 95 #include "wtf/StringExtras.h" | 95 #include "wtf/StringExtras.h" |
| 96 #include "wtf/text/CString.h" | 96 #include "wtf/text/CString.h" |
| 97 #include "wtf/text/WTFString.h" | 97 #include "wtf/text/WTFString.h" |
| 98 #include <v8.h> | 98 #include <v8.h> |
| 99 | 99 |
| 100 using namespace blink; | |
| 101 | |
| 102 namespace blink { | 100 namespace blink { |
| 103 | 101 |
| 104 FrameLoaderClientImpl::FrameLoaderClientImpl(WebLocalFrameImpl* frame) | 102 FrameLoaderClientImpl::FrameLoaderClientImpl(WebLocalFrameImpl* frame) |
| 105 : m_webFrame(frame) | 103 : m_webFrame(frame) |
| 106 { | 104 { |
| 107 } | 105 } |
| 108 | 106 |
| 109 FrameLoaderClientImpl::~FrameLoaderClientImpl() | 107 FrameLoaderClientImpl::~FrameLoaderClientImpl() |
| 110 { | 108 { |
| 111 } | 109 } |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 if (!client) | 301 if (!client) |
| 304 return; | 302 return; |
| 305 | 303 |
| 306 m_webFrame->willDetachParent(); | 304 m_webFrame->willDetachParent(); |
| 307 | 305 |
| 308 // Signal that no further communication with WebFrameClient should take | 306 // Signal that no further communication with WebFrameClient should take |
| 309 // place at this point since we are no longer associated with the Page. | 307 // place at this point since we are no longer associated with the Page. |
| 310 m_webFrame->setClient(0); | 308 m_webFrame->setClient(0); |
| 311 | 309 |
| 312 client->frameDetached(m_webFrame); | 310 client->frameDetached(m_webFrame); |
| 313 // Clear our reference to blink::LocalFrame at the very end, in case the cli
ent | 311 // Clear our reference to LocalFrame at the very end, in case the client |
| 314 // refers to it. | 312 // refers to it. |
| 315 m_webFrame->setWebCoreFrame(nullptr); | 313 m_webFrame->setWebCoreFrame(nullptr); |
| 316 } | 314 } |
| 317 | 315 |
| 318 void FrameLoaderClientImpl::dispatchWillSendRequest( | 316 void FrameLoaderClientImpl::dispatchWillSendRequest( |
| 319 DocumentLoader* loader, unsigned long identifier, ResourceRequest& request, | 317 DocumentLoader* loader, unsigned long identifier, ResourceRequest& request, |
| 320 const ResourceResponse& redirectResponse) | 318 const ResourceResponse& redirectResponse) |
| 321 { | 319 { |
| 322 // Give the WebFrameClient a crack at the request. | 320 // Give the WebFrameClient a crack at the request. |
| 323 if (m_webFrame->client()) { | 321 if (m_webFrame->client()) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 334 { | 332 { |
| 335 if (m_webFrame->client()) { | 333 if (m_webFrame->client()) { |
| 336 WrappedResourceResponse webresp(response); | 334 WrappedResourceResponse webresp(response); |
| 337 m_webFrame->client()->didReceiveResponse(m_webFrame, identifier, webresp
); | 335 m_webFrame->client()->didReceiveResponse(m_webFrame, identifier, webresp
); |
| 338 } | 336 } |
| 339 } | 337 } |
| 340 | 338 |
| 341 void FrameLoaderClientImpl::dispatchDidChangeResourcePriority(unsigned long iden
tifier, ResourceLoadPriority priority, int intraPriorityValue) | 339 void FrameLoaderClientImpl::dispatchDidChangeResourcePriority(unsigned long iden
tifier, ResourceLoadPriority priority, int intraPriorityValue) |
| 342 { | 340 { |
| 343 if (m_webFrame->client()) | 341 if (m_webFrame->client()) |
| 344 m_webFrame->client()->didChangeResourcePriority(m_webFrame, identifier,
static_cast<blink::WebURLRequest::Priority>(priority), intraPriorityValue); | 342 m_webFrame->client()->didChangeResourcePriority(m_webFrame, identifier,
static_cast<WebURLRequest::Priority>(priority), intraPriorityValue); |
| 345 } | 343 } |
| 346 | 344 |
| 347 // Called when a particular resource load completes | 345 // Called when a particular resource load completes |
| 348 void FrameLoaderClientImpl::dispatchDidFinishLoading(DocumentLoader* loader, | 346 void FrameLoaderClientImpl::dispatchDidFinishLoading(DocumentLoader* loader, |
| 349 unsigned long identifier) | 347 unsigned long identifier) |
| 350 { | 348 { |
| 351 if (m_webFrame->client()) | 349 if (m_webFrame->client()) |
| 352 m_webFrame->client()->didFinishResourceLoad(m_webFrame, identifier); | 350 m_webFrame->client()->didFinishResourceLoad(m_webFrame, identifier); |
| 353 } | 351 } |
| 354 | 352 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 if (m_webFrame->client()) | 393 if (m_webFrame->client()) |
| 396 m_webFrame->client()->didStartProvisionalLoad(m_webFrame, isTransitionNa
vigation); | 394 m_webFrame->client()->didStartProvisionalLoad(m_webFrame, isTransitionNa
vigation); |
| 397 } | 395 } |
| 398 | 396 |
| 399 void FrameLoaderClientImpl::dispatchDidReceiveTitle(const String& title) | 397 void FrameLoaderClientImpl::dispatchDidReceiveTitle(const String& title) |
| 400 { | 398 { |
| 401 if (m_webFrame->client()) | 399 if (m_webFrame->client()) |
| 402 m_webFrame->client()->didReceiveTitle(m_webFrame, title, WebTextDirectio
nLeftToRight); | 400 m_webFrame->client()->didReceiveTitle(m_webFrame, title, WebTextDirectio
nLeftToRight); |
| 403 } | 401 } |
| 404 | 402 |
| 405 void FrameLoaderClientImpl::dispatchDidChangeIcons(blink::IconType type) | 403 void FrameLoaderClientImpl::dispatchDidChangeIcons(IconType type) |
| 406 { | 404 { |
| 407 if (m_webFrame->client()) | 405 if (m_webFrame->client()) |
| 408 m_webFrame->client()->didChangeIcon(m_webFrame, static_cast<WebIconURL::
Type>(type)); | 406 m_webFrame->client()->didChangeIcon(m_webFrame, static_cast<WebIconURL::
Type>(type)); |
| 409 } | 407 } |
| 410 | 408 |
| 411 void FrameLoaderClientImpl::dispatchDidCommitLoad(LocalFrame* frame, HistoryItem
* item, HistoryCommitType commitType) | 409 void FrameLoaderClientImpl::dispatchDidCommitLoad(LocalFrame* frame, HistoryItem
* item, HistoryCommitType commitType) |
| 412 { | 410 { |
| 413 m_webFrame->viewImpl()->didCommitLoad(commitType == StandardCommit, false); | 411 m_webFrame->viewImpl()->didCommitLoad(commitType == StandardCommit, false); |
| 414 if (m_webFrame->client()) | 412 if (m_webFrame->client()) |
| 415 m_webFrame->client()->didCommitProvisionalLoad(m_webFrame, WebHistoryIte
m(item), static_cast<WebHistoryCommitType>(commitType)); | 413 m_webFrame->client()->didCommitProvisionalLoad(m_webFrame, WebHistoryIte
m(item), static_cast<WebHistoryCommitType>(commitType)); |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 m_webFrame->client()->didCreateDataSource(m_webFrame, ds.get()); | 593 m_webFrame->client()->didCreateDataSource(m_webFrame, ds.get()); |
| 596 return ds.release(); | 594 return ds.release(); |
| 597 } | 595 } |
| 598 | 596 |
| 599 String FrameLoaderClientImpl::userAgent(const KURL& url) | 597 String FrameLoaderClientImpl::userAgent(const KURL& url) |
| 600 { | 598 { |
| 601 WebString override = m_webFrame->client()->userAgentOverride(m_webFrame, Web
URL(url)); | 599 WebString override = m_webFrame->client()->userAgentOverride(m_webFrame, Web
URL(url)); |
| 602 if (!override.isEmpty()) | 600 if (!override.isEmpty()) |
| 603 return override; | 601 return override; |
| 604 | 602 |
| 605 return blink::Platform::current()->userAgent(); | 603 return Platform::current()->userAgent(); |
| 606 } | 604 } |
| 607 | 605 |
| 608 String FrameLoaderClientImpl::doNotTrackValue() | 606 String FrameLoaderClientImpl::doNotTrackValue() |
| 609 { | 607 { |
| 610 WebString doNotTrack = m_webFrame->client()->doNotTrackValue(m_webFrame); | 608 WebString doNotTrack = m_webFrame->client()->doNotTrackValue(m_webFrame); |
| 611 if (!doNotTrack.isEmpty()) | 609 if (!doNotTrack.isEmpty()) |
| 612 return doNotTrack; | 610 return doNotTrack; |
| 613 return String(); | 611 return String(); |
| 614 } | 612 } |
| 615 | 613 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 if (!m_webFrame->client()) | 756 if (!m_webFrame->client()) |
| 759 return; | 757 return; |
| 760 m_webFrame->client()->didChangeName(m_webFrame, name); | 758 m_webFrame->client()->didChangeName(m_webFrame, name); |
| 761 } | 759 } |
| 762 | 760 |
| 763 void FrameLoaderClientImpl::dispatchWillOpenSocketStream(SocketStreamHandle* han
dle) | 761 void FrameLoaderClientImpl::dispatchWillOpenSocketStream(SocketStreamHandle* han
dle) |
| 764 { | 762 { |
| 765 m_webFrame->client()->willOpenSocketStream(SocketStreamHandleInternal::toWeb
SocketStreamHandle(handle)); | 763 m_webFrame->client()->willOpenSocketStream(SocketStreamHandleInternal::toWeb
SocketStreamHandle(handle)); |
| 766 } | 764 } |
| 767 | 765 |
| 768 void FrameLoaderClientImpl::dispatchWillOpenWebSocket(blink::WebSocketHandle* ha
ndle) | 766 void FrameLoaderClientImpl::dispatchWillOpenWebSocket(WebSocketHandle* handle) |
| 769 { | 767 { |
| 770 m_webFrame->client()->willOpenWebSocket(handle); | 768 m_webFrame->client()->willOpenWebSocket(handle); |
| 771 } | 769 } |
| 772 | 770 |
| 773 void FrameLoaderClientImpl::dispatchWillStartUsingPeerConnectionHandler(blink::W
ebRTCPeerConnectionHandler* handler) | 771 void FrameLoaderClientImpl::dispatchWillStartUsingPeerConnectionHandler(WebRTCPe
erConnectionHandler* handler) |
| 774 { | 772 { |
| 775 m_webFrame->client()->willStartUsingPeerConnectionHandler(webFrame(), handle
r); | 773 m_webFrame->client()->willStartUsingPeerConnectionHandler(webFrame(), handle
r); |
| 776 } | 774 } |
| 777 | 775 |
| 778 void FrameLoaderClientImpl::didRequestAutocomplete(HTMLFormElement* form) | 776 void FrameLoaderClientImpl::didRequestAutocomplete(HTMLFormElement* form) |
| 779 { | 777 { |
| 780 if (m_webFrame->viewImpl() && m_webFrame->viewImpl()->autofillClient()) | 778 if (m_webFrame->viewImpl() && m_webFrame->viewImpl()->autofillClient()) |
| 781 m_webFrame->viewImpl()->autofillClient()->didRequestAutocomplete(WebForm
Element(form)); | 779 m_webFrame->viewImpl()->autofillClient()->didRequestAutocomplete(WebForm
Element(form)); |
| 782 } | 780 } |
| 783 | 781 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 829 m_webFrame->client()->didAbortLoading(m_webFrame); | 827 m_webFrame->client()->didAbortLoading(m_webFrame); |
| 830 } | 828 } |
| 831 | 829 |
| 832 void FrameLoaderClientImpl::dispatchDidChangeManifest() | 830 void FrameLoaderClientImpl::dispatchDidChangeManifest() |
| 833 { | 831 { |
| 834 if (m_webFrame->client()) | 832 if (m_webFrame->client()) |
| 835 m_webFrame->client()->didChangeManifest(m_webFrame); | 833 m_webFrame->client()->didChangeManifest(m_webFrame); |
| 836 } | 834 } |
| 837 | 835 |
| 838 } // namespace blink | 836 } // namespace blink |
| OLD | NEW |