| 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 27 matching lines...) Expand all Loading... |
| 38 #include "core/dom/Document.h" | 38 #include "core/dom/Document.h" |
| 39 #include "core/dom/Fullscreen.h" | 39 #include "core/dom/Fullscreen.h" |
| 40 #include "core/events/MessageEvent.h" | 40 #include "core/events/MessageEvent.h" |
| 41 #include "core/events/MouseEvent.h" | 41 #include "core/events/MouseEvent.h" |
| 42 #include "core/events/UIEventWithKeyState.h" | 42 #include "core/events/UIEventWithKeyState.h" |
| 43 #include "core/exported/SharedWorkerRepositoryClientImpl.h" | 43 #include "core/exported/SharedWorkerRepositoryClientImpl.h" |
| 44 #include "core/exported/WebDataSourceImpl.h" | 44 #include "core/exported/WebDataSourceImpl.h" |
| 45 #include "core/exported/WebViewBase.h" | 45 #include "core/exported/WebViewBase.h" |
| 46 #include "core/frame/FrameView.h" | 46 #include "core/frame/FrameView.h" |
| 47 #include "core/frame/Settings.h" | 47 #include "core/frame/Settings.h" |
| 48 #include "core/frame/WebLocalFrameBase.h" |
| 48 #include "core/html/HTMLFrameElementBase.h" | 49 #include "core/html/HTMLFrameElementBase.h" |
| 49 #include "core/html/HTMLMediaElement.h" | 50 #include "core/html/HTMLMediaElement.h" |
| 50 #include "core/html/HTMLPlugInElement.h" | 51 #include "core/html/HTMLPlugInElement.h" |
| 51 #include "core/input/EventHandler.h" | 52 #include "core/input/EventHandler.h" |
| 52 #include "core/layout/HitTestResult.h" | 53 #include "core/layout/HitTestResult.h" |
| 53 #include "core/loader/DocumentLoader.h" | 54 #include "core/loader/DocumentLoader.h" |
| 54 #include "core/loader/FrameLoadRequest.h" | 55 #include "core/loader/FrameLoadRequest.h" |
| 55 #include "core/loader/FrameLoader.h" | 56 #include "core/loader/FrameLoader.h" |
| 56 #include "core/loader/HistoryItem.h" | 57 #include "core/loader/HistoryItem.h" |
| 57 #include "core/origin_trials/OriginTrials.h" | 58 #include "core/origin_trials/OriginTrials.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 #include "public/web/WebFormElement.h" | 101 #include "public/web/WebFormElement.h" |
| 101 #include "public/web/WebFrameClient.h" | 102 #include "public/web/WebFrameClient.h" |
| 102 #include "public/web/WebNode.h" | 103 #include "public/web/WebNode.h" |
| 103 #include "public/web/WebPlugin.h" | 104 #include "public/web/WebPlugin.h" |
| 104 #include "public/web/WebPluginParams.h" | 105 #include "public/web/WebPluginParams.h" |
| 105 #include "public/web/WebViewClient.h" | 106 #include "public/web/WebViewClient.h" |
| 106 #include "v8/include/v8.h" | 107 #include "v8/include/v8.h" |
| 107 #include "web/DevToolsEmulator.h" | 108 #include "web/DevToolsEmulator.h" |
| 108 #include "web/WebDevToolsAgentImpl.h" | 109 #include "web/WebDevToolsAgentImpl.h" |
| 109 #include "web/WebDevToolsFrontendImpl.h" | 110 #include "web/WebDevToolsFrontendImpl.h" |
| 110 #include "web/WebLocalFrameImpl.h" | |
| 111 #include "web/WebPluginContainerImpl.h" | 111 #include "web/WebPluginContainerImpl.h" |
| 112 | 112 |
| 113 namespace blink { | 113 namespace blink { |
| 114 | 114 |
| 115 namespace { | 115 namespace { |
| 116 | 116 |
| 117 // Convenience helper for frame tree helpers in FrameClient to reduce the amount | 117 // Convenience helper for frame tree helpers in FrameClient to reduce the amount |
| 118 // of null-checking boilerplate code. Since the frame tree is maintained in the | 118 // of null-checking boilerplate code. Since the frame tree is maintained in the |
| 119 // web/ layer, the frame tree helpers often have to deal with null WebFrames: | 119 // web/ layer, the frame tree helpers often have to deal with null WebFrames: |
| 120 // for example, a frame with no parent will return null for WebFrame::parent(). | 120 // for example, a frame with no parent will return null for WebFrame::parent(). |
| 121 // TODO(dcheng): Remove duplication between LocalFrameClientImpl and | 121 // TODO(dcheng): Remove duplication between LocalFrameClientImpl and |
| 122 // RemoteFrameClientImpl somehow... | 122 // RemoteFrameClientImpl somehow... |
| 123 Frame* ToCoreFrame(WebFrame* frame) { | 123 Frame* ToCoreFrame(WebFrame* frame) { |
| 124 return frame ? WebFrame::ToCoreFrame(*frame) : nullptr; | 124 return frame ? WebFrame::ToCoreFrame(*frame) : nullptr; |
| 125 } | 125 } |
| 126 | 126 |
| 127 // Return the parent of |frame| as a LocalFrame, nullptr when there is no | 127 // Return the parent of |frame| as a LocalFrame, nullptr when there is no |
| 128 // parent or when the parent is a remote frame. | 128 // parent or when the parent is a remote frame. |
| 129 LocalFrame* GetLocalParentFrame(WebLocalFrameImpl* frame) { | 129 LocalFrame* GetLocalParentFrame(WebLocalFrameBase* frame) { |
| 130 WebFrame* parent = frame->Parent(); | 130 WebFrame* parent = frame->Parent(); |
| 131 if (!parent || !parent->IsWebLocalFrame()) | 131 if (!parent || !parent->IsWebLocalFrame()) |
| 132 return nullptr; | 132 return nullptr; |
| 133 | 133 |
| 134 return ToWebLocalFrameImpl(parent)->GetFrame(); | 134 return ToWebLocalFrameBase(parent)->GetFrame(); |
| 135 } | 135 } |
| 136 | 136 |
| 137 // Returns whether the |local_frame| has been loaded using an MHTMLArchive. When | 137 // Returns whether the |local_frame| has been loaded using an MHTMLArchive. When |
| 138 // it is the case, each subframe must use it for loading. | 138 // it is the case, each subframe must use it for loading. |
| 139 bool IsLoadedAsMHTMLArchive(LocalFrame* local_frame) { | 139 bool IsLoadedAsMHTMLArchive(LocalFrame* local_frame) { |
| 140 return local_frame && local_frame->GetDocument()->Fetcher()->Archive(); | 140 return local_frame && local_frame->GetDocument()->Fetcher()->Archive(); |
| 141 } | 141 } |
| 142 | 142 |
| 143 // Returns whether the |local_frame| is in a middle of a back/forward | 143 // Returns whether the |local_frame| is in a middle of a back/forward |
| 144 // navigation. | 144 // navigation. |
| 145 bool IsBackForwardNavigationInProgress(LocalFrame* local_frame) { | 145 bool IsBackForwardNavigationInProgress(LocalFrame* local_frame) { |
| 146 return local_frame && | 146 return local_frame && |
| 147 IsBackForwardLoadType( | 147 IsBackForwardLoadType( |
| 148 local_frame->Loader().GetDocumentLoader()->LoadType()) && | 148 local_frame->Loader().GetDocumentLoader()->LoadType()) && |
| 149 !local_frame->GetDocument()->LoadEventFinished(); | 149 !local_frame->GetDocument()->LoadEventFinished(); |
| 150 } | 150 } |
| 151 | 151 |
| 152 } // namespace | 152 } // namespace |
| 153 | 153 |
| 154 LocalFrameClientImpl::LocalFrameClientImpl(WebLocalFrameImpl* frame) | 154 LocalFrameClientImpl::LocalFrameClientImpl(WebLocalFrameBase* frame) |
| 155 : web_frame_(frame) {} | 155 : web_frame_(frame) {} |
| 156 | 156 |
| 157 LocalFrameClientImpl* LocalFrameClientImpl::Create(WebLocalFrameImpl* frame) { | 157 LocalFrameClientImpl* LocalFrameClientImpl::Create(WebLocalFrameBase* frame) { |
| 158 return new LocalFrameClientImpl(frame); | 158 return new LocalFrameClientImpl(frame); |
| 159 } | 159 } |
| 160 | 160 |
| 161 LocalFrameClientImpl::~LocalFrameClientImpl() {} | 161 LocalFrameClientImpl::~LocalFrameClientImpl() {} |
| 162 | 162 |
| 163 DEFINE_TRACE(LocalFrameClientImpl) { | 163 DEFINE_TRACE(LocalFrameClientImpl) { |
| 164 visitor->Trace(web_frame_); | 164 visitor->Trace(web_frame_); |
| 165 LocalFrameClient::Trace(visitor); | 165 LocalFrameClient::Trace(visitor); |
| 166 } | 166 } |
| 167 | 167 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 187 if (RuntimeEnabledFeatures::presentationEnabled() && | 187 if (RuntimeEnabledFeatures::presentationEnabled() && |
| 188 web_frame_->GetFrame()->GetSettings()->GetPresentationReceiver()) { | 188 web_frame_->GetFrame()->GetSettings()->GetPresentationReceiver()) { |
| 189 // Call this in order to ensure the object is created. | 189 // Call this in order to ensure the object is created. |
| 190 PresentationReceiver::From(*document); | 190 PresentationReceiver::From(*document); |
| 191 } | 191 } |
| 192 } | 192 } |
| 193 } | 193 } |
| 194 // FIXME: when extensions go out of process, this whole concept stops working. | 194 // FIXME: when extensions go out of process, this whole concept stops working. |
| 195 WebDevToolsFrontendImpl* dev_tools_frontend = | 195 WebDevToolsFrontendImpl* dev_tools_frontend = |
| 196 web_frame_->Top()->IsWebLocalFrame() | 196 web_frame_->Top()->IsWebLocalFrame() |
| 197 ? ToWebLocalFrameImpl(web_frame_->Top())->DevToolsFrontend() | 197 ? ToWebLocalFrameBase(web_frame_->Top())->DevToolsFrontend() |
| 198 : nullptr; | 198 : nullptr; |
| 199 if (dev_tools_frontend) | 199 if (dev_tools_frontend) |
| 200 dev_tools_frontend->DidClearWindowObject(web_frame_); | 200 dev_tools_frontend->DidClearWindowObject(web_frame_); |
| 201 } | 201 } |
| 202 | 202 |
| 203 void LocalFrameClientImpl::DocumentElementAvailable() { | 203 void LocalFrameClientImpl::DocumentElementAvailable() { |
| 204 if (web_frame_->Client()) | 204 if (web_frame_->Client()) |
| 205 web_frame_->Client()->DidCreateDocumentElement(web_frame_); | 205 web_frame_->Client()->DidCreateDocumentElement(web_frame_); |
| 206 } | 206 } |
| 207 | 207 |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 if (policy != kAllowDetachedPlugin && !element->GetLayoutObject()) | 775 if (policy != kAllowDetachedPlugin && !element->GetLayoutObject()) |
| 776 return nullptr; | 776 return nullptr; |
| 777 | 777 |
| 778 return container; | 778 return container; |
| 779 } | 779 } |
| 780 | 780 |
| 781 std::unique_ptr<WebMediaPlayer> LocalFrameClientImpl::CreateWebMediaPlayer( | 781 std::unique_ptr<WebMediaPlayer> LocalFrameClientImpl::CreateWebMediaPlayer( |
| 782 HTMLMediaElement& html_media_element, | 782 HTMLMediaElement& html_media_element, |
| 783 const WebMediaPlayerSource& source, | 783 const WebMediaPlayerSource& source, |
| 784 WebMediaPlayerClient* client) { | 784 WebMediaPlayerClient* client) { |
| 785 WebLocalFrameImpl* web_frame = | 785 WebLocalFrameBase* web_frame = |
| 786 WebLocalFrameImpl::FromFrame(html_media_element.GetDocument().GetFrame()); | 786 WebLocalFrameBase::FromFrame(html_media_element.GetDocument().GetFrame()); |
| 787 | 787 |
| 788 if (!web_frame || !web_frame->Client()) | 788 if (!web_frame || !web_frame->Client()) |
| 789 return nullptr; | 789 return nullptr; |
| 790 | 790 |
| 791 HTMLMediaElementEncryptedMedia& encrypted_media = | 791 HTMLMediaElementEncryptedMedia& encrypted_media = |
| 792 HTMLMediaElementEncryptedMedia::From(html_media_element); | 792 HTMLMediaElementEncryptedMedia::From(html_media_element); |
| 793 WebString sink_id( | 793 WebString sink_id( |
| 794 HTMLMediaElementAudioOutputDevice::sinkId(html_media_element)); | 794 HTMLMediaElementAudioOutputDevice::sinkId(html_media_element)); |
| 795 return WTF::WrapUnique(web_frame->Client()->CreateMediaPlayer( | 795 return WTF::WrapUnique(web_frame->Client()->CreateMediaPlayer( |
| 796 source, client, &encrypted_media, | 796 source, client, &encrypted_media, |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 997 bool LocalFrameClientImpl::ShouldUseClientLoFiForRequest( | 997 bool LocalFrameClientImpl::ShouldUseClientLoFiForRequest( |
| 998 const ResourceRequest& request) { | 998 const ResourceRequest& request) { |
| 999 if (web_frame_->Client()) { | 999 if (web_frame_->Client()) { |
| 1000 return web_frame_->Client()->ShouldUseClientLoFiForRequest( | 1000 return web_frame_->Client()->ShouldUseClientLoFiForRequest( |
| 1001 WrappedResourceRequest(request)); | 1001 WrappedResourceRequest(request)); |
| 1002 } | 1002 } |
| 1003 return false; | 1003 return false; |
| 1004 } | 1004 } |
| 1005 | 1005 |
| 1006 WebDevToolsAgentImpl* LocalFrameClientImpl::DevToolsAgent() { | 1006 WebDevToolsAgentImpl* LocalFrameClientImpl::DevToolsAgent() { |
| 1007 return WebLocalFrameImpl::FromFrame(web_frame_->GetFrame()->LocalFrameRoot()) | 1007 return WebLocalFrameBase::FromFrame(web_frame_->GetFrame()->LocalFrameRoot()) |
| 1008 ->DevToolsAgentImpl(); | 1008 ->DevToolsAgentImpl(); |
| 1009 } | 1009 } |
| 1010 | 1010 |
| 1011 KURL LocalFrameClientImpl::OverrideFlashEmbedWithHTML(const KURL& url) { | 1011 KURL LocalFrameClientImpl::OverrideFlashEmbedWithHTML(const KURL& url) { |
| 1012 return web_frame_->Client()->OverrideFlashEmbedWithHTML(WebURL(url)); | 1012 return web_frame_->Client()->OverrideFlashEmbedWithHTML(WebURL(url)); |
| 1013 } | 1013 } |
| 1014 | 1014 |
| 1015 void LocalFrameClientImpl::SetHasReceivedUserGesture(bool received_previously) { | 1015 void LocalFrameClientImpl::SetHasReceivedUserGesture(bool received_previously) { |
| 1016 // The client potentially needs to dispatch the event to other processes only | 1016 // The client potentially needs to dispatch the event to other processes only |
| 1017 // for the first time. | 1017 // for the first time. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1032 void LocalFrameClientImpl::AbortClientNavigation() { | 1032 void LocalFrameClientImpl::AbortClientNavigation() { |
| 1033 if (web_frame_->Client()) | 1033 if (web_frame_->Client()) |
| 1034 web_frame_->Client()->AbortClientNavigation(); | 1034 web_frame_->Client()->AbortClientNavigation(); |
| 1035 } | 1035 } |
| 1036 | 1036 |
| 1037 TextCheckerClient& LocalFrameClientImpl::GetTextCheckerClient() const { | 1037 TextCheckerClient& LocalFrameClientImpl::GetTextCheckerClient() const { |
| 1038 return web_frame_->GetTextCheckerClient(); | 1038 return web_frame_->GetTextCheckerClient(); |
| 1039 } | 1039 } |
| 1040 | 1040 |
| 1041 } // namespace blink | 1041 } // namespace blink |
| OLD | NEW |