| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 return frame ? frame->toImplBase()->frame() : nullptr; | 122 return frame ? frame->toImplBase()->frame() : nullptr; |
| 123 } | 123 } |
| 124 | 124 |
| 125 } // namespace | 125 } // namespace |
| 126 | 126 |
| 127 FrameLoaderClientImpl::FrameLoaderClientImpl(WebLocalFrameImpl* frame) | 127 FrameLoaderClientImpl::FrameLoaderClientImpl(WebLocalFrameImpl* frame) |
| 128 : m_webFrame(frame) | 128 : m_webFrame(frame) |
| 129 { | 129 { |
| 130 } | 130 } |
| 131 | 131 |
| 132 PassOwnPtrWillBeRawPtr<FrameLoaderClientImpl> FrameLoaderClientImpl::create(WebL
ocalFrameImpl* frame) | 132 RawPtr<FrameLoaderClientImpl> FrameLoaderClientImpl::create(WebLocalFrameImpl* f
rame) |
| 133 { | 133 { |
| 134 return adoptPtrWillBeNoop(new FrameLoaderClientImpl(frame)); | 134 return (new FrameLoaderClientImpl(frame)); |
| 135 } | 135 } |
| 136 | 136 |
| 137 FrameLoaderClientImpl::~FrameLoaderClientImpl() | 137 FrameLoaderClientImpl::~FrameLoaderClientImpl() |
| 138 { | 138 { |
| 139 } | 139 } |
| 140 | 140 |
| 141 DEFINE_TRACE(FrameLoaderClientImpl) | 141 DEFINE_TRACE(FrameLoaderClientImpl) |
| 142 { | 142 { |
| 143 visitor->trace(m_webFrame); | 143 visitor->trace(m_webFrame); |
| 144 FrameLoaderClient::trace(visitor); | 144 FrameLoaderClient::trace(visitor); |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 | 361 |
| 362 void FrameLoaderClientImpl::willBeDetached() | 362 void FrameLoaderClientImpl::willBeDetached() |
| 363 { | 363 { |
| 364 m_webFrame->willBeDetached(); | 364 m_webFrame->willBeDetached(); |
| 365 } | 365 } |
| 366 | 366 |
| 367 void FrameLoaderClientImpl::detached(FrameDetachType type) | 367 void FrameLoaderClientImpl::detached(FrameDetachType type) |
| 368 { | 368 { |
| 369 // Alert the client that the frame is being detached. This is the last | 369 // Alert the client that the frame is being detached. This is the last |
| 370 // chance we have to communicate with the client. | 370 // chance we have to communicate with the client. |
| 371 RefPtrWillBeRawPtr<WebLocalFrameImpl> protector(m_webFrame.get()); | 371 RawPtr<WebLocalFrameImpl> protector(m_webFrame.get()); |
| 372 | 372 |
| 373 WebFrameClient* client = m_webFrame->client(); | 373 WebFrameClient* client = m_webFrame->client(); |
| 374 if (!client) | 374 if (!client) |
| 375 return; | 375 return; |
| 376 | 376 |
| 377 m_webFrame->willDetachParent(); | 377 m_webFrame->willDetachParent(); |
| 378 | 378 |
| 379 // Signal that no further communication with WebFrameClient should take | 379 // Signal that no further communication with WebFrameClient should take |
| 380 // place at this point since we are no longer associated with the Page. | 380 // place at this point since we are no longer associated with the Page. |
| 381 m_webFrame->setClient(0); | 381 m_webFrame->setClient(0); |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 if (m_webFrame->client()) | 713 if (m_webFrame->client()) |
| 714 m_webFrame->client()->didChangePerformanceTiming(); | 714 m_webFrame->client()->didChangePerformanceTiming(); |
| 715 } | 715 } |
| 716 | 716 |
| 717 void FrameLoaderClientImpl::selectorMatchChanged(const Vector<String>& addedSele
ctors, const Vector<String>& removedSelectors) | 717 void FrameLoaderClientImpl::selectorMatchChanged(const Vector<String>& addedSele
ctors, const Vector<String>& removedSelectors) |
| 718 { | 718 { |
| 719 if (WebFrameClient* client = m_webFrame->client()) | 719 if (WebFrameClient* client = m_webFrame->client()) |
| 720 client->didMatchCSS(m_webFrame, WebVector<WebString>(addedSelectors), We
bVector<WebString>(removedSelectors)); | 720 client->didMatchCSS(m_webFrame, WebVector<WebString>(addedSelectors), We
bVector<WebString>(removedSelectors)); |
| 721 } | 721 } |
| 722 | 722 |
| 723 PassRefPtrWillBeRawPtr<DocumentLoader> FrameLoaderClientImpl::createDocumentLoad
er(LocalFrame* frame, const ResourceRequest& request, const SubstituteData& data
) | 723 RawPtr<DocumentLoader> FrameLoaderClientImpl::createDocumentLoader(LocalFrame* f
rame, const ResourceRequest& request, const SubstituteData& data) |
| 724 { | 724 { |
| 725 RefPtrWillBeRawPtr<WebDataSourceImpl> ds = WebDataSourceImpl::create(frame,
request, data); | 725 RawPtr<WebDataSourceImpl> ds = WebDataSourceImpl::create(frame, request, dat
a); |
| 726 if (m_webFrame->client()) | 726 if (m_webFrame->client()) |
| 727 m_webFrame->client()->didCreateDataSource(m_webFrame, ds.get()); | 727 m_webFrame->client()->didCreateDataSource(m_webFrame, ds.get()); |
| 728 return ds.release(); | 728 return ds.release(); |
| 729 } | 729 } |
| 730 | 730 |
| 731 String FrameLoaderClientImpl::userAgent() | 731 String FrameLoaderClientImpl::userAgent() |
| 732 { | 732 { |
| 733 WebString override = m_webFrame->client()->userAgentOverride(m_webFrame); | 733 WebString override = m_webFrame->client()->userAgentOverride(m_webFrame); |
| 734 if (!override.isEmpty()) | 734 if (!override.isEmpty()) |
| 735 return override; | 735 return override; |
| 736 | 736 |
| 737 return Platform::current()->userAgent(); | 737 return Platform::current()->userAgent(); |
| 738 } | 738 } |
| 739 | 739 |
| 740 String FrameLoaderClientImpl::doNotTrackValue() | 740 String FrameLoaderClientImpl::doNotTrackValue() |
| 741 { | 741 { |
| 742 WebString doNotTrack = m_webFrame->client()->doNotTrackValue(m_webFrame); | 742 WebString doNotTrack = m_webFrame->client()->doNotTrackValue(m_webFrame); |
| 743 if (!doNotTrack.isEmpty()) | 743 if (!doNotTrack.isEmpty()) |
| 744 return doNotTrack; | 744 return doNotTrack; |
| 745 return String(); | 745 return String(); |
| 746 } | 746 } |
| 747 | 747 |
| 748 // Called when the FrameLoader goes into a state in which a new page load | 748 // Called when the FrameLoader goes into a state in which a new page load |
| 749 // will occur. | 749 // will occur. |
| 750 void FrameLoaderClientImpl::transitionToCommittedForNewPage() | 750 void FrameLoaderClientImpl::transitionToCommittedForNewPage() |
| 751 { | 751 { |
| 752 m_webFrame->createFrameView(); | 752 m_webFrame->createFrameView(); |
| 753 } | 753 } |
| 754 | 754 |
| 755 PassRefPtrWillBeRawPtr<LocalFrame> FrameLoaderClientImpl::createFrame( | 755 RawPtr<LocalFrame> FrameLoaderClientImpl::createFrame( |
| 756 const FrameLoadRequest& request, | 756 const FrameLoadRequest& request, |
| 757 const AtomicString& name, | 757 const AtomicString& name, |
| 758 HTMLFrameOwnerElement* ownerElement) | 758 HTMLFrameOwnerElement* ownerElement) |
| 759 { | 759 { |
| 760 return m_webFrame->createChildFrame(request, name, ownerElement); | 760 return m_webFrame->createChildFrame(request, name, ownerElement); |
| 761 } | 761 } |
| 762 | 762 |
| 763 bool FrameLoaderClientImpl::canCreatePluginWithoutRenderer(const String& mimeTyp
e) const | 763 bool FrameLoaderClientImpl::canCreatePluginWithoutRenderer(const String& mimeTyp
e) const |
| 764 { | 764 { |
| 765 if (!m_webFrame->client()) | 765 if (!m_webFrame->client()) |
| 766 return false; | 766 return false; |
| 767 | 767 |
| 768 return m_webFrame->client()->canCreatePluginWithoutRenderer(mimeType); | 768 return m_webFrame->client()->canCreatePluginWithoutRenderer(mimeType); |
| 769 } | 769 } |
| 770 | 770 |
| 771 PassRefPtrWillBeRawPtr<Widget> FrameLoaderClientImpl::createPlugin( | 771 RawPtr<Widget> FrameLoaderClientImpl::createPlugin( |
| 772 HTMLPlugInElement* element, | 772 HTMLPlugInElement* element, |
| 773 const KURL& url, | 773 const KURL& url, |
| 774 const Vector<String>& paramNames, | 774 const Vector<String>& paramNames, |
| 775 const Vector<String>& paramValues, | 775 const Vector<String>& paramValues, |
| 776 const String& mimeType, | 776 const String& mimeType, |
| 777 bool loadManually, | 777 bool loadManually, |
| 778 DetachedPluginPolicy policy) | 778 DetachedPluginPolicy policy) |
| 779 { | 779 { |
| 780 if (!m_webFrame->client()) | 780 if (!m_webFrame->client()) |
| 781 return nullptr; | 781 return nullptr; |
| 782 | 782 |
| 783 WebPluginParams params; | 783 WebPluginParams params; |
| 784 params.url = url; | 784 params.url = url; |
| 785 params.mimeType = mimeType; | 785 params.mimeType = mimeType; |
| 786 params.attributeNames = paramNames; | 786 params.attributeNames = paramNames; |
| 787 params.attributeValues = paramValues; | 787 params.attributeValues = paramValues; |
| 788 params.loadManually = loadManually; | 788 params.loadManually = loadManually; |
| 789 | 789 |
| 790 WebPlugin* webPlugin = m_webFrame->client()->createPlugin(m_webFrame, params
); | 790 WebPlugin* webPlugin = m_webFrame->client()->createPlugin(m_webFrame, params
); |
| 791 if (!webPlugin) | 791 if (!webPlugin) |
| 792 return nullptr; | 792 return nullptr; |
| 793 | 793 |
| 794 // The container takes ownership of the WebPlugin. | 794 // The container takes ownership of the WebPlugin. |
| 795 RefPtrWillBeRawPtr<WebPluginContainerImpl> container = | 795 RawPtr<WebPluginContainerImpl> container = |
| 796 WebPluginContainerImpl::create(element, webPlugin); | 796 WebPluginContainerImpl::create(element, webPlugin); |
| 797 | 797 |
| 798 if (!webPlugin->initialize(container.get())) | 798 if (!webPlugin->initialize(container.get())) |
| 799 return nullptr; | 799 return nullptr; |
| 800 | 800 |
| 801 if (policy != AllowDetachedPlugin && !element->layoutObject()) | 801 if (policy != AllowDetachedPlugin && !element->layoutObject()) |
| 802 return nullptr; | 802 return nullptr; |
| 803 | 803 |
| 804 return container; | 804 return container; |
| 805 } | 805 } |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1023 | 1023 |
| 1024 void FrameLoaderClientImpl::suddenTerminationDisablerChanged(bool present, Sudde
nTerminationDisablerType type) | 1024 void FrameLoaderClientImpl::suddenTerminationDisablerChanged(bool present, Sudde
nTerminationDisablerType type) |
| 1025 { | 1025 { |
| 1026 if (m_webFrame->client()) { | 1026 if (m_webFrame->client()) { |
| 1027 m_webFrame->client()->suddenTerminationDisablerChanged( | 1027 m_webFrame->client()->suddenTerminationDisablerChanged( |
| 1028 present, static_cast<WebFrameClient::SuddenTerminationDisablerType>(
type)); | 1028 present, static_cast<WebFrameClient::SuddenTerminationDisablerType>(
type)); |
| 1029 } | 1029 } |
| 1030 } | 1030 } |
| 1031 | 1031 |
| 1032 } // namespace blink | 1032 } // namespace blink |
| OLD | NEW |