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

Side by Side Diff: webkit/compositor_bindings/WebToCCInputHandlerAdapter.cpp

Issue 11192050: Rename compositor bindings filenames to Chromium style (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "config.h"
6
7 #include "WebToCCInputHandlerAdapter.h"
8
9 #include "cc/stubs/int_point.h"
10 #include "cc/stubs/int_size.h"
11 #include "third_party/WebKit/Source/Platform/chromium/public/WebInputHandlerClie nt.h"
12 #include "webcore_convert.h"
13
14 #define COMPILE_ASSERT_MATCHING_ENUM(webkit_name, cc_name) \
15 COMPILE_ASSERT(int(WebKit::webkit_name) == int(cc::cc_name), mismatching_enu ms)
16
17 COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollStatusOnMainThread, CC InputHandlerClient::ScrollOnMainThread);
18 COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollStatusStarted, CCInput HandlerClient::ScrollStarted);
19 COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollStatusIgnored, CCInput HandlerClient::ScrollIgnored);
20 COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollInputTypeGesture, CCIn putHandlerClient::Gesture);
21 COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollInputTypeWheel, CCInpu tHandlerClient::Wheel);
22
23 namespace WebKit {
24
25 scoped_ptr<WebToCCInputHandlerAdapter> WebToCCInputHandlerAdapter::create(scoped _ptr<WebInputHandler> handler)
26 {
27 return scoped_ptr<WebToCCInputHandlerAdapter>(new WebToCCInputHandlerAdapter (handler.Pass()));
28 }
29
30 WebToCCInputHandlerAdapter::WebToCCInputHandlerAdapter(scoped_ptr<WebInputHandle r> handler)
31 : m_handler(handler.Pass())
32 {
33 }
34
35 WebToCCInputHandlerAdapter::~WebToCCInputHandlerAdapter()
36 {
37 }
38
39 class WebToCCInputHandlerAdapter::ClientAdapter : public WebInputHandlerClient {
40 public:
41 ClientAdapter(cc::CCInputHandlerClient* client)
42 : m_client(client)
43 {
44 }
45
46 virtual ~ClientAdapter()
47 {
48 }
49
50 virtual ScrollStatus scrollBegin(WebPoint point, ScrollInputType type) OVERR IDE
51 {
52 return static_cast<WebInputHandlerClient::ScrollStatus>(m_client->scroll Begin(convert(point), static_cast<cc::CCInputHandlerClient::ScrollInputType>(typ e)));
53 }
54
55 virtual void scrollBy(WebPoint point, WebSize offset) OVERRIDE
56 {
57 m_client->scrollBy(convert(point), convert(offset));
58 }
59
60 virtual void scrollEnd() OVERRIDE
61 {
62 m_client->scrollEnd();
63 }
64
65 virtual void pinchGestureBegin() OVERRIDE
66 {
67 m_client->pinchGestureBegin();
68 }
69
70 virtual void pinchGestureUpdate(float magnifyDelta, WebPoint anchor) OVERRID E
71 {
72 m_client->pinchGestureUpdate(magnifyDelta, convert(anchor));
73 }
74
75 virtual void pinchGestureEnd() OVERRIDE
76 {
77 m_client->pinchGestureEnd();
78 }
79
80 virtual void startPageScaleAnimation(WebSize targetPosition,
81 bool anchorPoint,
82 float pageScale,
83 double startTime,
84 double duration) OVERRIDE
85 {
86 m_client->startPageScaleAnimation(convert(targetPosition), anchorPoint, pageScale, startTime, duration);
87 }
88
89 virtual void scheduleAnimation() OVERRIDE
90 {
91 m_client->scheduleAnimation();
92 }
93
94 private:
95 cc::CCInputHandlerClient* m_client;
96 };
97
98
99 void WebToCCInputHandlerAdapter::bindToClient(cc::CCInputHandlerClient* client)
100 {
101 m_clientAdapter.reset(new ClientAdapter(client));
102 m_handler->bindToClient(m_clientAdapter.get());
103 }
104
105 void WebToCCInputHandlerAdapter::animate(double monotonicTime)
106 {
107 m_handler->animate(monotonicTime);
108 }
109
110 }
OLDNEW
« no previous file with comments | « webkit/compositor_bindings/WebToCCInputHandlerAdapter.h ('k') | webkit/compositor_bindings/WebTransformAnimationCurveImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698