| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/android/vr_shell/vr_input_manager.h" | 5 #include "chrome/browser/android/vr_shell/vr_input_manager.h" |
| 6 | 6 |
| 7 #include "base/task_runner_util.h" | 7 #include "base/task_runner_util.h" |
| 8 #include "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
| 9 #include "content/public/browser/render_widget_host.h" | 9 #include "content/public/browser/render_widget_host.h" |
| 10 #include "content/public/browser/render_widget_host_view.h" | 10 #include "content/public/browser/render_widget_host_view.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 result.x = x / dpi_scale_; | 73 result.x = x / dpi_scale_; |
| 74 result.y = y / dpi_scale_; | 74 result.y = y / dpi_scale_; |
| 75 result.timeStampSeconds = time_ms / 1000.0; | 75 result.timeStampSeconds = time_ms / 1000.0; |
| 76 result.sourceDevice = blink::WebGestureDeviceTouchpad; | 76 result.sourceDevice = blink::WebGestureDeviceTouchpad; |
| 77 | 77 |
| 78 return result; | 78 return result; |
| 79 } | 79 } |
| 80 | 80 |
| 81 void VrInputManager::ForwardGestureEvent( | 81 void VrInputManager::ForwardGestureEvent( |
| 82 const blink::WebGestureEvent& gesture) { | 82 const blink::WebGestureEvent& gesture) { |
| 83 if (!web_contents_->GetRenderWidgetHostView()) |
| 84 return; |
| 83 content::RenderWidgetHost* rwh = | 85 content::RenderWidgetHost* rwh = |
| 84 web_contents_->GetRenderWidgetHostView()->GetRenderWidgetHost(); | 86 web_contents_->GetRenderWidgetHostView()->GetRenderWidgetHost(); |
| 85 if (rwh) | 87 if (rwh) |
| 86 rwh->ForwardGestureEvent(gesture); | 88 rwh->ForwardGestureEvent(gesture); |
| 87 } | 89 } |
| 88 | 90 |
| 89 void VrInputManager::ForwardMouseEvent( | 91 void VrInputManager::ForwardMouseEvent( |
| 90 const blink::WebMouseEvent& mouse_event) { | 92 const blink::WebMouseEvent& mouse_event) { |
| 93 if (!web_contents_->GetRenderWidgetHostView()) |
| 94 return; |
| 91 content::RenderWidgetHost* rwh = | 95 content::RenderWidgetHost* rwh = |
| 92 web_contents_->GetRenderWidgetHostView()->GetRenderWidgetHost(); | 96 web_contents_->GetRenderWidgetHostView()->GetRenderWidgetHost(); |
| 93 if (rwh) | 97 if (rwh) |
| 94 rwh->ForwardMouseEvent(mouse_event); | 98 rwh->ForwardMouseEvent(mouse_event); |
| 95 } | 99 } |
| 96 | 100 |
| 97 } // namespace vr_shell | 101 } // namespace vr_shell |
| OLD | NEW |