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

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

Issue 2867073005: Provide downcasts for WebLocalFrameBase using DEFINE_TYPE_CASTS macro. (Closed)
Patch Set: Created 3 years, 7 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/WebFrameWidgetBase.h" 5 #include "web/WebFrameWidgetBase.h"
6 6
7 #include "core/dom/DocumentUserGestureToken.h" 7 #include "core/dom/DocumentUserGestureToken.h"
8 #include "core/exported/WebViewBase.h" 8 #include "core/exported/WebViewBase.h"
9 #include "core/frame/FrameView.h" 9 #include "core/frame/FrameView.h"
10 #include "core/frame/VisualViewport.h" 10 #include "core/frame/VisualViewport.h"
11 #include "core/frame/WebLocalFrameBase.h"
11 #include "core/input/EventHandler.h" 12 #include "core/input/EventHandler.h"
12 #include "core/page/DragActions.h" 13 #include "core/page/DragActions.h"
13 #include "core/page/DragController.h" 14 #include "core/page/DragController.h"
14 #include "core/page/DragData.h" 15 #include "core/page/DragData.h"
15 #include "core/page/DragSession.h" 16 #include "core/page/DragSession.h"
16 #include "core/page/Page.h" 17 #include "core/page/Page.h"
17 #include "core/page/PointerLockController.h" 18 #include "core/page/PointerLockController.h"
18 #include "platform/UserGestureIndicator.h" 19 #include "platform/UserGestureIndicator.h"
19 #include "public/web/WebAutofillClient.h" 20 #include "public/web/WebAutofillClient.h"
20 #include "public/web/WebDocument.h" 21 #include "public/web/WebDocument.h"
21 #include "public/web/WebWidgetClient.h" 22 #include "public/web/WebWidgetClient.h"
22 #include "web/WebInputEventConversion.h" 23 #include "web/WebInputEventConversion.h"
23 #include "web/WebLocalFrameImpl.h"
24 24
25 namespace blink { 25 namespace blink {
26 26
27 namespace { 27 namespace {
28 28
29 // Helper to get LocalFrame* from WebLocalFrame*. 29 // Helper to get LocalFrame* from WebLocalFrame*.
30 // TODO(dcheng): This should be moved into WebLocalFrame. 30 // TODO(dcheng): This should be moved into WebLocalFrame.
31 LocalFrame* ToCoreFrame(WebLocalFrame* frame) { 31 LocalFrame* ToCoreFrame(WebLocalFrame* frame) {
32 return ToWebLocalFrameImpl(frame)->GetFrame(); 32 return ToWebLocalFrameBase(frame)->GetFrame();
33 } 33 }
34 34
35 } // namespace 35 } // namespace
36 36
37 // Ensure that the WebDragOperation enum values stay in sync with the original 37 // Ensure that the WebDragOperation enum values stay in sync with the original
38 // DragOperation constants. 38 // DragOperation constants.
39 #define STATIC_ASSERT_ENUM(a, b) \ 39 #define STATIC_ASSERT_ENUM(a, b) \
40 static_assert(static_cast<int>(a) == static_cast<int>(b), \ 40 static_assert(static_cast<int>(a) == static_cast<int>(b), \
41 "mismatching enum : " #a) 41 "mismatching enum : " #a)
42 STATIC_ASSERT_ENUM(kDragOperationNone, kWebDragOperationNone); 42 STATIC_ASSERT_ENUM(kDragOperationNone, kWebDragOperationNone);
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 221
222 return drag_operation_; 222 return drag_operation_;
223 } 223 }
224 224
225 WebPoint WebFrameWidgetBase::ViewportToRootFrame( 225 WebPoint WebFrameWidgetBase::ViewportToRootFrame(
226 const WebPoint& point_in_viewport) const { 226 const WebPoint& point_in_viewport) const {
227 return GetPage()->GetVisualViewport().ViewportToRootFrame(point_in_viewport); 227 return GetPage()->GetVisualViewport().ViewportToRootFrame(point_in_viewport);
228 } 228 }
229 229
230 WebViewBase* WebFrameWidgetBase::View() const { 230 WebViewBase* WebFrameWidgetBase::View() const {
231 return ToWebLocalFrameImpl(LocalRoot())->ViewImpl(); 231 return ToWebLocalFrameBase(LocalRoot())->ViewImpl();
232 } 232 }
233 233
234 Page* WebFrameWidgetBase::GetPage() const { 234 Page* WebFrameWidgetBase::GetPage() const {
235 return View()->GetPage(); 235 return View()->GetPage();
236 } 236 }
237 237
238 void WebFrameWidgetBase::DidAcquirePointerLock() { 238 void WebFrameWidgetBase::DidAcquirePointerLock() {
239 GetPage()->GetPointerLockController().DidAcquirePointerLock(); 239 GetPage()->GetPointerLockController().DidAcquirePointerLock();
240 } 240 }
241 241
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 event_type = EventTypeNames::mousemove; 273 event_type = EventTypeNames::mousemove;
274 break; 274 break;
275 default: 275 default:
276 NOTREACHED(); 276 NOTREACHED();
277 } 277 }
278 278
279 const WebMouseEvent& mouse_event = static_cast<const WebMouseEvent&>(event); 279 const WebMouseEvent& mouse_event = static_cast<const WebMouseEvent&>(event);
280 280
281 if (GetPage()) { 281 if (GetPage()) {
282 WebMouseEvent transformed_event = TransformWebMouseEvent( 282 WebMouseEvent transformed_event = TransformWebMouseEvent(
283 ToWebLocalFrameImpl(LocalRoot())->GetFrameView(), mouse_event); 283 ToWebLocalFrameBase(LocalRoot())->GetFrameView(), mouse_event);
284 GetPage()->GetPointerLockController().DispatchLockedMouseEvent( 284 GetPage()->GetPointerLockController().DispatchLockedMouseEvent(
285 transformed_event, event_type); 285 transformed_event, event_type);
286 } 286 }
287 } 287 }
288 288
289 } // namespace blink 289 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebFrameContentDumper.cpp ('k') | third_party/WebKit/Source/web/WebLocalFrameImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698