Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(745)

Side by Side Diff: third_party/WebKit/Source/web/RemoteFrameClientImpl.cpp

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "web/RemoteFrameClientImpl.h" 5 #include "web/RemoteFrameClientImpl.h"
6 6
7 #include "core/events/KeyboardEvent.h" 7 #include "core/events/KeyboardEvent.h"
8 #include "core/events/MouseEvent.h" 8 #include "core/events/MouseEvent.h"
9 #include "core/events/WheelEvent.h" 9 #include "core/events/WheelEvent.h"
10 #include "core/frame/RemoteFrame.h" 10 #include "core/frame/RemoteFrame.h"
11 #include "core/frame/RemoteFrameView.h" 11 #include "core/frame/RemoteFrameView.h"
12 #include "core/layout/LayoutPart.h" 12 #include "core/layout/LayoutPart.h"
13 #include "core/layout/api/LayoutItem.h" 13 #include "core/layout/api/LayoutItem.h"
14 #include "platform/exported/WrappedResourceRequest.h" 14 #include "platform/exported/WrappedResourceRequest.h"
15 #include "platform/weborigin/SecurityOrigin.h" 15 #include "platform/weborigin/SecurityOrigin.h"
16 #include "platform/weborigin/SecurityPolicy.h" 16 #include "platform/weborigin/SecurityPolicy.h"
17 #include "public/web/WebRemoteFrameClient.h" 17 #include "public/web/WebRemoteFrameClient.h"
18 #include "web/WebInputEventConversion.h" 18 #include "web/WebInputEventConversion.h"
19 #include "web/WebLocalFrameImpl.h" 19 #include "web/WebLocalFrameImpl.h"
20 #include "web/WebRemoteFrameImpl.h" 20 #include "web/WebRemoteFrameImpl.h"
21 #include "wtf/PtrUtil.h"
22 #include <memory>
23 21
24 namespace blink { 22 namespace blink {
25 23
26 namespace { 24 namespace {
27 25
28 // Convenience helper for frame tree helpers in FrameClient to reduce the amount 26 // Convenience helper for frame tree helpers in FrameClient to reduce the amount
29 // of null-checking boilerplate code. Since the frame tree is maintained in the 27 // of null-checking boilerplate code. Since the frame tree is maintained in the
30 // web/ layer, the frame tree helpers often have to deal with null WebFrames: 28 // web/ layer, the frame tree helpers often have to deal with null WebFrames:
31 // for example, a frame with no parent will return null for WebFrame::parent(). 29 // for example, a frame with no parent will return null for WebFrame::parent().
32 // TODO(dcheng): Remove duplication between FrameLoaderClientImpl and 30 // TODO(dcheng): Remove duplication between FrameLoaderClientImpl and
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 // We might need to revisit this after browser hit testing is fully 165 // We might need to revisit this after browser hit testing is fully
168 // implemented, since this code path will need to be removed or refactored 166 // implemented, since this code path will need to be removed or refactored
169 // anyway. 167 // anyway.
170 // See https://crbug.com/520705. 168 // See https://crbug.com/520705.
171 if (!m_webFrame->toImplBase()->frame()->ownerLayoutObject()) 169 if (!m_webFrame->toImplBase()->frame()->ownerLayoutObject())
172 return; 170 return;
173 171
174 // This is only called when we have out-of-process iframes, which 172 // This is only called when we have out-of-process iframes, which
175 // need to forward input events across processes. 173 // need to forward input events across processes.
176 // FIXME: Add a check for out-of-process iframes enabled. 174 // FIXME: Add a check for out-of-process iframes enabled.
177 std::unique_ptr<WebInputEvent> webEvent; 175 OwnPtr<WebInputEvent> webEvent;
178 if (event->isKeyboardEvent()) 176 if (event->isKeyboardEvent())
179 webEvent = wrapUnique(new WebKeyboardEventBuilder(*static_cast<KeyboardE vent*>(event))); 177 webEvent = adoptPtr(new WebKeyboardEventBuilder(*static_cast<KeyboardEve nt*>(event)));
180 else if (event->isMouseEvent()) 178 else if (event->isMouseEvent())
181 webEvent = wrapUnique(new WebMouseEventBuilder(m_webFrame->frame()->view (), LayoutItem(m_webFrame->toImplBase()->frame()->ownerLayoutObject()), *static_ cast<MouseEvent*>(event))); 179 webEvent = adoptPtr(new WebMouseEventBuilder(m_webFrame->frame()->view() , LayoutItem(m_webFrame->toImplBase()->frame()->ownerLayoutObject()), *static_ca st<MouseEvent*>(event)));
182 180
183 // Other or internal Blink events should not be forwarded. 181 // Other or internal Blink events should not be forwarded.
184 if (!webEvent || webEvent->type == WebInputEvent::Undefined) 182 if (!webEvent || webEvent->type == WebInputEvent::Undefined)
185 return; 183 return;
186 184
187 m_webFrame->client()->forwardInputEvent(webEvent.get()); 185 m_webFrame->client()->forwardInputEvent(webEvent.get());
188 } 186 }
189 187
190 void RemoteFrameClientImpl::frameRectsChanged(const IntRect& frameRect) 188 void RemoteFrameClientImpl::frameRectsChanged(const IntRect& frameRect)
191 { 189 {
192 m_webFrame->client()->frameRectsChanged(frameRect); 190 m_webFrame->client()->frameRectsChanged(frameRect);
193 } 191 }
194 192
195 void RemoteFrameClientImpl::advanceFocus(WebFocusType type, LocalFrame* source) 193 void RemoteFrameClientImpl::advanceFocus(WebFocusType type, LocalFrame* source)
196 { 194 {
197 m_webFrame->client()->advanceFocus(type, WebLocalFrameImpl::fromFrame(source )); 195 m_webFrame->client()->advanceFocus(type, WebLocalFrameImpl::fromFrame(source ));
198 } 196 }
199 197
200 void RemoteFrameClientImpl::visibilityChanged(bool visible) 198 void RemoteFrameClientImpl::visibilityChanged(bool visible)
201 { 199 {
202 m_webFrame->client()->visibilityChanged(visible); 200 m_webFrame->client()->visibilityChanged(visible);
203 } 201 }
204 202
205 } // namespace blink 203 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/PageWidgetDelegate.h ('k') | third_party/WebKit/Source/web/ServiceWorkerGlobalScopeClientImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698