| 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 #ifndef InspectorCacheStorageAgent_h | 5 #ifndef InspectorCacheStorageAgent_h |
| 6 #define InspectorCacheStorageAgent_h | 6 #define InspectorCacheStorageAgent_h |
| 7 | 7 |
| 8 #include "core/InspectorFrontend.h" | 8 #include "core/InspectorFrontend.h" |
| 9 #include "core/inspector/InspectorBaseAgent.h" | 9 #include "core/inspector/InspectorBaseAgent.h" |
| 10 #include "modules/ModulesExport.h" | 10 #include "modules/ModulesExport.h" |
| 11 #include "wtf/PassOwnPtr.h" | 11 #include "wtf/PassOwnPtr.h" |
| 12 #include "wtf/text/WTFString.h" | 12 #include "wtf/text/WTFString.h" |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 typedef String ErrorString; | 16 typedef String ErrorString; |
| 17 | 17 |
| 18 class ExecutionContext; |
| 19 class Page; |
| 20 class SecurityOrigin; |
| 21 class WebServiceWorkerCacheStorage; |
| 22 |
| 18 class MODULES_EXPORT InspectorCacheStorageAgent final : public InspectorBaseAgen
t<InspectorCacheStorageAgent, InspectorFrontend::CacheStorage>, public Inspector
BackendDispatcher::CacheStorageCommandHandler { | 23 class MODULES_EXPORT InspectorCacheStorageAgent final : public InspectorBaseAgen
t<InspectorCacheStorageAgent, InspectorFrontend::CacheStorage>, public Inspector
BackendDispatcher::CacheStorageCommandHandler { |
| 19 WTF_MAKE_NONCOPYABLE(InspectorCacheStorageAgent); | 24 WTF_MAKE_NONCOPYABLE(InspectorCacheStorageAgent); |
| 20 | 25 |
| 21 public: | 26 public: |
| 22 static PassOwnPtrWillBeRawPtr<InspectorCacheStorageAgent> create() | 27 static PassOwnPtrWillBeRawPtr<InspectorCacheStorageAgent> create(Page* page) |
| 23 { | 28 { |
| 24 return adoptPtrWillBeNoop(new InspectorCacheStorageAgent()); | 29 return adoptPtrWillBeNoop(new InspectorCacheStorageAgent(page)); |
| 25 } | 30 } |
| 26 | 31 |
| 27 ~InspectorCacheStorageAgent() override; | 32 ~InspectorCacheStorageAgent() override; |
| 28 | 33 |
| 29 DECLARE_VIRTUAL_TRACE(); | 34 DECLARE_VIRTUAL_TRACE(); |
| 30 | 35 |
| 31 void requestCacheNames(ErrorString*, const String& securityOrigin, PassRefPt
rWillBeRawPtr<RequestCacheNamesCallback>) override; | 36 void requestCacheNames(ErrorString*, const String& securityOrigin, PassRefPt
rWillBeRawPtr<RequestCacheNamesCallback>) override; |
| 32 void requestEntries(ErrorString*, const String& cacheId, int skipCount, int
pageSize, PassRefPtrWillBeRawPtr<RequestEntriesCallback>) override; | 37 void requestEntries(ErrorString*, const String& cacheId, int skipCount, int
pageSize, PassRefPtrWillBeRawPtr<RequestEntriesCallback>) override; |
| 33 void deleteCache(ErrorString*, const String& cacheId, PassRefPtrWillBeRawPtr
<DeleteCacheCallback>) override; | 38 void deleteCache(ErrorString*, const String& cacheId, PassRefPtrWillBeRawPtr
<DeleteCacheCallback>) override; |
| 34 void deleteEntry(ErrorString*, const String& cacheId, const String& request,
PassRefPtrWillBeRawPtr<DeleteEntryCallback>) override; | 39 void deleteEntry(ErrorString*, const String& cacheId, const String& request,
PassRefPtrWillBeRawPtr<DeleteEntryCallback>) override; |
| 35 | 40 |
| 36 private: | 41 private: |
| 37 explicit InspectorCacheStorageAgent(); | 42 explicit InspectorCacheStorageAgent(Page*); |
| 43 |
| 44 bool canAccessCacheStorage(const String& securityOrigin); |
| 45 ExecutionContext* assertExecutionContextForOrigin(ErrorString*, SecurityOrig
in*); |
| 46 PassOwnPtr<WebServiceWorkerCacheStorage> assertCacheStorage(ErrorString*, co
nst String& securityOrigin); |
| 47 PassOwnPtr<WebServiceWorkerCacheStorage> assertCacheStorageAndNameForId(Erro
rString*, const String& cacheId, String* cacheName); |
| 48 |
| 49 RawPtrWillBeMember<Page> m_page; |
| 38 }; | 50 }; |
| 39 | 51 |
| 40 } // namespace blink | 52 } // namespace blink |
| 41 | 53 |
| 42 #endif // InspectorCacheStorageAgent_h | 54 #endif // InspectorCacheStorageAgent_h |
| OLD | NEW |