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

Side by Side Diff: webkit/compositor_bindings/web_to_ccinput_handler_adapter.cc

Issue 12648005: cc: Chromify the LayerTreeHostImpl class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Compl Created 7 years, 9 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
« no previous file with comments | « webkit/compositor_bindings/web_to_ccinput_handler_adapter.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 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 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 "webkit/compositor_bindings/web_to_ccinput_handler_adapter.h" 5 #include "webkit/compositor_bindings/web_to_ccinput_handler_adapter.h"
6 6
7 #include "third_party/WebKit/Source/Platform/chromium/public/WebInputHandlerClie nt.h" 7 #include "third_party/WebKit/Source/Platform/chromium/public/WebInputHandlerClie nt.h"
8 8
9 #define COMPILE_ASSERT_MATCHING_ENUM(webkit_name, cc_name) \ 9 #define COMPILE_ASSERT_MATCHING_ENUM(webkit_name, cc_name) \
10 COMPILE_ASSERT(int(WebKit::webkit_name) == int(cc::cc_name), \ 10 COMPILE_ASSERT(int(WebKit::webkit_name) == int(cc::cc_name), \
(...skipping 25 matching lines...) Expand all
36 WebToCCInputHandlerAdapter::~WebToCCInputHandlerAdapter() {} 36 WebToCCInputHandlerAdapter::~WebToCCInputHandlerAdapter() {}
37 37
38 class WebToCCInputHandlerAdapter::ClientAdapter : public WebInputHandlerClient { 38 class WebToCCInputHandlerAdapter::ClientAdapter : public WebInputHandlerClient {
39 public: 39 public:
40 ClientAdapter(cc::InputHandlerClient* client) : client_(client) {} 40 ClientAdapter(cc::InputHandlerClient* client) : client_(client) {}
41 41
42 virtual ~ClientAdapter() {} 42 virtual ~ClientAdapter() {}
43 43
44 virtual ScrollStatus scrollBegin(WebPoint point, ScrollInputType type) { 44 virtual ScrollStatus scrollBegin(WebPoint point, ScrollInputType type) {
45 return static_cast<WebInputHandlerClient::ScrollStatus>( 45 return static_cast<WebInputHandlerClient::ScrollStatus>(
46 client_->scrollBegin( 46 client_->ScrollBegin(
47 point, static_cast<cc::InputHandlerClient::ScrollInputType>(type))); 47 point, static_cast<cc::InputHandlerClient::ScrollInputType>(type)));
48 } 48 }
49 49
50 virtual bool scrollByIfPossible(WebPoint point, WebFloatSize delta) { 50 virtual bool scrollByIfPossible(WebPoint point, WebFloatSize delta) {
51 return client_->scrollBy(point, delta); 51 return client_->ScrollBy(point, delta);
52 } 52 }
53 53
54 virtual void scrollEnd() { client_->scrollEnd(); } 54 virtual void scrollEnd() { client_->ScrollEnd(); }
55 55
56 virtual void pinchGestureBegin() { client_->pinchGestureBegin(); } 56 virtual void pinchGestureBegin() { client_->PinchGestureBegin(); }
57 57
58 virtual void pinchGestureUpdate(float magnify_delta, WebPoint anchor) { 58 virtual void pinchGestureUpdate(float magnify_delta, WebPoint anchor) {
59 client_->pinchGestureUpdate(magnify_delta, anchor); 59 client_->PinchGestureUpdate(magnify_delta, anchor);
60 } 60 }
61 61
62 virtual void pinchGestureEnd() { client_->pinchGestureEnd(); } 62 virtual void pinchGestureEnd() { client_->PinchGestureEnd(); }
63 63
64 virtual void startPageScaleAnimation(WebSize target_position, 64 virtual void startPageScaleAnimation(WebSize target_position,
65 bool anchor_point, 65 bool anchor_point,
66 float page_scale, 66 float page_scale,
67 double start_time_sec, 67 double start_time_sec,
68 double duration_sec) { 68 double duration_sec) {
69 base::TimeTicks start_time = base::TimeTicks::FromInternalValue( 69 base::TimeTicks start_time = base::TimeTicks::FromInternalValue(
70 start_time_sec * base::Time::kMicrosecondsPerSecond); 70 start_time_sec * base::Time::kMicrosecondsPerSecond);
71 base::TimeDelta duration = base::TimeDelta::FromMicroseconds( 71 base::TimeDelta duration = base::TimeDelta::FromMicroseconds(
72 duration_sec * base::Time::kMicrosecondsPerSecond); 72 duration_sec * base::Time::kMicrosecondsPerSecond);
73 client_->startPageScaleAnimation( 73 client_->StartPageScaleAnimation(
74 target_position, anchor_point, page_scale, start_time, duration); 74 target_position, anchor_point, page_scale, start_time, duration);
75 } 75 }
76 76
77 virtual void scheduleAnimation() { client_->scheduleAnimation(); } 77 virtual void scheduleAnimation() { client_->ScheduleAnimation(); }
78 78
79 virtual bool haveTouchEventHandlersAt(WebPoint point) { 79 virtual bool haveTouchEventHandlersAt(WebPoint point) {
80 return client_->haveTouchEventHandlersAt(point); 80 return client_->HaveTouchEventHandlersAt(point);
81 } 81 }
82 82
83 private: 83 private:
84 cc::InputHandlerClient* client_; 84 cc::InputHandlerClient* client_;
85 }; 85 };
86 86
87 void WebToCCInputHandlerAdapter::bindToClient(cc::InputHandlerClient* client) { 87 void WebToCCInputHandlerAdapter::BindToClient(cc::InputHandlerClient* client) {
88 client_adapter_.reset(new ClientAdapter(client)); 88 client_adapter_.reset(new ClientAdapter(client));
89 handler_->bindToClient(client_adapter_.get()); 89 handler_->bindToClient(client_adapter_.get());
90 } 90 }
91 91
92 void WebToCCInputHandlerAdapter::animate(base::TimeTicks time) { 92 void WebToCCInputHandlerAdapter::Animate(base::TimeTicks time) {
93 double monotonic_time_seconds = (time - base::TimeTicks()).InSecondsF(); 93 double monotonic_time_seconds = (time - base::TimeTicks()).InSecondsF();
94 handler_->animate(monotonic_time_seconds); 94 handler_->animate(monotonic_time_seconds);
95 } 95 }
96 96
97 void WebToCCInputHandlerAdapter::mainThreadHasStoppedFlinging() { 97 void WebToCCInputHandlerAdapter::MainThreadHasStoppedFlinging() {
98 handler_->mainThreadHasStoppedFlinging(); 98 handler_->mainThreadHasStoppedFlinging();
99 } 99 }
100 100
101 } // namespace WebKit 101 } // namespace WebKit
OLDNEW
« no previous file with comments | « webkit/compositor_bindings/web_to_ccinput_handler_adapter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698