diff options
author | zork@chromium.org <zork@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-11 18:25:02 +0000 |
---|---|---|
committer | zork@chromium.org <zork@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-11 18:25:02 +0000 |
commit | 54ba65aa8b7f842f125f704dfabb589559e9f60d (patch) | |
tree | edae68c477214da2d39e3cc7680a9e6c022de545 /chrome | |
parent | 503d74a00a21f4123ed0adbdbbf89ffed9d196f3 (diff) | |
download | chromium_src-54ba65aa8b7f842f125f704dfabb589559e9f60d.zip chromium_src-54ba65aa8b7f842f125f704dfabb589559e9f60d.tar.gz chromium_src-54ba65aa8b7f842f125f704dfabb589559e9f60d.tar.bz2 |
Add chrome.webcamPrivate idl
This also adds the stubs for all the functions.
BUG=346492
Review URL: https://codereview.chromium.org/205243005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@263287 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
9 files changed, 153 insertions, 0 deletions
diff --git a/chrome/browser/extensions/api/webcam_private/webcam_private_api.cc b/chrome/browser/extensions/api/webcam_private/webcam_private_api.cc new file mode 100644 index 0000000..f956ba4 --- /dev/null +++ b/chrome/browser/extensions/api/webcam_private/webcam_private_api.cc @@ -0,0 +1,62 @@ +// Copyright 2014 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. + +#include "chrome/browser/extensions/api/webcam_private/webcam_private_api.h" + +#include "chrome/common/extensions/api/webcam_private.h" + +namespace extensions { + +WebcamPrivateSetFunction::WebcamPrivateSetFunction() { +} + +WebcamPrivateSetFunction::~WebcamPrivateSetFunction() { +} + +bool WebcamPrivateSetFunction::RunImpl() { + // Get parameters + scoped_ptr<api::webcam_private::Set::Params> params( + api::webcam_private::Set::Params::Create(*args_)); + EXTENSION_FUNCTION_VALIDATE(params.get()); + + // TODO(zork): Send the value to the webcam. + + return true; +} + +WebcamPrivateGetFunction::WebcamPrivateGetFunction() { +} + +WebcamPrivateGetFunction::~WebcamPrivateGetFunction() { +} + +bool WebcamPrivateGetFunction::RunImpl() { + // Get parameters + scoped_ptr<api::webcam_private::Get::Params> params( + api::webcam_private::Get::Params::Create(*args_)); + EXTENSION_FUNCTION_VALIDATE(params.get()); + + // TODO(zork): Get the value from the webcam. + + return false; +} + +WebcamPrivateResetFunction::WebcamPrivateResetFunction() { +} + +WebcamPrivateResetFunction::~WebcamPrivateResetFunction() { +} + +bool WebcamPrivateResetFunction::RunImpl() { + // Get parameters + scoped_ptr<api::webcam_private::Reset::Params> params( + api::webcam_private::Reset::Params::Create(*args_)); + EXTENSION_FUNCTION_VALIDATE(params.get()); + + // TODO(zork): Reset the webcam state. + + return true; +} + +} // namespace extensions diff --git a/chrome/browser/extensions/api/webcam_private/webcam_private_api.h b/chrome/browser/extensions/api/webcam_private/webcam_private_api.h new file mode 100644 index 0000000..132a211 --- /dev/null +++ b/chrome/browser/extensions/api/webcam_private/webcam_private_api.h @@ -0,0 +1,55 @@ +// Copyright 2014 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 CHROME_BROWSER_EXTENSIONS_API_WEBCAM_PRIVATE_WEBCAM_PRIVATE_API_H_ +#define CHROME_BROWSER_EXTENSIONS_API_WEBCAM_PRIVATE_WEBCAM_PRIVATE_API_H_ + +#include "extensions/browser/extension_function.h" + +class Profile; + +namespace extensions { + +class WebcamPrivateSetFunction : public SyncExtensionFunction { + public: + WebcamPrivateSetFunction(); + DECLARE_EXTENSION_FUNCTION("webcamPrivate.set", WEBCAMPRIVATE_SET); + + protected: + virtual ~WebcamPrivateSetFunction(); + virtual bool RunImpl() OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(WebcamPrivateSetFunction); +}; + +class WebcamPrivateGetFunction : public SyncExtensionFunction { + public: + WebcamPrivateGetFunction(); + DECLARE_EXTENSION_FUNCTION("webcamPrivate.get", WEBCAMPRIVATE_GET); + + protected: + virtual ~WebcamPrivateGetFunction(); + virtual bool RunImpl() OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(WebcamPrivateGetFunction); +}; + +class WebcamPrivateResetFunction : public SyncExtensionFunction { + public: + WebcamPrivateResetFunction(); + DECLARE_EXTENSION_FUNCTION("webcamPrivate.reset", WEBCAMPRIVATE_RESET); + + protected: + virtual ~WebcamPrivateResetFunction(); + virtual bool RunImpl() OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(WebcamPrivateResetFunction); +}; + +} // namespace extensions + +#endif // CHROME_BROWSER_EXTENSIONS_API_WEBCAM_PRIVATE_WEBCAM_PRIVATE_API_H_ diff --git a/chrome/chrome_browser_extensions.gypi b/chrome/chrome_browser_extensions.gypi index b03411f..d86fb7e 100644 --- a/chrome/chrome_browser_extensions.gypi +++ b/chrome/chrome_browser_extensions.gypi @@ -946,6 +946,8 @@ 'browser/extensions/api/terminal/terminal_extension_helper.h', 'browser/extensions/api/terminal/terminal_private_api.cc', 'browser/extensions/api/terminal/terminal_private_api.h', + 'browser/extensions/api/webcam_private/webcam_private_api.h', + 'browser/extensions/api/webcam_private/webcam_private_api.cc', 'browser/extensions/updater/extension_cache_impl.cc', 'browser/extensions/updater/extension_cache_impl.h', 'browser/extensions/updater/local_extension_cache.cc', diff --git a/chrome/common/extensions/api/_api_features.json b/chrome/common/extensions/api/_api_features.json index 4a9b6eb..7e8481a 100644 --- a/chrome/common/extensions/api/_api_features.json +++ b/chrome/common/extensions/api/_api_features.json @@ -459,6 +459,10 @@ "extension_types": ["extension", "legacy_packaged_app"], "contexts": ["blessed_extension"] }, + "webcamPrivate": { + "dependencies": ["permission:webcamPrivate"], + "contexts": ["blessed_extension"] + }, "management": { "dependencies": ["permission:management"], "contexts": ["blessed_extension"] diff --git a/chrome/common/extensions/api/_permission_features.json b/chrome/common/extensions/api/_permission_features.json index 1c20b10..cc9a5fa 100644 --- a/chrome/common/extensions/api/_permission_features.json +++ b/chrome/common/extensions/api/_permission_features.json @@ -530,6 +530,10 @@ "extension_types": ["extension", "legacy_packaged_app"], "location": "component" }, + "webcamPrivate": { + "channel": "dev", + "extension_types": ["extension", "platform_app"] + }, "management": [ { "channel": "stable", diff --git a/chrome/common/extensions/api/api.gyp b/chrome/common/extensions/api/api.gyp index 5b9e368..13a1bb5 100644 --- a/chrome/common/extensions/api/api.gyp +++ b/chrome/common/extensions/api/api.gyp @@ -164,6 +164,7 @@ 'screenlock_private.idl', 'wallpaper.json', 'wallpaper_private.json', + 'webcam_private.idl', ], }], ['enable_webrtc==1', { diff --git a/chrome/common/extensions/api/webcam_private.idl b/chrome/common/extensions/api/webcam_private.idl new file mode 100644 index 0000000..60811c0 --- /dev/null +++ b/chrome/common/extensions/api/webcam_private.idl @@ -0,0 +1,23 @@ +// Copyright 2014 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. + +// Webcam Private API. +namespace webcamPrivate { + dictionary WebcamConfiguration { + double? pan; + double? zoom; + double? tilt; + }; + + callback WebcamConfigurationCallback = + void(WebcamConfiguration configuration); + + interface Functions { + static void get(DOMString webcamId, WebcamConfigurationCallback callback); + static void set(DOMString webcamId, WebcamConfiguration config); + static void reset(DOMString webcamId, WebcamConfiguration config); + + }; +}; + diff --git a/chrome/common/extensions/permissions/chrome_api_permissions.cc b/chrome/common/extensions/permissions/chrome_api_permissions.cc index 7473029..9711087 100644 --- a/chrome/common/extensions/permissions/chrome_api_permissions.cc +++ b/chrome/common/extensions/permissions/chrome_api_permissions.cc @@ -208,6 +208,7 @@ std::vector<APIPermissionInfo*> ChromeAPIPermissions::GetAllPermissions() {APIPermission::kIdentityPrivate, "identityPrivate", APIPermissionInfo::kFlagCannotBeOptional}, {APIPermission::kLogPrivate, "logPrivate"}, + {APIPermission::kWebcamPrivate, "webcamPrivate"}, {APIPermission::kNetworkingPrivate, "networkingPrivate", APIPermissionInfo::kFlagCannotBeOptional, IDS_EXTENSION_PROMPT_WARNING_NETWORKING_PRIVATE, diff --git a/chrome/common/extensions/permissions/permission_set_unittest.cc b/chrome/common/extensions/permissions/permission_set_unittest.cc index 4bf2c04..460ef03 100644 --- a/chrome/common/extensions/permissions/permission_set_unittest.cc +++ b/chrome/common/extensions/permissions/permission_set_unittest.cc @@ -670,6 +670,7 @@ TEST(PermissionsTest, PermissionMessages) { skip.insert(APIPermission::kSystemStorage); skip.insert(APIPermission::kTts); skip.insert(APIPermission::kUnlimitedStorage); + skip.insert(APIPermission::kWebcamPrivate); skip.insert(APIPermission::kWebView); skip.insert(APIPermission::kWindowShape); |