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

Unified Diff: chrome/browser/extensions/api/media_galleries/media_galleries_api.cc

Issue 10827057: Plumb file system name down from MediaFileSystemRegistry. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments 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
« no previous file with comments | « no previous file | chrome/browser/media_gallery/media_file_system_registry.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/media_galleries/media_galleries_api.cc
diff --git a/chrome/browser/extensions/api/media_galleries/media_galleries_api.cc b/chrome/browser/extensions/api/media_galleries/media_galleries_api.cc
index d7e52b96a787244920de9b659069e0cf3397c3f7..0aa3eb0cccd5a461856b49933992d30c4eb992c2 100644
--- a/chrome/browser/extensions/api/media_galleries/media_galleries_api.cc
+++ b/chrome/browser/extensions/api/media_galleries/media_galleries_api.cc
@@ -59,35 +59,27 @@ bool MediaGalleriesGetMediaFileSystemsFunction::RunImpl() {
const content::RenderProcessHost* rph = render_view_host()->GetProcess();
chrome::MediaFileSystemRegistry* media_fs_registry =
MediaFileSystemRegistry::GetInstance();
- const std::vector<MediaFileSystemRegistry::MediaFSIDAndPath> filesystems =
- media_fs_registry->GetMediaFileSystems(rph, *GetExtension());
+ const std::vector<MediaFileSystemRegistry::MediaFSInfo> filesystems =
+ media_fs_registry->GetMediaFileSystemsForExtension(rph, *GetExtension());
const int child_id = rph->GetID();
base::ListValue* list = new base::ListValue();
for (size_t i = 0; i < filesystems.size(); i++) {
- // TODO(thestig) Check permissions to file systems when that capability
- // exists.
- const MediaFileSystemRegistry::MediaFSIDAndPath& fsid_and_path =
- filesystems[i];
- const std::string& fsid = fsid_and_path.first;
- const FilePath& path = fsid_and_path.second;
-
base::DictionaryValue* dict_value = new base::DictionaryValue();
dict_value->SetWithoutPathExpansion(
- "fsid", Value::CreateStringValue(fsid));
+ "fsid", Value::CreateStringValue(filesystems[i].fsid));
// The directory name is not exposed to the js layer.
dict_value->SetWithoutPathExpansion(
- "dirname", Value::CreateStringValue("_"));
+ "name", Value::CreateStringValue(filesystems[i].name));
list->Append(dict_value);
-
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);
+ if (!policy->CanReadFile(child_id, filesystems[i].path))
+ policy->GrantReadFile(child_id, filesystems[i].path);
+ policy->GrantReadFileSystem(child_id, filesystems[i].fsid);
}
// TODO(vandebo) Handle write permission.
}
« no previous file with comments | « no previous file | chrome/browser/media_gallery/media_file_system_registry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698