| 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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 } | 414 } |
| 415 | 415 |
| 416 void InspectorCacheStorageAgent::requestCacheNames( | 416 void InspectorCacheStorageAgent::requestCacheNames( |
| 417 const String& securityOrigin, | 417 const String& securityOrigin, |
| 418 std::unique_ptr<RequestCacheNamesCallback> callback) { | 418 std::unique_ptr<RequestCacheNamesCallback> callback) { |
| 419 RefPtr<SecurityOrigin> secOrigin = | 419 RefPtr<SecurityOrigin> secOrigin = |
| 420 SecurityOrigin::createFromString(securityOrigin); | 420 SecurityOrigin::createFromString(securityOrigin); |
| 421 | 421 |
| 422 // Cache Storage API is restricted to trustworthy origins. | 422 // Cache Storage API is restricted to trustworthy origins. |
| 423 if (!secOrigin->isPotentiallyTrustworthy()) { | 423 if (!secOrigin->isPotentiallyTrustworthy()) { |
| 424 // Don't treat this as an error, just don't attempt to open and enumerate th
e caches. | 424 // Don't treat this as an error, just don't attempt to open and enumerate |
| 425 // the caches. |
| 425 callback->sendSuccess(Array<protocol::CacheStorage::Cache>::create()); | 426 callback->sendSuccess(Array<protocol::CacheStorage::Cache>::create()); |
| 426 return; | 427 return; |
| 427 } | 428 } |
| 428 | 429 |
| 429 ErrorString errorString; | 430 ErrorString errorString; |
| 430 std::unique_ptr<WebServiceWorkerCacheStorage> cache = | 431 std::unique_ptr<WebServiceWorkerCacheStorage> cache = |
| 431 assertCacheStorage(&errorString, securityOrigin); | 432 assertCacheStorage(&errorString, securityOrigin); |
| 432 if (!cache) { | 433 if (!cache) { |
| 433 callback->sendFailure(errorString); | 434 callback->sendFailure(errorString); |
| 434 return; | 435 return; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 if (!cache) { | 485 if (!cache) { |
| 485 callback->sendFailure(errorString); | 486 callback->sendFailure(errorString); |
| 486 return; | 487 return; |
| 487 } | 488 } |
| 488 cache->dispatchOpen( | 489 cache->dispatchOpen( |
| 489 new GetCacheForDeleteEntry(request, cacheName, std::move(callback)), | 490 new GetCacheForDeleteEntry(request, cacheName, std::move(callback)), |
| 490 WebString(cacheName)); | 491 WebString(cacheName)); |
| 491 } | 492 } |
| 492 | 493 |
| 493 } // namespace blink | 494 } // namespace blink |
| OLD | NEW |