Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: chrome/browser/android/vr_shell/vr_input_manager.cc

Issue 2622333002: VR: Fix timing of tap event (Closed)
Patch Set: VR: Fix timing of tap event Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "content/public/browser/web_contents.h" 11 #include "content/public/browser/web_contents.h"
12 12
13 using blink::WebGestureEvent; 13 using blink::WebGestureEvent;
14 using blink::WebMouseEvent; 14 using blink::WebMouseEvent;
15 using blink::WebInputEvent; 15 using blink::WebInputEvent;
16 16
17 namespace vr_shell { 17 namespace vr_shell {
18 18
19 namespace { 19 namespace {
20 WebGestureEvent MakeGestureEvent(WebInputEvent::Type type, 20 WebGestureEvent MakeGestureEvent(WebInputEvent::Type type,
21 int64_t time_ms, 21 double time,
22 float x, 22 float x,
23 float y) { 23 float y) {
24 WebGestureEvent result; 24 WebGestureEvent result;
25 result.type = type; 25 result.type = type;
26 result.x = x; 26 result.x = x;
27 result.y = y; 27 result.y = y;
28 result.timeStampSeconds = time_ms / 1000.0; 28 result.timeStampSeconds = time;
29 result.sourceDevice = blink::WebGestureDeviceTouchpad; 29 result.sourceDevice = blink::WebGestureDeviceTouchpad;
30 return result; 30 return result;
31 } 31 }
32 } // namespace 32 } // namespace
33 33
34 VrInputManager::VrInputManager(content::WebContents* web_contents) 34 VrInputManager::VrInputManager(content::WebContents* web_contents)
35 : web_contents_(web_contents), 35 : web_contents_(web_contents),
36 weak_ptr_factory_(this) { 36 weak_ptr_factory_(this) {
37 } 37 }
38 38
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 const blink::WebMouseEvent& mouse_event) { 80 const blink::WebMouseEvent& mouse_event) {
81 if (!web_contents_->GetRenderWidgetHostView()) 81 if (!web_contents_->GetRenderWidgetHostView())
82 return; 82 return;
83 content::RenderWidgetHost* rwh = 83 content::RenderWidgetHost* rwh =
84 web_contents_->GetRenderWidgetHostView()->GetRenderWidgetHost(); 84 web_contents_->GetRenderWidgetHostView()->GetRenderWidgetHost();
85 if (rwh) 85 if (rwh)
86 rwh->ForwardMouseEvent(mouse_event); 86 rwh->ForwardMouseEvent(mouse_event);
87 } 87 }
88 88
89 } // namespace vr_shell 89 } // namespace vr_shell
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698