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

Unified Diff: chrome/browser/extensions/api/media_gallery/media_gallery_api.cc

Issue 10704258: Add extension permissions for Media Gallery API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comment Created 8 years, 5 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: chrome/browser/extensions/api/media_gallery/media_gallery_api.cc
diff --git a/chrome/browser/extensions/api/media_gallery/media_gallery_api.cc b/chrome/browser/extensions/api/media_gallery/media_gallery_api.cc
index 15698f6081fcc0582d9248ec50199fa61e7e28ee..6990056754705e9862922f0a89de65250727feb9 100644
--- a/chrome/browser/extensions/api/media_gallery/media_gallery_api.cc
+++ b/chrome/browser/extensions/api/media_gallery/media_gallery_api.cc
@@ -52,11 +52,16 @@ bool GetMediaFileSystemsFunction::RunImpl() {
"dirname", Value::CreateStringValue("_"));
list->Append(dict_value);
- content::ChildProcessSecurityPolicy* policy =
- ChildProcessSecurityPolicy::GetInstance();
- if (!policy->CanReadFile(child_id, path))
- policy->GrantReadFile(child_id, path);
- policy->GrantReadFileSystem(child_id, fsid);
+
+ if (GetExtension()->HasAPIPermission(
+ extensions::APIPermission::kMediaGalleriesRead)) {
+ content::ChildProcessSecurityPolicy* policy =
+ ChildProcessSecurityPolicy::GetInstance();
+ if (!policy->CanReadFile(child_id, path))
+ policy->GrantReadFile(child_id, path);
+ policy->GrantReadFileSystem(child_id, fsid);
+ }
Matt Perry 2012/07/24 00:21:07 What happens if the extension doesn't have read pe
vandebo (ex-Chrome) 2012/07/24 00:32:57 It's an implementation detail that we could get he
Matt Perry 2012/07/24 00:51:20 But an extension could get here by only requesting
vandebo (ex-Chrome) 2012/07/24 01:07:59 Correct. That's not an error. But right now, onl
+ // TODO(vandebo) Handle write permission.
}
SetResult(list);

Powered by Google App Engine
This is Rietveld 408576698