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

Side by Side Diff: Source/modules/gamepad/Gamepad.h

Issue 195993007: Factor out GamepadCommon base class from Gamepad and WebKitGamepad (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add ABC FIXME Created 6 years, 9 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 | Annotate | Revision Log
OLDNEW
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 18 matching lines...) Expand all
29 #include "bindings/v8/ScriptWrappable.h" 29 #include "bindings/v8/ScriptWrappable.h"
30 #include "heap/Handle.h" 30 #include "heap/Handle.h"
31 #include "modules/gamepad/GamepadButton.h" 31 #include "modules/gamepad/GamepadButton.h"
32 #include "public/platform/WebGamepad.h" 32 #include "public/platform/WebGamepad.h"
33 #include "wtf/RefCounted.h" 33 #include "wtf/RefCounted.h"
34 #include "wtf/Vector.h" 34 #include "wtf/Vector.h"
35 #include "wtf/text/WTFString.h" 35 #include "wtf/text/WTFString.h"
36 36
37 namespace WebCore { 37 namespace WebCore {
38 38
39 class Gamepad FINAL : public RefCountedWillBeGarbageCollectedFinalized<Gamepad>, public ScriptWrappable { 39 class Gamepad : public RefCountedWillBeGarbageCollectedFinalized<Gamepad>, publi c ScriptWrappable {
40 public: 40 public:
41 static PassRefPtrWillBeRawPtr<Gamepad> create() 41 static PassRefPtrWillBeRawPtr<Gamepad> create()
42 { 42 {
43 return adoptRefWillBeNoop(new Gamepad); 43 return adoptRefWillBeNoop(new Gamepad);
44 } 44 }
45 ~Gamepad(); 45 ~Gamepad();
46 46
47 typedef Vector<float> FloatVector; 47 typedef Vector<float> FloatVector;
48 48
49 const String& id() const { return m_id; } 49 const String& id() const { return m_id; }
(...skipping 12 matching lines...) Expand all
62 void setMapping(const String& val) { m_mapping = val; } 62 void setMapping(const String& val) { m_mapping = val; }
63 63
64 const FloatVector& axes() const { return m_axes; } 64 const FloatVector& axes() const { return m_axes; }
65 void setAxes(unsigned count, const float* data); 65 void setAxes(unsigned count, const float* data);
66 66
67 const GamepadButtonVector& buttons() const { return m_buttons; } 67 const GamepadButtonVector& buttons() const { return m_buttons; }
68 void setButtons(unsigned count, const blink::WebGamepadButton* data); 68 void setButtons(unsigned count, const blink::WebGamepadButton* data);
69 69
70 void trace(Visitor*); 70 void trace(Visitor*);
71 71
72 private: 72 protected:
73 // Inherited by WebKitGamepad
73 Gamepad(); 74 Gamepad();
74 String m_id; 75 String m_id;
75 unsigned m_index; 76 unsigned m_index;
76 bool m_connected; 77 bool m_connected;
77 unsigned long long m_timestamp; 78 unsigned long long m_timestamp;
78 String m_mapping; 79 String m_mapping;
79 FloatVector m_axes; 80 FloatVector m_axes;
80 GamepadButtonVector m_buttons; 81
82 private:
83 GamepadButtonVector m_buttons; // WebKitGamepad.buttons has different type
81 }; 84 };
82 85
83 } // namespace WebCore 86 } // namespace WebCore
84 87
85 #endif // Gamepad_h 88 #endif // Gamepad_h
OLDNEW
« no previous file with comments | « no previous file | Source/modules/gamepad/GamepadList.h » ('j') | Source/modules/gamepad/GamepadList.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698