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

Unified Diff: content/browser/device_orientation/device_motion_provider.h

Issue 14678012: Implement the content/renderer and content/browser part of the Device Motion API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/device_orientation/device_motion_provider.h
diff --git a/content/browser/device_orientation/device_motion_provider.h b/content/browser/device_orientation/device_motion_provider.h
new file mode 100644
index 0000000000000000000000000000000000000000..30cdde45b4a47b581560b33ec517e67dd10aef38
--- /dev/null
+++ b/content/browser/device_orientation/device_motion_provider.h
@@ -0,0 +1,49 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_DEVICE_ORIENTATION_DEVICE_MOTION_PROVIDER_H_
+#define CONTENT_BROWSER_DEVICE_ORIENTATION_DEVICE_MOTION_PROVIDER_H_
+
+#include "base/memory/scoped_ptr.h"
+#include "base/shared_memory.h"
+#include "content/common/content_export.h"
+#include "content/common/device_motion_hardware_buffer.h"
+
+namespace content {
+
+// TODO(timvolodine) Implement this class properly.
palmer 2013/07/10 18:23:48 What does "properly" mean? Why not do it now? :)
timvolodine 2013/07/10 21:17:50 because the data fetcher is not there yet, it's be
+
+class CONTENT_EXPORT DeviceMotionProvider {
+ public:
+ DeviceMotionProvider();
+ virtual ~DeviceMotionProvider();
+
+ // Returns the shared memory handle of the device motion data duplicated
+ // into the given process.
+ base::SharedMemoryHandle GetSharedMemoryHandleForProcess(
+ base::ProcessHandle renderer_process);
+
+ // Pause and resume the background polling thread. Can be called from any
+ // thread.
+ void StartFetchingDeviceMotionData();
+ void StopFetchingDeviceMotionData();
+
+ private:
+ static DeviceMotionProvider* instance_;
+
+ base::SharedMemory device_motion_shared_memory_;
+
+ DeviceMotionHardwareBuffer* SharedMemoryAsHardwareBuffer();
+
+ // FIXME: add member variable,
palmer 2013/07/10 18:23:48 Use TODO(timvolodine) instead of FIXME.
timvolodine 2013/07/10 21:17:50 Done.
+ // scoped_ptr<DataFetcherSharedMemory> data_fetcher_;
+
+ bool is_started_;
+
+ DISALLOW_COPY_AND_ASSIGN(DeviceMotionProvider);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_DEVICE_ORIENTATION_DEVICE_MOTION_PROVIDER_H_

Powered by Google App Engine
This is Rietveld 408576698