| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/frame/RemoteFrame.h" | 5 #include "core/frame/RemoteFrame.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/WindowProxy.h" | 7 #include "bindings/core/v8/WindowProxy.h" |
| 8 #include "bindings/core/v8/WindowProxyManager.h" | 8 #include "bindings/core/v8/WindowProxyManager.h" |
| 9 #include "core/dom/RemoteSecurityContext.h" | 9 #include "core/dom/RemoteSecurityContext.h" |
| 10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
| 11 #include "core/frame/RemoteDOMWindow.h" | 11 #include "core/frame/RemoteDOMWindow.h" |
| 12 #include "core/frame/RemoteFrameClient.h" | 12 #include "core/frame/RemoteFrameClient.h" |
| 13 #include "core/frame/RemoteFrameView.h" | 13 #include "core/frame/RemoteFrameView.h" |
| 14 #include "core/html/HTMLFrameOwnerElement.h" | 14 #include "core/html/HTMLFrameOwnerElement.h" |
| 15 #include "core/loader/FrameLoadRequest.h" | 15 #include "core/loader/FrameLoadRequest.h" |
| 16 #include "core/loader/FrameLoader.h" |
| 16 #include "core/paint/PaintLayer.h" | 17 #include "core/paint/PaintLayer.h" |
| 17 #include "platform/PluginScriptForbiddenScope.h" | 18 #include "platform/PluginScriptForbiddenScope.h" |
| 18 #include "platform/UserGestureIndicator.h" | 19 #include "platform/UserGestureIndicator.h" |
| 19 #include "platform/graphics/GraphicsLayer.h" | 20 #include "platform/graphics/GraphicsLayer.h" |
| 21 #include "platform/network/ResourceRequest.h" |
| 20 #include "platform/weborigin/SecurityPolicy.h" | 22 #include "platform/weborigin/SecurityPolicy.h" |
| 21 #include "public/platform/WebLayer.h" | 23 #include "public/platform/WebLayer.h" |
| 22 | 24 |
| 23 namespace blink { | 25 namespace blink { |
| 24 | 26 |
| 25 inline RemoteFrame::RemoteFrame(RemoteFrameClient* client, FrameHost* host, Fram
eOwner* owner) | 27 inline RemoteFrame::RemoteFrame(RemoteFrameClient* client, FrameHost* host, Fram
eOwner* owner) |
| 26 : Frame(client, host, owner) | 28 : Frame(client, host, owner) |
| 27 , m_view(nullptr) | 29 , m_view(nullptr) |
| 28 , m_securityContext(RemoteSecurityContext::create()) | 30 , m_securityContext(RemoteSecurityContext::create()) |
| 29 , m_domWindow(RemoteDOMWindow::create(*this)) | 31 , m_domWindow(RemoteDOMWindow::create(*this)) |
| (...skipping 29 matching lines...) Expand all Loading... |
| 59 WindowProxy* RemoteFrame::windowProxy(DOMWrapperWorld& world) | 61 WindowProxy* RemoteFrame::windowProxy(DOMWrapperWorld& world) |
| 60 { | 62 { |
| 61 WindowProxy* windowProxy = m_windowProxyManager->windowProxy(world); | 63 WindowProxy* windowProxy = m_windowProxyManager->windowProxy(world); |
| 62 ASSERT(windowProxy); | 64 ASSERT(windowProxy); |
| 63 windowProxy->initializeIfNeeded(); | 65 windowProxy->initializeIfNeeded(); |
| 64 return windowProxy; | 66 return windowProxy; |
| 65 } | 67 } |
| 66 | 68 |
| 67 void RemoteFrame::navigate(Document& originDocument, const KURL& url, bool repla
ceCurrentItem, UserGestureStatus userGestureStatus) | 69 void RemoteFrame::navigate(Document& originDocument, const KURL& url, bool repla
ceCurrentItem, UserGestureStatus userGestureStatus) |
| 68 { | 70 { |
| 69 // The process where this frame actually lives won't have sufficient informa
tion to determine | 71 FrameLoadRequest frameRequest(&originDocument, url); |
| 70 // correct referrer, since it won't have access to the originDocument. Set i
t now. | 72 frameRequest.setReplacesCurrentItem(replaceCurrentItem); |
| 71 ResourceRequest request(url); | 73 frameRequest.resourceRequest().setHasUserGesture(userGestureStatus == UserGe
stureStatus::Active); |
| 72 request.setHTTPReferrer(SecurityPolicy::generateReferrer(originDocument.getR
eferrerPolicy(), url, originDocument.outgoingReferrer())); | 74 navigate(frameRequest); |
| 73 request.setHasUserGesture(userGestureStatus == UserGestureStatus::Active); | |
| 74 client()->navigate(request, replaceCurrentItem); | |
| 75 } | 75 } |
| 76 | 76 |
| 77 void RemoteFrame::navigate(const FrameLoadRequest& passedRequest) | 77 void RemoteFrame::navigate(const FrameLoadRequest& passedRequest) |
| 78 { | 78 { |
| 79 UserGestureStatus gesture = UserGestureIndicator::processingUserGesture() ?
UserGestureStatus::Active : UserGestureStatus::None; | 79 FrameLoadRequest frameRequest(passedRequest); |
| 80 navigate(*passedRequest.originDocument(), passedRequest.resourceRequest().ur
l(), passedRequest.replacesCurrentItem(), gesture); | 80 |
| 81 // The process where this frame actually lives won't have sufficient informa
tion to determine |
| 82 // correct referrer, since it won't have access to the originDocument. Set i
t now. |
| 83 FrameLoader::setReferrerForFrameRequest(frameRequest); |
| 84 |
| 85 frameRequest.resourceRequest().setHasUserGesture(UserGestureIndicator::proce
ssingUserGesture()); |
| 86 client()->navigate(frameRequest.resourceRequest(), frameRequest.replacesCurr
entItem()); |
| 81 } | 87 } |
| 82 | 88 |
| 83 void RemoteFrame::reload(FrameLoadType frameLoadType, ClientRedirectPolicy clien
tRedirectPolicy) | 89 void RemoteFrame::reload(FrameLoadType frameLoadType, ClientRedirectPolicy clien
tRedirectPolicy) |
| 84 { | 90 { |
| 85 client()->reload(frameLoadType, clientRedirectPolicy); | 91 client()->reload(frameLoadType, clientRedirectPolicy); |
| 86 } | 92 } |
| 87 | 93 |
| 88 void RemoteFrame::detach(FrameDetachType type) | 94 void RemoteFrame::detach(FrameDetachType type) |
| 89 { | 95 { |
| 90 PluginScriptForbiddenScope forbidPluginDestructorScripting; | 96 PluginScriptForbiddenScope forbidPluginDestructorScripting; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 ASSERT(owner()); | 190 ASSERT(owner()); |
| 185 toHTMLFrameOwnerElement(owner())->setNeedsCompositingUpdate(); | 191 toHTMLFrameOwnerElement(owner())->setNeedsCompositingUpdate(); |
| 186 } | 192 } |
| 187 | 193 |
| 188 void RemoteFrame::advanceFocus(WebFocusType type, LocalFrame* source) | 194 void RemoteFrame::advanceFocus(WebFocusType type, LocalFrame* source) |
| 189 { | 195 { |
| 190 client()->advanceFocus(type, source); | 196 client()->advanceFocus(type, source); |
| 191 } | 197 } |
| 192 | 198 |
| 193 } // namespace blink | 199 } // namespace blink |
| OLD | NEW |