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

Unified Diff: extensions/browser/api/webcam_private/webcam_private_api.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_private_api.h
diff --git a/extensions/browser/api/webcam_private/webcam_private_api.h b/extensions/browser/api/webcam_private/webcam_private_api.h
index c4cef378e7ddbcecdd9d31db05837953cbd80b57..3c64e6c89edb24d3d06d2e55de279278bad41d17 100644
--- a/extensions/browser/api/webcam_private/webcam_private_api.h
+++ b/extensions/browser/api/webcam_private/webcam_private_api.h
@@ -5,12 +5,65 @@
#ifndef EXTENSIONS_BROWSER_API_WEBCAM_PRIVATE_WEBCAM_PRIVATE_API_H_
#define EXTENSIONS_BROWSER_API_WEBCAM_PRIVATE_WEBCAM_PRIVATE_API_H_
+#include <map>
+
+#include "base/memory/scoped_ptr.h"
+#include "base/scoped_observer.h"
+#include "extensions/browser/browser_context_keyed_api_factory.h"
#include "extensions/browser/extension_function.h"
+#include "extensions/browser/process_manager_observer.h"
class Profile;
namespace extensions {
+class ProcessManager;
+class Webcam;
+
+class WebcamPrivateAPI : public BrowserContextKeyedAPI,
+ public ProcessManagerObserver {
+ public:
+ static BrowserContextKeyedAPIFactory<WebcamPrivateAPI>* GetFactoryInstance();
+
+ // Convenience method to get the WebcamPrivateAPI for a BrowserContext.
+ static WebcamPrivateAPI* Get(content::BrowserContext* context);
+
+ explicit WebcamPrivateAPI(content::BrowserContext* context);
+ ~WebcamPrivateAPI() override;
+
+ Webcam* GetWebcam(const std::string& extension_id,
+ const std::string& webcam_id);
+
+ private:
+ friend class BrowserContextKeyedAPIFactory<WebcamPrivateAPI>;
+
+ bool GetDeviceId(const std::string& extension_id,
+ const std::string& webcam_id,
+ std::string* device_id);
+
+ // ProcessManagerObserver:
+ void OnBackgroundHostClose(const std::string& extension_id) override;
+
+ // BrowserContextKeyedAPI:
+ static const char* service_name() {
+ return "WebcamPrivateAPI";
+ }
+ static const bool kServiceIsNULLWhileTesting = true;
+ static const bool kServiceRedirectedInIncognito = true;
+
+ content::BrowserContext* const browser_context_;
+ ScopedObserver<ProcessManager, ProcessManagerObserver>
+ process_manager_observer_;
+
+ std::map<std::string, linked_ptr<Webcam>> webcams_;
+
+ base::WeakPtrFactory<WebcamPrivateAPI> weak_ptr_factory_;
+};
+
+template <>
+void BrowserContextKeyedAPIFactory<WebcamPrivateAPI>
+ ::DeclareFactoryDependencies();
+
class WebcamPrivateSetFunction : public SyncExtensionFunction {
public:
WebcamPrivateSetFunction();
« no previous file with comments | « extensions/browser/api/webcam_private/webcam.cc ('k') | extensions/browser/api/webcam_private/webcam_private_api_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698