| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/child/webkitplatformsupport_child_impl.h" | 5 #include "webkit/child/webkitplatformsupport_child_impl.h" |
| 6 | 6 |
| 7 #include "base/memory/discardable_memory.h" | 7 #include "base/memory/discardable_memory.h" |
| 8 #include "third_party/WebKit/public/web/WebInputEvent.h" | 8 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 9 #include "webkit/child/fling_curve_configuration.h" | |
| 10 #include "webkit/child/web_discardable_memory_impl.h" | 9 #include "webkit/child/web_discardable_memory_impl.h" |
| 11 #include "webkit/child/webthread_impl.h" | 10 #include "webkit/child/webthread_impl.h" |
| 12 #include "webkit/child/worker_task_runner.h" | 11 #include "webkit/child/worker_task_runner.h" |
| 13 | 12 |
| 14 #if defined(OS_ANDROID) | |
| 15 #include "webkit/child/fling_animator_impl_android.h" | |
| 16 #endif | |
| 17 | |
| 18 using WebKit::WebFallbackThemeEngine; | 13 using WebKit::WebFallbackThemeEngine; |
| 19 using WebKit::WebThemeEngine; | 14 using WebKit::WebThemeEngine; |
| 20 | 15 |
| 21 namespace webkit_glue { | 16 namespace webkit_glue { |
| 22 | 17 |
| 23 WebKitPlatformSupportChildImpl::WebKitPlatformSupportChildImpl() | 18 WebKitPlatformSupportChildImpl::WebKitPlatformSupportChildImpl() |
| 24 : current_thread_slot_(&DestroyCurrentThread), | 19 : current_thread_slot_(&DestroyCurrentThread) {} |
| 25 fling_curve_configuration_(new FlingCurveConfiguration) {} | |
| 26 | 20 |
| 27 WebKitPlatformSupportChildImpl::~WebKitPlatformSupportChildImpl() {} | 21 WebKitPlatformSupportChildImpl::~WebKitPlatformSupportChildImpl() {} |
| 28 | 22 |
| 29 WebThemeEngine* WebKitPlatformSupportChildImpl::themeEngine() { | 23 WebThemeEngine* WebKitPlatformSupportChildImpl::themeEngine() { |
| 30 return &native_theme_engine_; | 24 return &native_theme_engine_; |
| 31 } | 25 } |
| 32 | 26 |
| 33 WebFallbackThemeEngine* WebKitPlatformSupportChildImpl::fallbackThemeEngine() { | 27 WebFallbackThemeEngine* WebKitPlatformSupportChildImpl::fallbackThemeEngine() { |
| 34 return &fallback_theme_engine_; | 28 return &fallback_theme_engine_; |
| 35 } | 29 } |
| 36 | 30 |
| 37 void WebKitPlatformSupportChildImpl::SetFlingCurveParameters( | |
| 38 const std::vector<float>& new_touchpad, | |
| 39 const std::vector<float>& new_touchscreen) { | |
| 40 fling_curve_configuration_->SetCurveParameters(new_touchpad, new_touchscreen); | |
| 41 } | |
| 42 | |
| 43 WebKit::WebGestureCurve* | |
| 44 WebKitPlatformSupportChildImpl::createFlingAnimationCurve( | |
| 45 int device_source, | |
| 46 const WebKit::WebFloatPoint& velocity, | |
| 47 const WebKit::WebSize& cumulative_scroll) { | |
| 48 #if defined(OS_ANDROID) | |
| 49 return FlingAnimatorImpl::CreateAndroidGestureCurve(velocity, | |
| 50 cumulative_scroll); | |
| 51 #endif | |
| 52 | |
| 53 if (device_source == WebKit::WebGestureEvent::Touchscreen) | |
| 54 return fling_curve_configuration_->CreateForTouchScreen(velocity, | |
| 55 cumulative_scroll); | |
| 56 | |
| 57 return fling_curve_configuration_->CreateForTouchPad(velocity, | |
| 58 cumulative_scroll); | |
| 59 } | |
| 60 | |
| 61 WebKit::WebThread* WebKitPlatformSupportChildImpl::createThread( | 31 WebKit::WebThread* WebKitPlatformSupportChildImpl::createThread( |
| 62 const char* name) { | 32 const char* name) { |
| 63 return new WebThreadImpl(name); | 33 return new WebThreadImpl(name); |
| 64 } | 34 } |
| 65 | 35 |
| 66 WebKit::WebThread* WebKitPlatformSupportChildImpl::currentThread() { | 36 WebKit::WebThread* WebKitPlatformSupportChildImpl::currentThread() { |
| 67 WebThreadImplForMessageLoop* thread = | 37 WebThreadImplForMessageLoop* thread = |
| 68 static_cast<WebThreadImplForMessageLoop*>(current_thread_slot_.Get()); | 38 static_cast<WebThreadImplForMessageLoop*>(current_thread_slot_.Get()); |
| 69 if (thread) | 39 if (thread) |
| 70 return (thread); | 40 return (thread); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 99 } | 69 } |
| 100 | 70 |
| 101 // static | 71 // static |
| 102 void WebKitPlatformSupportChildImpl::DestroyCurrentThread(void* thread) { | 72 void WebKitPlatformSupportChildImpl::DestroyCurrentThread(void* thread) { |
| 103 WebThreadImplForMessageLoop* impl = | 73 WebThreadImplForMessageLoop* impl = |
| 104 static_cast<WebThreadImplForMessageLoop*>(thread); | 74 static_cast<WebThreadImplForMessageLoop*>(thread); |
| 105 delete impl; | 75 delete impl; |
| 106 } | 76 } |
| 107 | 77 |
| 108 } // namespace webkit_glue | 78 } // namespace webkit_glue |
| OLD | NEW |