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

Side by Side Diff: chrome/browser/extensions/api/media_gallery/media_gallery_api.cc

Issue 10713007: Make isolated file system works for a device root (e.g. X:\\) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Implements the Chrome Extensions Media Galleries API. 5 // Implements the Chrome Extensions Media Galleries API.
6 6
7 #include "chrome/browser/extensions/api/media_gallery/media_gallery_api.h" 7 #include "chrome/browser/extensions/api/media_gallery/media_gallery_api.h"
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 25 matching lines...) Expand all
36 36
37 const int child_id = rph->GetID(); 37 const int child_id = rph->GetID();
38 base::ListValue* list = new base::ListValue(); 38 base::ListValue* list = new base::ListValue();
39 for (size_t i = 0; i < filesystems.size(); i++) { 39 for (size_t i = 0; i < filesystems.size(); i++) {
40 // TODO(thestig) Check permissions to file systems when that capability 40 // TODO(thestig) Check permissions to file systems when that capability
41 // exists. 41 // exists.
42 const MediaFileSystemRegistry::MediaFSIDAndPath& fsid_and_path = 42 const MediaFileSystemRegistry::MediaFSIDAndPath& fsid_and_path =
43 filesystems[i]; 43 filesystems[i];
44 const std::string& fsid = fsid_and_path.first; 44 const std::string& fsid = fsid_and_path.first;
45 const FilePath& path = fsid_and_path.second; 45 const FilePath& path = fsid_and_path.second;
46 const std::string basepath_utf8(path.BaseName().AsUTF8Unsafe());
47 46
48 base::DictionaryValue* dict_value = new base::DictionaryValue(); 47 base::DictionaryValue* dict_value = new base::DictionaryValue();
49 dict_value->SetWithoutPathExpansion( 48 dict_value->SetWithoutPathExpansion(
50 "fsid", Value::CreateStringValue(fsid)); 49 "fsid", Value::CreateStringValue(fsid));
50 // The directory name is not exposed to the js layer.
51 dict_value->SetWithoutPathExpansion( 51 dict_value->SetWithoutPathExpansion(
52 "dirname", Value::CreateStringValue(basepath_utf8)); 52 "dirname", Value::CreateStringValue("_"));
53 list->Append(dict_value); 53 list->Append(dict_value);
54 54
55 content::ChildProcessSecurityPolicy* policy = 55 content::ChildProcessSecurityPolicy* policy =
56 ChildProcessSecurityPolicy::GetInstance(); 56 ChildProcessSecurityPolicy::GetInstance();
57 if (!policy->CanReadFile(child_id, path)) 57 if (!policy->CanReadFile(child_id, path))
58 policy->GrantReadFile(child_id, path); 58 policy->GrantReadFile(child_id, path);
59 policy->GrantReadFileSystem(child_id, fsid); 59 policy->GrantReadFileSystem(child_id, fsid);
60 } 60 }
61 61
62 result_.reset(list); 62 result_.reset(list);
(...skipping 10 matching lines...) Expand all
73 73
74 AssembleMediaFileFunction::~AssembleMediaFileFunction() {} 74 AssembleMediaFileFunction::~AssembleMediaFileFunction() {}
75 75
76 bool AssembleMediaFileFunction::RunImpl() { 76 bool AssembleMediaFileFunction::RunImpl() {
77 // TODO(vandebo) Update the metadata and return the new file. 77 // TODO(vandebo) Update the metadata and return the new file.
78 result_.reset(Value::CreateNullValue()); 78 result_.reset(Value::CreateNullValue());
79 return true; 79 return true;
80 } 80 }
81 81
82 } // namespace extensions 82 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/file_system/file_system_api.cc ('k') | chrome/browser/extensions/platform_app_launcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698