OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "modules/cachestorage/InspectorCacheStorageAgent.h" | 5 #include "modules/cachestorage/InspectorCacheStorageAgent.h" |
6 | 6 |
7 #include "platform/heap/Handle.h" | 7 #include "platform/heap/Handle.h" |
8 #include "platform/weborigin/KURL.h" | 8 #include "platform/weborigin/KURL.h" |
9 #include "platform/weborigin/SecurityOrigin.h" | 9 #include "platform/weborigin/SecurityOrigin.h" |
10 #include "public/platform/Platform.h" | 10 #include "public/platform/Platform.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 Response assertCacheStorage( | 67 Response assertCacheStorage( |
68 const String& securityOrigin, | 68 const String& securityOrigin, |
69 std::unique_ptr<WebServiceWorkerCacheStorage>& result) { | 69 std::unique_ptr<WebServiceWorkerCacheStorage>& result) { |
70 RefPtr<SecurityOrigin> secOrigin = | 70 RefPtr<SecurityOrigin> secOrigin = |
71 SecurityOrigin::createFromString(securityOrigin); | 71 SecurityOrigin::createFromString(securityOrigin); |
72 | 72 |
73 // Cache Storage API is restricted to trustworthy origins. | 73 // Cache Storage API is restricted to trustworthy origins. |
74 if (!secOrigin->isPotentiallyTrustworthy()) | 74 if (!secOrigin->isPotentiallyTrustworthy()) |
75 return Response::Error(secOrigin->isPotentiallyTrustworthyErrorMessage()); | 75 return Response::Error(secOrigin->isPotentiallyTrustworthyErrorMessage()); |
76 | 76 |
77 std::unique_ptr<WebServiceWorkerCacheStorage> cache = wrapUnique( | 77 std::unique_ptr<WebServiceWorkerCacheStorage> cache = WTF::wrapUnique( |
78 Platform::current()->cacheStorage(WebSecurityOrigin(secOrigin))); | 78 Platform::current()->cacheStorage(WebSecurityOrigin(secOrigin))); |
79 if (!cache) | 79 if (!cache) |
80 return Response::Error("Could not find cache storage."); | 80 return Response::Error("Could not find cache storage."); |
81 result = std::move(cache); | 81 result = std::move(cache); |
82 return Response::OK(); | 82 return Response::OK(); |
83 } | 83 } |
84 | 84 |
85 Response assertCacheStorageAndNameForId( | 85 Response assertCacheStorageAndNameForId( |
86 const String& cacheId, | 86 const String& cacheId, |
87 String* cacheName, | 87 String* cacheName, |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 if (!response.isSuccess()) { | 484 if (!response.isSuccess()) { |
485 callback->sendFailure(response); | 485 callback->sendFailure(response); |
486 return; | 486 return; |
487 } | 487 } |
488 cache->dispatchOpen(WTF::makeUnique<GetCacheForDeleteEntry>( | 488 cache->dispatchOpen(WTF::makeUnique<GetCacheForDeleteEntry>( |
489 request, cacheName, std::move(callback)), | 489 request, cacheName, std::move(callback)), |
490 WebString(cacheName)); | 490 WebString(cacheName)); |
491 } | 491 } |
492 | 492 |
493 } // namespace blink | 493 } // namespace blink |
OLD | NEW |