OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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/shell/renderer/test_runner/gamepad_controller.h" | 5 #include "content/shell/renderer/test_runner/gamepad_controller.h" |
6 | 6 |
7 #include "content/shell/renderer/test_runner/web_test_delegate.h" | 7 #include "content/shell/renderer/test_runner/web_test_delegate.h" |
8 #include "gin/arguments.h" | 8 #include "gin/arguments.h" |
9 #include "gin/handle.h" | 9 #include "gin/handle.h" |
10 #include "gin/object_template_builder.h" | 10 #include "gin/object_template_builder.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 static void Install(base::WeakPtr<GamepadController> controller, | 28 static void Install(base::WeakPtr<GamepadController> controller, |
29 blink::WebFrame* frame); | 29 blink::WebFrame* frame); |
30 | 30 |
31 private: | 31 private: |
32 explicit GamepadControllerBindings( | 32 explicit GamepadControllerBindings( |
33 base::WeakPtr<GamepadController> controller); | 33 base::WeakPtr<GamepadController> controller); |
34 virtual ~GamepadControllerBindings(); | 34 virtual ~GamepadControllerBindings(); |
35 | 35 |
36 // gin::Wrappable. | 36 // gin::Wrappable. |
37 virtual gin::ObjectTemplateBuilder GetObjectTemplateBuilder( | 37 virtual gin::ObjectTemplateBuilder GetObjectTemplateBuilder( |
38 v8::Isolate* isolate) OVERRIDE; | 38 v8::Isolate* isolate) override; |
39 | 39 |
40 void Connect(int index); | 40 void Connect(int index); |
41 void DispatchConnected(int index); | 41 void DispatchConnected(int index); |
42 void Disconnect(int index); | 42 void Disconnect(int index); |
43 void SetId(int index, const std::string& src); | 43 void SetId(int index, const std::string& src); |
44 void SetButtonCount(int index, int buttons); | 44 void SetButtonCount(int index, int buttons); |
45 void SetButtonData(int index, int button, double data); | 45 void SetButtonData(int index, int button, double data); |
46 void SetAxisCount(int index, int axes); | 46 void SetAxisCount(int index, int axes); |
47 void SetAxisData(int index, int axis, double data); | 47 void SetAxisData(int index, int axis, double data); |
48 | 48 |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 | 248 |
249 void GamepadController::SetAxisData(int index, int axis, double data) { | 249 void GamepadController::SetAxisData(int index, int axis, double data) { |
250 if (index < 0 || index >= static_cast<int>(WebGamepads::itemsLengthCap)) | 250 if (index < 0 || index >= static_cast<int>(WebGamepads::itemsLengthCap)) |
251 return; | 251 return; |
252 if (axis < 0 || axis >= static_cast<int>(WebGamepad::axesLengthCap)) | 252 if (axis < 0 || axis >= static_cast<int>(WebGamepad::axesLengthCap)) |
253 return; | 253 return; |
254 gamepads_.items[index].axes[axis] = data; | 254 gamepads_.items[index].axes[axis] = data; |
255 } | 255 } |
256 | 256 |
257 } // namespace content | 257 } // namespace content |
OLD | NEW |