| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/renderer_host/render_widget_host_view_views.h" | 5 #include "chrome/browser/renderer_host/render_widget_host_view_views.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 679 case views::Event::ET_TOUCH_PRESSED: | 679 case views::Event::ET_TOUCH_PRESSED: |
| 680 // Add a new touch point. | 680 // Add a new touch point. |
| 681 if (touch_event_.touchPointsLength < | 681 if (touch_event_.touchPointsLength < |
| 682 WebTouchEvent::touchPointsLengthCap) { | 682 WebTouchEvent::touchPointsLengthCap) { |
| 683 point = &touch_event_.touchPoints[touch_event_.touchPointsLength++]; | 683 point = &touch_event_.touchPoints[touch_event_.touchPointsLength++]; |
| 684 point->id = e.identity(); | 684 point->id = e.identity(); |
| 685 | 685 |
| 686 if (touch_event_.touchPointsLength == 1) { | 686 if (touch_event_.touchPointsLength == 1) { |
| 687 // A new touch sequence has started. | 687 // A new touch sequence has started. |
| 688 status = TOUCH_STATUS_START; | 688 status = TOUCH_STATUS_START; |
| 689 |
| 690 // We also want the focus. |
| 691 RequestFocus(); |
| 689 } | 692 } |
| 690 } | 693 } |
| 691 break; | 694 break; |
| 692 case views::Event::ET_TOUCH_RELEASED: | 695 case views::Event::ET_TOUCH_RELEASED: |
| 693 case views::Event::ET_TOUCH_CANCELLED: | 696 case views::Event::ET_TOUCH_CANCELLED: |
| 694 case views::Event::ET_TOUCH_MOVED: { | 697 case views::Event::ET_TOUCH_MOVED: { |
| 695 // The touch point should have been added to the event from an earlier | 698 // The touch point should have been added to the event from an earlier |
| 696 // _PRESSED event. So find that. | 699 // _PRESSED event. So find that. |
| 697 // At the moment, only a maximum of 4 touch-points are allowed. So a | 700 // At the moment, only a maximum of 4 touch-points are allowed. So a |
| 698 // simple loop should be sufficient. | 701 // simple loop should be sufficient. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 } | 756 } |
| 754 | 757 |
| 755 // static | 758 // static |
| 756 RenderWidgetHostView* | 759 RenderWidgetHostView* |
| 757 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView( | 760 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView( |
| 758 gfx::NativeView widget) { | 761 gfx::NativeView widget) { |
| 759 gpointer user_data = g_object_get_data(G_OBJECT(widget), | 762 gpointer user_data = g_object_get_data(G_OBJECT(widget), |
| 760 kRenderWidgetHostViewKey); | 763 kRenderWidgetHostViewKey); |
| 761 return reinterpret_cast<RenderWidgetHostView*>(user_data); | 764 return reinterpret_cast<RenderWidgetHostView*>(user_data); |
| 762 } | 765 } |
| OLD | NEW |