1 // Copyright 2018 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef CONTENT_BROWSER_BACKGROUND_FETCH_STORAGE_CACHE_ENTRY_HANDLER_IMPL_H_ 6 #define CONTENT_BROWSER_BACKGROUND_FETCH_STORAGE_CACHE_ENTRY_HANDLER_IMPL_H_ 7 8 #include "content/browser/cache_storage/cache_storage_cache_entry_handler.h" 9 10 #include "content/browser/cache_storage/cache_storage_cache.h" 11 12 namespace content { 13 namespace background_fetch { 14 15 class CacheEntryHandlerImpl : public CacheStorageCacheEntryHandler { 16 public: 17 explicit CacheEntryHandlerImpl( 18 scoped_refptr<BlobStorageContextWrapper> blob_storage_context); 19 ~CacheEntryHandlerImpl() override; 20 21 // CacheStorageCacheEntryHandler implementation: 22 std::unique_ptr<PutContext> CreatePutContext( 23 blink::mojom::FetchAPIRequestPtr request, 24 blink::mojom::FetchAPIResponsePtr response, 25 int64_t trace_id) override; 26 void PopulateResponseBody(scoped_refptr<DiskCacheBlobEntry> blob_entry, 27 blink::mojom::FetchAPIResponse* response) override; 28 void PopulateRequestBody(scoped_refptr<DiskCacheBlobEntry> blob_entry, 29 blink::mojom::FetchAPIRequest* request) override; 30 31 private: 32 base::WeakPtr<CacheStorageCacheEntryHandler> GetWeakPtr() override; 33 34 base::WeakPtrFactory<CacheEntryHandlerImpl> weak_ptr_factory_{this}; 35 36 DISALLOW_COPY_AND_ASSIGN(CacheEntryHandlerImpl); 37 }; 38 39 } // namespace background_fetch 40 } // namespace content 41 42 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_STORAGE_CACHE_ENTRY_HANDLER_IMPL_H_ 43