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

Unified Diff: chrome/browser/extensions/api/file_system/file_system_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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/file_system/file_system_api.cc
diff --git a/chrome/browser/extensions/api/file_system/file_system_api.cc b/chrome/browser/extensions/api/file_system/file_system_api.cc
index 871125e0030030d2aab9d8263ef184ef5e896dbb..37a59c2503077665c8313e9151fcbdc31b9d5d21 100644
--- a/chrome/browser/extensions/api/file_system/file_system_api.cc
+++ b/chrome/browser/extensions/api/file_system/file_system_api.cc
@@ -22,6 +22,8 @@
#include "webkit/fileapi/file_system_util.h"
#include "webkit/fileapi/isolated_context.h"
+using fileapi::IsolatedContext;
+
const char kInvalidParameters[] = "Invalid parameters";
const char kSecurityError[] = "Security error";
const char kInvalidCallingPage[] = "Invalid calling page";
@@ -102,10 +104,10 @@ bool GetFilePathOfFileEntry(const std::string& filesystem_name,
return false;
}
- fileapi::IsolatedContext* context = fileapi::IsolatedContext::GetInstance();
+ IsolatedContext* context = IsolatedContext::GetInstance();
FilePath relative_path = FilePath::FromUTF8Unsafe(filesystem_path);
- FilePath virtual_path = context->CreateVirtualPath(filesystem_id,
- relative_path);
+ FilePath virtual_path = context->CreateVirtualRootPath(filesystem_id)
+ .Append(relative_path);
if (!context->CrackIsolatedPath(virtual_path,
&filesystem_id,
NULL,
@@ -176,14 +178,14 @@ void FileSystemEntryFunction::CheckWritableFile(const FilePath& path) {
void FileSystemEntryFunction::RegisterFileSystemAndSendResponse(
const FilePath& path, EntryType entry_type) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
- std::set<FilePath> filesets;
- filesets.insert(path);
fileapi::IsolatedContext* isolated_context =
fileapi::IsolatedContext::GetInstance();
DCHECK(isolated_context);
- std::string filesystem_id = isolated_context->RegisterIsolatedFileSystem(
- filesets);
+
+ std::string registered_name;
+ std::string filesystem_id = isolated_context->RegisterFileSystemForFile(
+ path, &registered_name);
content::ChildProcessSecurityPolicy* policy =
content::ChildProcessSecurityPolicy::GetInstance();
@@ -202,7 +204,7 @@ void FileSystemEntryFunction::RegisterFileSystemAndSendResponse(
DictionaryValue* dict = new DictionaryValue();
result_.reset(dict);
dict->SetString("fileSystemId", filesystem_id);
- dict->SetString("baseName", path.BaseName().AsUTF8Unsafe());
+ dict->SetString("baseName", registered_name);
SendResponse(true);
}
« no previous file with comments | « chrome/browser/extensions/api/app/app_api.cc ('k') | chrome/browser/extensions/api/media_gallery/media_gallery_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698