OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, Google Inc. All rights reserved. | 2 * Copyright (C) 2011, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are met: | 5 * modification, are permitted provided that the following conditions are met: |
6 * | 6 * |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 m_pose = nullptr; | 65 m_pose = nullptr; |
66 return; | 66 return; |
67 } | 67 } |
68 | 68 |
69 if (!m_pose) | 69 if (!m_pose) |
70 m_pose = GamepadPose::create(); | 70 m_pose = GamepadPose::create(); |
71 | 71 |
72 m_pose->setPose(pose); | 72 m_pose->setPose(pose); |
73 } | 73 } |
74 | 74 |
| 75 void Gamepad::setHand(const WebGamepadHand& hand) |
| 76 { |
| 77 switch (hand) { |
| 78 case GamepadHandNone: |
| 79 m_hand = ""; |
| 80 break; |
| 81 case GamepadHandLeft: |
| 82 m_hand = "left"; |
| 83 break; |
| 84 case GamepadHandRight: |
| 85 m_hand = "right"; |
| 86 break; |
| 87 default: |
| 88 NOTREACHED(); |
| 89 } |
| 90 } |
| 91 |
75 DEFINE_TRACE(Gamepad) | 92 DEFINE_TRACE(Gamepad) |
76 { | 93 { |
77 visitor->trace(m_buttons); | 94 visitor->trace(m_buttons); |
78 visitor->trace(m_pose); | 95 visitor->trace(m_pose); |
79 } | 96 } |
80 | 97 |
81 } // namespace blink | 98 } // namespace blink |
OLD | NEW |