Commit 93e8d409 authored by Zhuoyu Qian's avatar Zhuoyu Qian Committed by Commit Bot

Change GetUsageCachePathForOriginAndType to use url::Origin.

Update the function GetUsageCachePathForOriginAndType to use dedicated
Origin type instead of GURL.

Bug: 598424
Change-Id: I05ddacce6d15c9d6125b92e425cc79b251e26b7f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2004356
Commit-Queue: Victor Costan <pwnall@chromium.org>
Reviewed-by: default avatarVictor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#732545}
parent 94c8ccce
......@@ -152,7 +152,7 @@ base::File::Error QuotaBackendImpl::GetUsageCachePath(
base::File::Error error = base::File::FILE_OK;
*usage_file_path =
SandboxFileSystemBackendDelegate::GetUsageCachePathForOriginAndType(
obfuscated_file_util_, origin.GetURL(), type, &error);
obfuscated_file_util_, origin, type, &error);
return error;
}
......
......@@ -526,7 +526,7 @@ void SandboxFileSystemBackendDelegate::InvalidateUsageCache(
FileSystemType type) {
base::File::Error error = base::File::FILE_OK;
base::FilePath usage_file_path = GetUsageCachePathForOriginAndType(
obfuscated_file_util(), origin, type, &error);
obfuscated_file_util(), url::Origin::Create(origin), type, &error);
if (error != base::File::FILE_OK)
return;
usage_cache()->IncrementDirty(usage_file_path);
......@@ -595,11 +595,11 @@ bool SandboxFileSystemBackendDelegate::IsAllowedScheme(const GURL& url) const {
base::FilePath
SandboxFileSystemBackendDelegate::GetUsageCachePathForOriginAndType(
const GURL& origin_url,
const url::Origin& origin,
FileSystemType type) {
base::File::Error error;
base::FilePath path = GetUsageCachePathForOriginAndType(
obfuscated_file_util(), origin_url, type, &error);
obfuscated_file_util(), origin, type, &error);
if (error != base::File::FILE_OK)
return base::FilePath();
return path;
......@@ -609,14 +609,13 @@ SandboxFileSystemBackendDelegate::GetUsageCachePathForOriginAndType(
base::FilePath
SandboxFileSystemBackendDelegate::GetUsageCachePathForOriginAndType(
ObfuscatedFileUtil* sandbox_file_util,
const GURL& origin_url,
const url::Origin& origin,
FileSystemType type,
base::File::Error* error_out) {
DCHECK(error_out);
*error_out = base::File::FILE_OK;
base::FilePath base_path = sandbox_file_util->GetDirectoryForOriginAndType(
url::Origin::Create(origin_url), GetTypeString(type), false /* create */,
error_out);
origin, GetTypeString(type), false /* create */, error_out);
if (*error_out != base::File::FILE_OK)
return base::FilePath();
return base_path.Append(FileSystemUsageCache::kUsageFileName);
......
......@@ -219,13 +219,13 @@ class COMPONENT_EXPORT(STORAGE_BROWSER) SandboxFileSystemBackendDelegate
bool IsAllowedScheme(const GURL& url) const;
// Returns a path to the usage cache file.
base::FilePath GetUsageCachePathForOriginAndType(const GURL& origin_url,
base::FilePath GetUsageCachePathForOriginAndType(const url::Origin& origin,
FileSystemType type);
// Returns a path to the usage cache file (static version).
static base::FilePath GetUsageCachePathForOriginAndType(
ObfuscatedFileUtil* sandbox_file_util,
const GURL& origin_url,
const url::Origin& origin,
FileSystemType type,
base::File::Error* error_out);
......
......@@ -98,7 +98,7 @@ base::FilePath SandboxQuotaObserver::GetUsageCachePath(
base::File::Error error = base::File::FILE_OK;
base::FilePath path =
SandboxFileSystemBackendDelegate::GetUsageCachePathForOriginAndType(
sandbox_file_util_, url.origin().GetURL(), url.type(), &error);
sandbox_file_util_, url.origin(), url.type(), &error);
if (error != base::File::FILE_OK) {
LOG(WARNING) << "Could not get usage cache path for: " << url.DebugString();
return base::FilePath();
......
......@@ -86,8 +86,8 @@ base::FilePath SandboxFileSystemTestHelper::GetLocalPathFromASCII(
}
base::FilePath SandboxFileSystemTestHelper::GetUsageCachePath() const {
return file_system_context_->sandbox_delegate()->
GetUsageCachePathForOriginAndType(origin_, type_);
return file_system_context_->sandbox_delegate()
->GetUsageCachePathForOriginAndType(url::Origin::Create(origin_), type_);
}
FileSystemURL SandboxFileSystemTestHelper::CreateURL(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment