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

Side by Side Diff: third_party/WebKit/Source/modules/device_orientation/DeviceOrientationDispatcher.h

Issue 2885203004: Refactor content/renderer/device_sensors to use device/generic_sensor instead of device/sensors (Closed)
Patch Set: updated content/renderer/BUILD.gn Created 3 years, 7 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 19 matching lines...) Expand all
30 30
31 #ifndef DeviceOrientationDispatcher_h 31 #ifndef DeviceOrientationDispatcher_h
32 #define DeviceOrientationDispatcher_h 32 #define DeviceOrientationDispatcher_h
33 33
34 #include "core/frame/PlatformEventDispatcher.h" 34 #include "core/frame/PlatformEventDispatcher.h"
35 #include "platform/heap/Handle.h" 35 #include "platform/heap/Handle.h"
36 #include "platform/wtf/RefPtr.h" 36 #include "platform/wtf/RefPtr.h"
37 #include "public/platform/WebPlatformEventType.h" 37 #include "public/platform/WebPlatformEventType.h"
38 #include "public/platform/modules/device_orientation/WebDeviceOrientationListene r.h" 38 #include "public/platform/modules/device_orientation/WebDeviceOrientationListene r.h"
39 39
40 namespace device {
41 class OrientationData;
42 }
43
44 namespace blink { 40 namespace blink {
45 41
46 class DeviceOrientationData; 42 class DeviceOrientationData;
43 class WebDeviceOrientationData;
47 44
48 // This class listens to device orientation data and notifies all registered 45 // This class listens to device orientation data and notifies all registered
49 // controllers. 46 // controllers.
50 class DeviceOrientationDispatcher final 47 class DeviceOrientationDispatcher final
51 : public GarbageCollectedFinalized<DeviceOrientationDispatcher>, 48 : public GarbageCollectedFinalized<DeviceOrientationDispatcher>,
52 public PlatformEventDispatcher, 49 public PlatformEventDispatcher,
53 public WebDeviceOrientationListener { 50 public WebDeviceOrientationListener {
54 USING_GARBAGE_COLLECTED_MIXIN(DeviceOrientationDispatcher); 51 USING_GARBAGE_COLLECTED_MIXIN(DeviceOrientationDispatcher);
55 52
56 public: 53 public:
57 static DeviceOrientationDispatcher& Instance(bool absolute); 54 static DeviceOrientationDispatcher& Instance(bool absolute);
58 ~DeviceOrientationDispatcher() override; 55 ~DeviceOrientationDispatcher() override;
59 56
60 // Note that the returned object is owned by this class. 57 // Note that the returned object is owned by this class.
61 // FIXME: make the return value const, see crbug.com/233174. 58 // FIXME: make the return value const, see crbug.com/233174.
62 DeviceOrientationData* LatestDeviceOrientationData(); 59 DeviceOrientationData* LatestDeviceOrientationData();
63 60
64 // Inherited from WebDeviceOrientationListener. 61 // Inherited from WebDeviceOrientationListener.
65 void DidChangeDeviceOrientation(const device::OrientationData&) override; 62 void DidChangeDeviceOrientation(const WebDeviceOrientationData&) override;
66 63
67 DECLARE_VIRTUAL_TRACE(); 64 DECLARE_VIRTUAL_TRACE();
68 65
69 private: 66 private:
70 explicit DeviceOrientationDispatcher(bool absolute); 67 explicit DeviceOrientationDispatcher(bool absolute);
71 68
72 // Inherited from PlatformEventDispatcher. 69 // Inherited from PlatformEventDispatcher.
73 void StartListening() override; 70 void StartListening() override;
74 void StopListening() override; 71 void StopListening() override;
75 72
76 WebPlatformEventType GetWebPlatformEventType() const; 73 WebPlatformEventType GetWebPlatformEventType() const;
77 74
78 const bool absolute_; 75 const bool absolute_;
79 Member<DeviceOrientationData> last_device_orientation_data_; 76 Member<DeviceOrientationData> last_device_orientation_data_;
80 }; 77 };
81 78
82 } // namespace blink 79 } // namespace blink
83 80
84 #endif // DeviceOrientationDispatcher_h 81 #endif // DeviceOrientationDispatcher_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698