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

Unified Diff: chrome/browser/extensions/api/sync_file_system/sync_file_system_api.cc

Issue 11787028: New FileSystemURL cracking (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test on Win Created 7 years, 11 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/sync_file_system/sync_file_system_api.cc
diff --git a/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.cc b/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.cc
index f652f1f34998f7328061b999950670f257c6079e..5cbeeb24b5d902c88b817e182326f41fccb524ca 100644
--- a/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.cc
+++ b/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.cc
@@ -86,15 +86,17 @@ bool IsValidServiceName(const std::string& service_name, std::string* error) {
bool SyncFileSystemDeleteFileSystemFunction::RunImpl() {
std::string url;
EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &url));
- fileapi::FileSystemURL file_system_url((GURL(url)));
- if (!IsValidServiceName(file_system_url.filesystem_id(), &error_)) {
- return false;
- }
scoped_refptr<fileapi::FileSystemContext> file_system_context =
BrowserContext::GetStoragePartition(
profile(),
render_view_host()->GetSiteInstance())->GetFileSystemContext();
+ fileapi::FileSystemURL file_system_url(
+ file_system_context->CrackURL(GURL(url)));
+
+ if (!IsValidServiceName(file_system_url.filesystem_id(), &error_))
+ return false;
+
BrowserThread::PostTask(
BrowserThread::IO,
FROM_HERE,
@@ -209,10 +211,16 @@ void SyncFileSystemRequestFileSystemFunction::DidOpenFileSystem(
bool SyncFileSystemGetUsageAndQuotaFunction::RunImpl() {
std::string url;
EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &url));
- fileapi::FileSystemURL file_system_url((GURL(url)));
- if (!IsValidServiceName(file_system_url.filesystem_id(), &error_)) {
+
+ scoped_refptr<fileapi::FileSystemContext> file_system_context =
+ BrowserContext::GetStoragePartition(
+ profile(),
+ render_view_host()->GetSiteInstance())->GetFileSystemContext();
+ fileapi::FileSystemURL file_system_url(
+ file_system_context->CrackURL(GURL(url)));
+
+ if (!IsValidServiceName(file_system_url.filesystem_id(), &error_))
return false;
- }
scoped_refptr<quota::QuotaManager> quota_manager =
BrowserContext::GetStoragePartition(
@@ -235,7 +243,13 @@ bool SyncFileSystemGetUsageAndQuotaFunction::RunImpl() {
bool SyncFileSystemGetFileSyncStatusFunction::RunImpl() {
std::string url;
EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &url));
- fileapi::FileSystemURL file_system_url((GURL(url)));
+
+ scoped_refptr<fileapi::FileSystemContext> file_system_context =
+ BrowserContext::GetStoragePartition(
+ profile(),
+ render_view_host()->GetSiteInstance())->GetFileSystemContext();
+ fileapi::FileSystemURL file_system_url(
+ file_system_context->CrackURL(GURL(url)));
SyncFileSystemServiceFactory::GetForProfile(profile())->GetFileSyncStatus(
file_system_url,

Powered by Google App Engine
This is Rietveld 408576698