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

Unified Diff: extensions/browser/api/webcam_private/webcam.h

Issue 1136883004: Move V4L2 code into a webcam helper class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 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 side-by-side diff with in-line comments
Download patch
Index: extensions/browser/api/webcam_private/webcam.h
diff --git a/extensions/browser/api/webcam_private/webcam.h b/extensions/browser/api/webcam_private/webcam.h
new file mode 100644
index 0000000000000000000000000000000000000000..c85e75f364d6c9d3bbf773ed67ef929ab0c486cc
--- /dev/null
+++ b/extensions/browser/api/webcam_private/webcam.h
@@ -0,0 +1,62 @@
+// Copyright 2015 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 EXTENSIONS_BROWSER_API_WEBCAM_PRIVATE_WEBCAM_H_
+#define EXTENSIONS_BROWSER_API_WEBCAM_PRIVATE_WEBCAM_H_
+
+#include <set>
+#include <string>
+
+#include "base/macros.h"
+
+namespace extensions {
+
+class Webcam {
+ public:
+ enum PanDirection {
+ PAN_LEFT,
+ PAN_RIGHT,
+ PAN_STOP,
+ };
+
+ enum TiltDirection {
+ TILT_UP,
+ TILT_DOWN,
+ TILT_STOP,
+ };
+
+ Webcam();
+ virtual ~Webcam();
+
+ virtual void Reset(bool pan, bool tilt, bool zoom) = 0;
+ virtual bool GetPan(int* value) = 0;
+ virtual bool GetTilt(int* value) = 0;
+ virtual bool GetZoom(int* value) = 0;
+ virtual bool SetPan(int value) = 0;
+ virtual bool SetTilt(int value) = 0;
+ virtual bool SetZoom(int value) = 0;
+ virtual bool SetPanDirection(PanDirection direction) = 0;
+ virtual bool SetTiltDirection(TiltDirection direction) = 0;
+
+ void AddExtensionRef(const std::string& extension_id) {
+ extension_refs_.insert(extension_id);
+ }
+
+ void RemoveExtensionRef(const std::string& extension_id) {
+ extension_refs_.erase(extension_id);
+ }
+
+ bool ShouldDelete() {
+ return extension_refs_.empty();
+ }
+
+ private:
+ std::set<std::string> extension_refs_;
+
+ DISALLOW_COPY_AND_ASSIGN(Webcam);
+};
+
+} // namespace extensions
+
+#endif // EXTENSIONS_BROWSER_API_WEBCAM_PRIVATE_WEBCAM_H_
« no previous file with comments | « extensions/browser/api/webcam_private/v4l2_webcam.cc ('k') | extensions/browser/api/webcam_private/webcam.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698