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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_ANDROID_COMPOSITED_TOUCH_HANDLE_DRAWABLE_H_
6 #define CONTENT_BROWSER_ANDROID_COMPOSITED_TOUCH_HANDLE_DRAWABLE_H_
8 #include "content/browser/renderer_host/input/touch_handle.h"
10 #include "base/android/jni_android.h"
11 #include "cc/layers/ui_resource_layer.h"
15 // Touch handle drawable implementation backed by a cc layer.
16 class CompositedTouchHandleDrawable
: public TouchHandleDrawable
{
18 CompositedTouchHandleDrawable(cc::Layer
* root_layer
,
21 virtual ~CompositedTouchHandleDrawable();
23 // TouchHandleDrawable implementation.
24 virtual void SetEnabled(bool enabled
) override
;
25 virtual void SetOrientation(TouchHandleOrientation orientation
) override
;
26 virtual void SetAlpha(float alpha
) override
;
27 virtual void SetFocus(const gfx::PointF
& position
) override
;
28 virtual void SetVisible(bool visible
) override
;
29 virtual bool IntersectsWith(const gfx::RectF
& rect
) const override
;
31 static bool RegisterHandleViewResources(JNIEnv
* env
);
35 gfx::RectF
BoundingRect() const;
37 const float dpi_scale_
;
38 TouchHandleOrientation orientation_
;
39 gfx::PointF focal_position_
;
40 gfx::Vector2dF focal_offset_from_origin_
;
41 scoped_refptr
<cc::UIResourceLayer
> layer_
;
43 DISALLOW_COPY_AND_ASSIGN(CompositedTouchHandleDrawable
);
46 } // namespace content
48 #endif // CONTENT_BROWSER_ANDROID_COMPOSITED_TOUCH_HANDLE_DRAWABLE_H_