Index: content/browser/cache_storage/cache_storage_dispatcher_host.cc |
diff --git a/content/browser/cache_storage/cache_storage_dispatcher_host.cc b/content/browser/cache_storage/cache_storage_dispatcher_host.cc |
index b53495c37c4221df7c36aad4719b3541d435402e..f371be943dcc6bee56459ecd8c0c1f542a11b20a 100644 |
--- a/content/browser/cache_storage/cache_storage_dispatcher_host.cc |
+++ b/content/browser/cache_storage/cache_storage_dispatcher_host.cc |
@@ -22,6 +22,8 @@ |
#include "content/public/common/origin_util.h" |
#include "storage/browser/blob/blob_data_handle.h" |
#include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerCacheError.h" |
+#include "url/gurl.h" |
+#include "url/origin.h" |
namespace content { |
@@ -52,8 +54,8 @@ blink::WebServiceWorkerCacheError ToWebServiceWorkerCacheError( |
return blink::WebServiceWorkerCacheErrorNotImplemented; |
} |
-bool OriginCanAccessCacheStorage(const GURL& url) { |
- return IsOriginSecure(url); |
+bool OriginCanAccessCacheStorage(const url::Origin& origin) { |
+ return !origin.unique() && IsOriginSecure(GURL(origin.Serialize())); |
} |
} // namespace |
@@ -114,7 +116,7 @@ void CacheStorageDispatcherHost::CreateCacheListener( |
void CacheStorageDispatcherHost::OnCacheStorageHas( |
int thread_id, |
int request_id, |
- const GURL& origin, |
+ const url::Origin& origin, |
const base::string16& cache_name) { |
TRACE_EVENT0("CacheStorage", "CacheStorageDispatcherHost::OnCacheStorageHas"); |
if (!OriginCanAccessCacheStorage(origin)) { |
@@ -122,7 +124,7 @@ void CacheStorageDispatcherHost::OnCacheStorageHas( |
return; |
} |
context_->cache_manager()->HasCache( |
- origin, base::UTF16ToUTF8(cache_name), |
+ GURL(origin.Serialize()), base::UTF16ToUTF8(cache_name), |
base::Bind(&CacheStorageDispatcherHost::OnCacheStorageHasCallback, this, |
thread_id, request_id)); |
} |
@@ -130,7 +132,7 @@ void CacheStorageDispatcherHost::OnCacheStorageHas( |
void CacheStorageDispatcherHost::OnCacheStorageOpen( |
int thread_id, |
int request_id, |
- const GURL& origin, |
+ const url::Origin& origin, |
const base::string16& cache_name) { |
TRACE_EVENT0("CacheStorage", |
"CacheStorageDispatcherHost::OnCacheStorageOpen"); |
@@ -139,7 +141,7 @@ void CacheStorageDispatcherHost::OnCacheStorageOpen( |
return; |
} |
context_->cache_manager()->OpenCache( |
- origin, base::UTF16ToUTF8(cache_name), |
+ GURL(origin.Serialize()), base::UTF16ToUTF8(cache_name), |
base::Bind(&CacheStorageDispatcherHost::OnCacheStorageOpenCallback, this, |
thread_id, request_id)); |
} |
@@ -147,7 +149,7 @@ void CacheStorageDispatcherHost::OnCacheStorageOpen( |
void CacheStorageDispatcherHost::OnCacheStorageDelete( |
int thread_id, |
int request_id, |
- const GURL& origin, |
+ const url::Origin& origin, |
const base::string16& cache_name) { |
TRACE_EVENT0("CacheStorage", |
"CacheStorageDispatcherHost::OnCacheStorageDelete"); |
@@ -156,14 +158,14 @@ void CacheStorageDispatcherHost::OnCacheStorageDelete( |
return; |
} |
context_->cache_manager()->DeleteCache( |
- origin, base::UTF16ToUTF8(cache_name), |
+ GURL(origin.Serialize()), base::UTF16ToUTF8(cache_name), |
base::Bind(&CacheStorageDispatcherHost::OnCacheStorageDeleteCallback, |
this, thread_id, request_id)); |
} |
void CacheStorageDispatcherHost::OnCacheStorageKeys(int thread_id, |
int request_id, |
- const GURL& origin) { |
+ const url::Origin& origin) { |
TRACE_EVENT0("CacheStorage", |
"CacheStorageDispatcherHost::OnCacheStorageKeys"); |
if (!OriginCanAccessCacheStorage(origin)) { |
@@ -171,7 +173,7 @@ void CacheStorageDispatcherHost::OnCacheStorageKeys(int thread_id, |
return; |
} |
context_->cache_manager()->EnumerateCaches( |
- origin, |
+ GURL(origin.Serialize()), |
base::Bind(&CacheStorageDispatcherHost::OnCacheStorageKeysCallback, this, |
thread_id, request_id)); |
} |
@@ -179,7 +181,7 @@ void CacheStorageDispatcherHost::OnCacheStorageKeys(int thread_id, |
void CacheStorageDispatcherHost::OnCacheStorageMatch( |
int thread_id, |
int request_id, |
- const GURL& origin, |
+ const url::Origin& origin, |
const ServiceWorkerFetchRequest& request, |
const CacheStorageCacheQueryParams& match_params) { |
TRACE_EVENT0("CacheStorage", |
@@ -195,13 +197,13 @@ void CacheStorageDispatcherHost::OnCacheStorageMatch( |
if (match_params.cache_name.empty()) { |
context_->cache_manager()->MatchAllCaches( |
- origin, std::move(scoped_request), |
+ GURL(origin.Serialize()), std::move(scoped_request), |
base::Bind(&CacheStorageDispatcherHost::OnCacheStorageMatchCallback, |
this, thread_id, request_id)); |
return; |
} |
context_->cache_manager()->MatchCache( |
- origin, base::UTF16ToUTF8(match_params.cache_name), |
+ GURL(origin.Serialize()), base::UTF16ToUTF8(match_params.cache_name), |
std::move(scoped_request), |
base::Bind(&CacheStorageDispatcherHost::OnCacheStorageMatchCallback, this, |
thread_id, request_id)); |