DeviceMotionClientBlackBerry.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * Copyright (C) 2010, 2011, 2012 Research In Motion Limited. All rights reserved.
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2 of the License, or (at your option) any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with this library; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #ifndef DeviceMotionClientBlackBerry_h
  19. #define DeviceMotionClientBlackBerry_h
  20. #include "DeviceMotionClient.h"
  21. #include "DeviceMotionData.h"
  22. #include <BlackBerryPlatformDeviceMotionTrackerListener.h>
  23. namespace BlackBerry {
  24. namespace WebKit {
  25. class WebPagePrivate;
  26. }
  27. }
  28. namespace BlackBerry {
  29. namespace Platform {
  30. class DeviceMotionTracker;
  31. }
  32. }
  33. namespace WebCore {
  34. class DeviceMotionClientBlackBerry : public DeviceMotionClient, public BlackBerry::Platform::DeviceMotionTrackerListener {
  35. public:
  36. DeviceMotionClientBlackBerry(BlackBerry::WebKit::WebPagePrivate*);
  37. ~DeviceMotionClientBlackBerry();
  38. virtual void setController(DeviceMotionController*);
  39. virtual void startUpdating();
  40. virtual void stopUpdating();
  41. virtual DeviceMotionData* lastMotion() const;
  42. virtual void deviceMotionControllerDestroyed();
  43. virtual void onMotion(const BlackBerry::Platform::DeviceMotionEvent*);
  44. private:
  45. BlackBerry::WebKit::WebPagePrivate* m_webPagePrivate;
  46. BlackBerry::Platform::DeviceMotionTracker* m_tracker;
  47. DeviceMotionController* m_controller;
  48. RefPtr<DeviceMotionData> m_currentMotion;
  49. double m_lastEventTime;
  50. };
  51. }
  52. #endif // DeviceMotionClientBlackBerry_h