OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "content/renderer/render_widget.h" | 5 #include "content/renderer/render_widget.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 2780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2791 } | 2791 } |
2792 | 2792 |
2793 void RenderWidget::setTouchAction( | 2793 void RenderWidget::setTouchAction( |
2794 blink::WebTouchAction web_touch_action) { | 2794 blink::WebTouchAction web_touch_action) { |
2795 | 2795 |
2796 // Ignore setTouchAction calls that result from synthetic touch events (eg. | 2796 // Ignore setTouchAction calls that result from synthetic touch events (eg. |
2797 // when blink is emulating touch with mouse). | 2797 // when blink is emulating touch with mouse). |
2798 if (!handling_touchstart_event_) | 2798 if (!handling_touchstart_event_) |
2799 return; | 2799 return; |
2800 | 2800 |
2801 content::TouchAction content_touch_action; | 2801 // Verify the same values are used by the types so we can cast between them. |
2802 switch(web_touch_action) { | 2802 COMPILE_ASSERT(static_cast<blink::WebTouchAction>(TOUCH_ACTION_AUTO) == |
2803 case blink::WebTouchActionNone: | 2803 blink::WebTouchActionAuto, |
2804 content_touch_action = content::TOUCH_ACTION_NONE; | 2804 enum_values_must_match_for_touch_action); |
2805 break; | 2805 COMPILE_ASSERT(static_cast<blink::WebTouchAction>(TOUCH_ACTION_NONE) == |
2806 case blink::WebTouchActionAuto: | 2806 blink::WebTouchActionNone, |
2807 content_touch_action = content::TOUCH_ACTION_AUTO; | 2807 enum_values_must_match_for_touch_action); |
2808 break; | 2808 COMPILE_ASSERT(static_cast<blink::WebTouchAction>(TOUCH_ACTION_PAN_X) == |
2809 default: | 2809 blink::WebTouchActionPanX, |
2810 NOTREACHED(); | 2810 enum_values_must_match_for_touch_action); |
2811 } | 2811 COMPILE_ASSERT(static_cast<blink::WebTouchAction>(TOUCH_ACTION_PAN_Y) == |
| 2812 blink::WebTouchActionPanY, |
| 2813 enum_values_must_match_for_touch_action); |
| 2814 |
| 2815 content::TouchAction content_touch_action = |
| 2816 static_cast<content::TouchAction>(web_touch_action); |
2812 Send(new InputHostMsg_SetTouchAction(routing_id_, content_touch_action)); | 2817 Send(new InputHostMsg_SetTouchAction(routing_id_, content_touch_action)); |
2813 } | 2818 } |
2814 | 2819 |
2815 bool RenderWidget::HasTouchEventHandlersAt(const gfx::Point& point) const { | 2820 bool RenderWidget::HasTouchEventHandlersAt(const gfx::Point& point) const { |
2816 return true; | 2821 return true; |
2817 } | 2822 } |
2818 | 2823 |
2819 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> | 2824 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> |
2820 RenderWidget::CreateGraphicsContext3D( | 2825 RenderWidget::CreateGraphicsContext3D( |
2821 const blink::WebGraphicsContext3D::Attributes& attributes) { | 2826 const blink::WebGraphicsContext3D::Attributes& attributes) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2862 surface_id(), | 2867 surface_id(), |
2863 GetURLForGraphicsContext3D(), | 2868 GetURLForGraphicsContext3D(), |
2864 gpu_channel_host.get(), | 2869 gpu_channel_host.get(), |
2865 attributes, | 2870 attributes, |
2866 false /* bind generates resources */, | 2871 false /* bind generates resources */, |
2867 limits)); | 2872 limits)); |
2868 return context.Pass(); | 2873 return context.Pass(); |
2869 } | 2874 } |
2870 | 2875 |
2871 } // namespace content | 2876 } // namespace content |
OLD | NEW |