summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/fileapi/file_system_backend.cc
diff options
context:
space:
mode:
authormtomasz <mtomasz@chromium.org>2015-03-17 23:45:27 -0700
committerCommit bot <commit-bot@chromium.org>2015-03-18 06:46:18 +0000
commita6775bea054270edd81d57f769ff1e22edb2fe13 (patch)
treea77c76a300736b4707078e52b0049d16bbcf6ff6 /chrome/browser/chromeos/fileapi/file_system_backend.cc
parente232abb7d549a2acff45aa610efe5c4373a7b409 (diff)
downloadchromium_src-a6775bea054270edd81d57f769ff1e22edb2fe13.zip
chromium_src-a6775bea054270edd81d57f769ff1e22edb2fe13.tar.gz
chromium_src-a6775bea054270edd81d57f769ff1e22edb2fe13.tar.bz2
Remove granting permissions on behalf of Files app.
Files app is not available for some tests, and granting full permissions was an overkill, as we grant only permissions to requested resources. TEST=All current tests pass. BUG=440674 Review URL: https://codereview.chromium.org/1013963002 Cr-Commit-Position: refs/heads/master@{#321088}
Diffstat (limited to 'chrome/browser/chromeos/fileapi/file_system_backend.cc')
-rw-r--r--chrome/browser/chromeos/fileapi/file_system_backend.cc33
1 files changed, 18 insertions, 15 deletions
diff --git a/chrome/browser/chromeos/fileapi/file_system_backend.cc b/chrome/browser/chromeos/fileapi/file_system_backend.cc
index 28c1793..a0a7580 100644
--- a/chrome/browser/chromeos/fileapi/file_system_backend.cc
+++ b/chrome/browser/chromeos/fileapi/file_system_backend.cc
@@ -173,6 +173,10 @@ bool FileSystemBackend::IsAccessAllowed(
if (!CanHandleURL(url))
return false;
+ // If there is no origin set, then it's an internal access.
+ if (url.origin().is_empty())
+ return true;
+
std::string extension_id = url.origin().host();
// TODO(mtomasz): Temporarily whitelist TimeScapes. Remove this in M-31.
// See: crbug.com/271946
@@ -190,17 +194,6 @@ bool FileSystemBackend::IsAccessAllowed(
url.virtual_path());
}
-void FileSystemBackend::GrantFullAccessToExtension(
- const std::string& extension_id) {
- if (!special_storage_policy_.get())
- return;
- if (!special_storage_policy_->IsFileHandler(extension_id)) {
- NOTREACHED();
- return;
- }
- file_access_permissions_->GrantFullAccessPermission(extension_id);
-}
-
void FileSystemBackend::GrantFileAccessToExtension(
const std::string& extension_id, const base::FilePath& virtual_path) {
if (!special_storage_policy_.get())
@@ -396,16 +389,15 @@ scoped_ptr<storage::FileStreamWriter> FileSystemBackend::CreateFileStreamWriter(
return scoped_ptr<storage::FileStreamWriter>();
}
-bool FileSystemBackend::GetVirtualPath(
- const base::FilePath& filesystem_path,
- base::FilePath* virtual_path) {
+bool FileSystemBackend::GetVirtualPath(const base::FilePath& filesystem_path,
+ base::FilePath* virtual_path) const {
return mount_points_->GetVirtualPath(filesystem_path, virtual_path) ||
system_mount_points_->GetVirtualPath(filesystem_path, virtual_path);
}
void FileSystemBackend::GetRedirectURLForContents(
const storage::FileSystemURL& url,
- const storage::URLCallback& callback) {
+ const storage::URLCallback& callback) const {
DCHECK(url.is_valid());
if (!IsAccessAllowed(url))
@@ -432,4 +424,15 @@ void FileSystemBackend::GetRedirectURLForContents(
callback.Run(GURL());
}
+storage::FileSystemURL FileSystemBackend::CreateInternalURL(
+ storage::FileSystemContext* context,
+ const base::FilePath& entry_path) const {
+ base::FilePath virtual_path;
+ if (!GetVirtualPath(entry_path, &virtual_path))
+ return storage::FileSystemURL();
+
+ return context->CreateCrackedFileSystemURL(
+ GURL() /* origin */, storage::kFileSystemTypeExternal, virtual_path);
+}
+
} // namespace chromeos