| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 Response AssertCacheStorage( | 68 Response AssertCacheStorage( |
| 69 const String& security_origin, | 69 const String& security_origin, |
| 70 std::unique_ptr<WebServiceWorkerCacheStorage>& result) { | 70 std::unique_ptr<WebServiceWorkerCacheStorage>& result) { |
| 71 RefPtr<SecurityOrigin> sec_origin = | 71 RefPtr<SecurityOrigin> sec_origin = |
| 72 SecurityOrigin::CreateFromString(security_origin); | 72 SecurityOrigin::CreateFromString(security_origin); |
| 73 | 73 |
| 74 // Cache Storage API is restricted to trustworthy origins. | 74 // Cache Storage API is restricted to trustworthy origins. |
| 75 if (!sec_origin->IsPotentiallyTrustworthy()) | 75 if (!sec_origin->IsPotentiallyTrustworthy()) |
| 76 return Response::Error(sec_origin->IsPotentiallyTrustworthyErrorMessage()); | 76 return Response::Error(sec_origin->IsPotentiallyTrustworthyErrorMessage()); |
| 77 | 77 |
| 78 std::unique_ptr<WebServiceWorkerCacheStorage> cache = WTF::WrapUnique( | 78 std::unique_ptr<WebServiceWorkerCacheStorage> cache = |
| 79 Platform::Current()->CacheStorage(WebSecurityOrigin(sec_origin))); | 79 Platform::Current()->CreateCacheStorage(WebSecurityOrigin(sec_origin)); |
| 80 if (!cache) | 80 if (!cache) |
| 81 return Response::Error("Could not find cache storage."); | 81 return Response::Error("Could not find cache storage."); |
| 82 result = std::move(cache); | 82 result = std::move(cache); |
| 83 return Response::OK(); | 83 return Response::OK(); |
| 84 } | 84 } |
| 85 | 85 |
| 86 Response AssertCacheStorageAndNameForId( | 86 Response AssertCacheStorageAndNameForId( |
| 87 const String& cache_id, | 87 const String& cache_id, |
| 88 String* cache_name, | 88 String* cache_name, |
| 89 std::unique_ptr<WebServiceWorkerCacheStorage>& result) { | 89 std::unique_ptr<WebServiceWorkerCacheStorage>& result) { |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 if (!response.isSuccess()) { | 486 if (!response.isSuccess()) { |
| 487 callback->sendFailure(response); | 487 callback->sendFailure(response); |
| 488 return; | 488 return; |
| 489 } | 489 } |
| 490 cache->DispatchOpen(WTF::MakeUnique<GetCacheForDeleteEntry>( | 490 cache->DispatchOpen(WTF::MakeUnique<GetCacheForDeleteEntry>( |
| 491 request, cache_name, std::move(callback)), | 491 request, cache_name, std::move(callback)), |
| 492 WebString(cache_name)); | 492 WebString(cache_name)); |
| 493 } | 493 } |
| 494 | 494 |
| 495 } // namespace blink | 495 } // namespace blink |
| OLD | NEW |