summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-13 20:30:55 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-13 20:30:55 +0000
commit3099a67b91c35a7ba32aeabdf881064fa852733c (patch)
tree897dfea249a0ea591903f44729da9c87880c8795
parentbec6455ee35350a84c53d53f065fd75d67dd3884 (diff)
downloadchromium_src-3099a67b91c35a7ba32aeabdf881064fa852733c.zip
chromium_src-3099a67b91c35a7ba32aeabdf881064fa852733c.tar.gz
chromium_src-3099a67b91c35a7ba32aeabdf881064fa852733c.tar.bz2
add kAudioCapture and kVideoCapture extension permissions (for platform apps)
skip the infobar and just return the first device in the list. BUG=130216 TEST=manual Review URL: https://chromiumcodereview.appspot.com/10533097 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@141959 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/app/generated_resources.grd6
-rw-r--r--chrome/browser/ui/extensions/shell_window.cc19
-rw-r--r--chrome/common/extensions/api/_permission_features.json8
-rw-r--r--chrome/common/extensions/docs/examples/api/record/page_cycler.zipbin3690 -> 3719 bytes
-rw-r--r--chrome/common/extensions/docs/examples/extensions/calculator.zipbin53586 -> 53572 bytes
-rw-r--r--chrome/common/extensions/docs/samples.html32
-rw-r--r--chrome/common/extensions/docs/samples.json28
-rw-r--r--chrome/common/extensions/extension_permission_set.cc9
-rw-r--r--chrome/common/extensions/extension_permission_set.h6
-rw-r--r--chrome/common/extensions/extension_permission_set_unittest.cc2
10 files changed, 90 insertions, 20 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index cabb1e4..d729750 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -4341,6 +4341,12 @@ Update checks have repeatedly failed for the extension "<ph name="EXTENSION_NAME
<message name="IDS_EXTENSION_PROMPT_WARNING_USB" desc="Permission string for access to USB devices.">
Access your USB peripherals
</message>
+ <message name="IDS_EXTENSION_PROMPT_WARNING_AUDIO_CAPTURE" desc="Permission string for access to audio capture devices.">
+ Use your microphone
+ </message>
+ <message name="IDS_EXTENSION_PROMPT_WARNING_VIDEO_CAPTURE" desc="Permission string for access to video capture devices.">
+ Use your camera
+ </message>
<!-- Extension/App error messages -->
<message name="IDS_EXTENSION_CANT_GET_ABSOLUTE_PATH" desc="Warning displayed in pack dialog when the absolute path to the extension directory can not be found.">
diff --git a/chrome/browser/ui/extensions/shell_window.cc b/chrome/browser/ui/extensions/shell_window.cc
index a427d3c..0a2701e 100644
--- a/chrome/browser/ui/extensions/shell_window.cc
+++ b/chrome/browser/ui/extensions/shell_window.cc
@@ -110,7 +110,24 @@ void ShellWindow::RequestMediaAccessPermission(
content::WebContents* web_contents,
const content::MediaStreamRequest* request,
const content::MediaResponseCallback& callback) {
- callback.Run(content::MediaStreamDevices());
+ content::MediaStreamDevices devices;
+
+ content::MediaStreamDeviceMap::const_iterator iter =
+ request->devices.find(content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE);
+ if (iter != request->devices.end() &&
+ extension()->HasAPIPermission(ExtensionAPIPermission::kAudioCapture) &&
+ !iter->second.empty()) {
+ devices.push_back(iter->second[0]);
+ }
+
+ iter = request->devices.find(content::MEDIA_STREAM_DEVICE_TYPE_VIDEO_CAPTURE);
+ if (iter != request->devices.end() &&
+ extension()->HasAPIPermission(ExtensionAPIPermission::kVideoCapture) &&
+ !iter->second.empty()) {
+ devices.push_back(iter->second[0]);
+ }
+
+ callback.Run(devices);
}
void ShellWindow::OnNativeClose() {
diff --git a/chrome/common/extensions/api/_permission_features.json b/chrome/common/extensions/api/_permission_features.json
index 072b810..578b63fb 100644
--- a/chrome/common/extensions/api/_permission_features.json
+++ b/chrome/common/extensions/api/_permission_features.json
@@ -21,6 +21,10 @@
"channel": "stable",
"extension_types": ["packaged_app", "hosted_app"]
},
+ "audioCapture": {
+ "channel": "stable",
+ "extension_types": ["platform_app"]
+ },
"background": {
"channel": "stable",
"extension_types": [
@@ -253,6 +257,10 @@
"channel": "stable",
"extension_types": ["platform_app"]
},
+ "videoCapture": {
+ "channel": "stable",
+ "extension_types": ["platform_app"]
+ },
"webNavigation": {
"channel": "stable",
"extension_types": ["extension", "packaged_app"]
diff --git a/chrome/common/extensions/docs/examples/api/record/page_cycler.zip b/chrome/common/extensions/docs/examples/api/record/page_cycler.zip
index 1ac30ff..0ce737f 100644
--- a/chrome/common/extensions/docs/examples/api/record/page_cycler.zip
+++ b/chrome/common/extensions/docs/examples/api/record/page_cycler.zip
Binary files differ
diff --git a/chrome/common/extensions/docs/examples/extensions/calculator.zip b/chrome/common/extensions/docs/examples/extensions/calculator.zip
index 9edc7e1..c0e8223 100644
--- a/chrome/common/extensions/docs/examples/extensions/calculator.zip
+++ b/chrome/common/extensions/docs/examples/extensions/calculator.zip
Binary files differ
diff --git a/chrome/common/extensions/docs/samples.html b/chrome/common/extensions/docs/samples.html
index 218fd28..09b4de4 100644
--- a/chrome/common/extensions/docs/samples.html
+++ b/chrome/common/extensions/docs/samples.html
@@ -867,6 +867,9 @@
<div>
<a href="examples/extensions/catblock.zip">Download source</a>
<!-- Only show the Install CRX link if a CRX file is provided -->
+ <span>
+ - <a href="examples/extensions/catblock.crx">Install extension</a>
+ </span>
</div>
</div><div class="sample" id="924f75a201bb0ec8d6c0b1c9c88c679ea211c93d">
<img class="icon" src="images/sample-default-icon.png">
@@ -1015,6 +1018,9 @@
<div>
<a href="examples/extensions/buildbot.zip">Download source</a>
<!-- Only show the Install CRX link if a CRX file is provided -->
+ <span>
+ - <a href="examples/extensions/buildbot.crx">Install extension</a>
+ </span>
</div>
</div><div class="sample" id="ac31228200b41a87982e386cc90d3a6eee4ad885">
<img class="icon" src="images/sample-default-icon.png">
@@ -1878,6 +1884,9 @@
<div>
<a href="examples/extensions/gdocs.zip">Download source</a>
<!-- Only show the Install CRX link if a CRX file is provided -->
+ <span>
+ - <a href="examples/extensions/gdocs.crx">Install extension</a>
+ </span>
</div>
</div><div class="sample" id="bb57f7a0132cbeb36ad7e7bb0ab75c21704234ca">
<img class="icon" src="examples/extensions/gmail/icon_128.png">
@@ -2182,6 +2191,9 @@
<div>
<a href="examples/extensions/imageinfo.zip">Download source</a>
<!-- Only show the Install CRX link if a CRX file is provided -->
+ <span>
+ - <a href="examples/extensions/imageinfo.crx">Install extension</a>
+ </span>
</div>
</div><div class="sample" id="8f52a8a59c6fc16cb0d1ed0680b7f005be033d58">
<img class="icon" src="images/sample-default-icon.png">
@@ -2390,6 +2402,9 @@
<div>
<a href="examples/extensions/mappy.zip">Download source</a>
<!-- Only show the Install CRX link if a CRX file is provided -->
+ <span>
+ - <a href="examples/extensions/mappy.crx">Install extension</a>
+ </span>
</div>
</div><div class="sample" id="b2f5f8a790e16f091a7e4e0a39b2d0a6d32e3a6d">
<img class="icon" src="examples/api/windows/merge_windows/merge_windows_128.png">
@@ -2610,6 +2625,9 @@
<div>
<a href="examples/extensions/news_i18n.zip">Download source</a>
<!-- Only show the Install CRX link if a CRX file is provided -->
+ <span>
+ - <a href="examples/extensions/news_i18n.crx">Install extension</a>
+ </span>
</div>
</div><div class="sample" id="3aea027164cb9b732ba4a8c51cb93708891726ef">
<img class="icon" src="examples/extensions/news/images/news_icon.png">
@@ -2948,6 +2966,9 @@
<div>
<a href="examples/extensions/benchmark.zip">Download source</a>
<!-- Only show the Install CRX link if a CRX file is provided -->
+ <span>
+ - <a href="examples/extensions/benchmark.crx">Install extension</a>
+ </span>
</div>
</div><div class="sample" id="579b7b1b54553eb5f2e8e7d2bf21bd61c855952e">
<img class="icon" src="examples/api/record/page_cycler/page_cycler_icon.png">
@@ -2980,8 +3001,6 @@
<code><a target="_blank" href="examples/api/record/page_cycler/page_cycler.html">page_cycler.html</a></code>
</li><li>
<code><a target="_blank" href="examples/api/record/page_cycler/page_cycler.js">page_cycler.js</a></code>
- </li><li>
- <code><a target="_blank" href="examples/api/record/page_cycler/ui_page_cycler.js">ui_page_cycler.js</a></code>
</li>
</ul>
</div>
@@ -3446,6 +3465,9 @@
<div>
<a href="examples/extensions/speak_selection.zip">Download source</a>
<!-- Only show the Install CRX link if a CRX file is provided -->
+ <span>
+ - <a href="examples/extensions/speak_selection.crx">Install extension</a>
+ </span>
</div>
</div><div class="sample" id="a942b7626644674b7a56678930d054497b244ee7">
<img class="icon" src="images/sample-default-icon.png">
@@ -3684,6 +3706,9 @@
<div>
<a href="examples/extensions/talking_alarm_clock.zip">Download source</a>
<!-- Only show the Install CRX link if a CRX file is provided -->
+ <span>
+ - <a href="examples/extensions/talking_alarm_clock.crx">Install extension</a>
+ </span>
</div>
</div><div class="sample" id="e1697cacebad05218798bf3e8a0f724517f0e8c3">
<img class="icon" src="images/sample-default-icon.png">
@@ -3829,6 +3854,9 @@
<div>
<a href="examples/extensions/ttsdebug.zip">Download source</a>
<!-- Only show the Install CRX link if a CRX file is provided -->
+ <span>
+ - <a href="examples/extensions/ttsdebug.crx">Install extension</a>
+ </span>
</div>
</div><div class="sample" id="3a1baf15462bdae4d886c2da4ff8f35f4e8ce02f">
<img class="icon" src="examples/extensions/ttsdemo/128.png">
diff --git a/chrome/common/extensions/docs/samples.json b/chrome/common/extensions/docs/samples.json
index 6281eb2..491ee87 100644
--- a/chrome/common/extensions/docs/samples.json
+++ b/chrome/common/extensions/docs/samples.json
@@ -247,6 +247,7 @@
"chrome.extension.setUpdateUrlData": "extension.html#method-setUpdateUrlData",
"chrome.fileBrowserHandler.onExecute": "fileBrowserHandler.html#event-onExecute",
"chrome.fileBrowserHandler.selectFile": "fileBrowserHandler.html#method-selectFile",
+ "chrome.fileSystem.getDisplayPath": "fileSystem.html#method-getDisplayPath",
"chrome.history.addUrl": "history.html#method-addUrl",
"chrome.history.deleteAll": "history.html#method-deleteAll",
"chrome.history.deleteRange": "history.html#method-deleteRange",
@@ -707,7 +708,7 @@
"api_calls": [
"chrome.webRequest.onBeforeRequest"
],
- "crx_path": null,
+ "crx_path": "examples/extensions/catblock.crx",
"description": "I can't has cheezburger!",
"features": [
"background_page",
@@ -806,7 +807,7 @@
"chrome.browserAction.setTitle",
"chrome.extension.getURL"
],
- "crx_path": null,
+ "crx_path": "examples/extensions/buildbot.crx",
"description": "Displays the status of the Chromium buildbot in the toolbar. Click to see more detailed status in a popup.",
"features": [
"background_page",
@@ -1376,7 +1377,7 @@
"chrome.tabs.onUpdated",
"chrome.tabs.remove"
],
- "crx_path": null,
+ "crx_path": "examples/extensions/gdocs.crx",
"description": "Demonstrates how to use OAuth to connect the Google Documents List Data API.",
"features": [
"background_page",
@@ -1578,7 +1579,7 @@
"chrome.windows.create",
"chrome.windows.update"
],
- "crx_path": null,
+ "crx_path": "examples/extensions/imageinfo.crx",
"description": "Get image info for images, including EXIF data",
"features": [
"background_page",
@@ -1715,7 +1716,7 @@
"chrome.tabs.get",
"chrome.tabs.onUpdated"
],
- "crx_path": null,
+ "crx_path": "examples/extensions/mappy.crx",
"description": "Finds addresses in the web page you're on and pops up a map window.",
"features": [
"background_page",
@@ -1867,7 +1868,7 @@
"chrome.i18n.getMessage",
"chrome.tabs.create"
],
- "crx_path": null,
+ "crx_path": "examples/extensions/news_i18n.crx",
"description": "Displays the first 5 items from the 'Google News - top news' RSS feed in a popup.",
"features": [
"browser_action",
@@ -2079,7 +2080,7 @@
"chrome.windows.get",
"chrome.windows.getCurrent"
],
- "crx_path": null,
+ "crx_path": "examples/extensions/benchmark.crx",
"description": "Chromium Page Benchmarker.",
"features": [
"background_page",
@@ -2141,10 +2142,9 @@
"manifest.json",
"page_cycler.css",
"page_cycler.html",
- "page_cycler.js",
- "ui_page_cycler.js"
+ "page_cycler.js"
],
- "source_hash": "959ddab802b06128d041e2aa4d2437f005e81c4d",
+ "source_hash": "504348bff562ac22fafc405d58870f0acd61f004",
"zip_path": "examples/api/record/page_cycler.zip"
},
{
@@ -2413,7 +2413,7 @@
"chrome.windows.get",
"chrome.windows.getAll"
],
- "crx_path": null,
+ "crx_path": "examples/extensions/speak_selection.crx",
"description": "Speaks the current selection out loud.",
"features": [
"<all_urls>",
@@ -2563,7 +2563,7 @@
"chrome.tts.speak",
"chrome.tts.stop"
],
- "crx_path": null,
+ "crx_path": "examples/extensions/talking_alarm_clock.crx",
"description": "A clock with two configurable alarms that will play a sound and speak a phrase of your choice.",
"features": [
"background",
@@ -2662,7 +2662,7 @@
"chrome.tts.speak",
"chrome.tts.stop"
],
- "crx_path": null,
+ "crx_path": "examples/extensions/ttsdebug.crx",
"description": "Tool for developers of Chrome TTS engine extensions to help them test their engines are implementing the API correctly.",
"features": [
"tts"
@@ -2804,4 +2804,4 @@
"zip_path": "examples/api/extension/isAllowedAccess.zip"
}
]
-}
+} \ No newline at end of file
diff --git a/chrome/common/extensions/extension_permission_set.cc b/chrome/common/extensions/extension_permission_set.cc
index 52a292b..3d825c0 100644
--- a/chrome/common/extensions/extension_permission_set.cc
+++ b/chrome/common/extensions/extension_permission_set.cc
@@ -367,6 +367,14 @@ void ExtensionAPIPermission::RegisterAllPermissions(
info->RegisterPermission(
kSocket, "socket", 0, ExtensionPermissionMessage::kNone,
kFlagCannotBeOptional);
+ info->RegisterPermission(
+ kAudioCapture, "audioCapture",
+ IDS_EXTENSION_PROMPT_WARNING_AUDIO_CAPTURE,
+ ExtensionPermissionMessage::kAudioCapture, kFlagNone);
+ info->RegisterPermission(
+ kVideoCapture, "videoCapture",
+ IDS_EXTENSION_PROMPT_WARNING_VIDEO_CAPTURE,
+ ExtensionPermissionMessage::kVideoCapture, kFlagNone);
// Register aliases.
info->RegisterAlias("unlimitedStorage", kOldUnlimitedStoragePermission);
@@ -374,7 +382,6 @@ void ExtensionAPIPermission::RegisterAllPermissions(
// TODO(mihaip): Should be removed for the M20 branch, see
// http://crbug.com/120447 for more details.
info->RegisterAlias("background", kTemporaryBackgroundAlias);
-
}
//
diff --git a/chrome/common/extensions/extension_permission_set.h b/chrome/common/extensions/extension_permission_set.h
index 83c4f0e..2914bec 100644
--- a/chrome/common/extensions/extension_permission_set.h
+++ b/chrome/common/extensions/extension_permission_set.h
@@ -55,6 +55,8 @@ class ExtensionPermissionMessage {
kPrivacy,
kManagedMode,
kInput,
+ kAudioCapture,
+ kVideoCapture,
kEnumBoundary
};
@@ -102,6 +104,7 @@ class ExtensionAPIPermission {
kAlarms,
kAppNotifications,
kAppWindow,
+ kAudioCapture,
kBackground,
kBookmark,
kBrowsingData,
@@ -116,6 +119,7 @@ class ExtensionAPIPermission {
kDeclarative,
kDeclarativeWebRequest,
kDevtools,
+ kEchoPrivate,
kExperimental,
kFileBrowserHandler,
kFileBrowserPrivate,
@@ -131,7 +135,6 @@ class ExtensionAPIPermission {
kMediaPlayerPrivate,
kMetricsPrivate,
kNotification,
- kEchoPrivate,
kPageCapture,
kPlugin,
kPrivacy,
@@ -146,6 +149,7 @@ class ExtensionAPIPermission {
kTtsEngine,
kUnlimitedStorage,
kUsb,
+ kVideoCapture,
kWebNavigation,
kWebRequest,
kWebRequestBlocking,
diff --git a/chrome/common/extensions/extension_permission_set_unittest.cc b/chrome/common/extensions/extension_permission_set_unittest.cc
index b0020b5..7667b0a 100644
--- a/chrome/common/extensions/extension_permission_set_unittest.cc
+++ b/chrome/common/extensions/extension_permission_set_unittest.cc
@@ -620,9 +620,9 @@ TEST(ExtensionPermissionsTest, PermissionMessages) {
skip.insert(ExtensionAPIPermission::kDevtools);
// Platform apps. TODO(miket): must we skip?
+ skip.insert(ExtensionAPIPermission::kFileSystem);
skip.insert(ExtensionAPIPermission::kSocket);
skip.insert(ExtensionAPIPermission::kUsb);
- skip.insert(ExtensionAPIPermission::kFileSystem);
ExtensionPermissionsInfo* info = ExtensionPermissionsInfo::GetInstance();
ExtensionAPIPermissionSet permissions = info->GetAll();