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

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: Created 8 years, 6 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 d70eea3cd5feda788bd7bec34a7e616e99e31873..3802eea3f44cc414767ee85c2bc734800eee7f15 100644
--- a/chrome/browser/extensions/api/file_system/file_system_api.cc
+++ b/chrome/browser/extensions/api/file_system/file_system_api.cc
@@ -19,6 +19,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";
@@ -56,10 +58,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,
@@ -252,14 +254,13 @@ void FileSystemPickerFunction::CheckWritableFile(const FilePath& path) {
void FileSystemPickerFunction::RegisterFileSystemAndSendResponse(
const FilePath& path, bool for_save) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
- std::set<FilePath> filesets;
- filesets.insert(path);
- fileapi::IsolatedContext* isolated_context =
- fileapi::IsolatedContext::GetInstance();
+ IsolatedContext* isolated_context = IsolatedContext::GetInstance();
+ std::string file_name = IsolatedContext::GetNameForPath(path);
+
DCHECK(isolated_context);
- std::string filesystem_id = isolated_context->RegisterIsolatedFileSystem(
- filesets);
+ std::string filesystem_id = isolated_context->RegisterFileSystemForFile(
+ file_name, path);
content::ChildProcessSecurityPolicy* policy =
content::ChildProcessSecurityPolicy::GetInstance();
@@ -278,7 +279,7 @@ void FileSystemPickerFunction::RegisterFileSystemAndSendResponse(
DictionaryValue* dict = new DictionaryValue();
result_.reset(dict);
dict->SetString("fileSystemId", filesystem_id);
- dict->SetString("baseName", path.BaseName().AsUTF8Unsafe());
+ dict->SetString("baseName", file_name);
SendResponse(true);
}

Powered by Google App Engine
This is Rietveld 408576698