Chromium Code Reviews| Index: content/browser/blob_storage/blob_url_loader_factory.h |
| diff --git a/content/browser/blob_storage/blob_url_loader_factory.h b/content/browser/blob_storage/blob_url_loader_factory.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..ec3e972c2b41504376815045024833dbc099e71a |
| --- /dev/null |
| +++ b/content/browser/blob_storage/blob_url_loader_factory.h |
| @@ -0,0 +1,66 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_BROWSER_BLOB_STORAGE_BLOB_URL_LOADER_FACTORY_H_ |
| +#define CONTENT_BROWSER_BLOB_STORAGE_BLOB_URL_LOADER_FACTORY_H_ |
| + |
| +#include "base/macros.h" |
| +#include "base/memory/ref_counted.h" |
| +#include "content/common/url_loader_factory.mojom.h" |
| +#include "content/public/browser/browser_thread.h" |
| +#include "mojo/public/cpp/bindings/binding_set.h" |
| + |
| +namespace storage { |
| +class FileSystemContext; |
| +} |
| + |
| +namespace content { |
| +class ChromeBlobStorageContext; |
| +class StoragePartitionImpl; |
| + |
| +// A class for creating URLLoaderFactory for blob scheme. |
| +// There should be one owned per StoragePartition. |
| +class BlobURLLoaderFactory |
| + : public base::RefCountedThreadSafe<BlobURLLoaderFactory, |
|
dmurph
2017/05/25 21:37:10
Can we make this not refcounted?
jam
2017/05/26 04:46:47
It's used on StoragePartition and passed to the IO
|
| + BrowserThread::DeleteOnIOThread>, |
| + public mojom::URLLoaderFactory { |
| + public: |
| + explicit BlobURLLoaderFactory(StoragePartitionImpl* storage_partition); |
| + |
| + // Creates a URLLoaderFactory interface pointer for serving blob requests. |
| + // Called on the UI thread. |
| + mojom::URLLoaderFactoryPtr CreateFactory(); |
| + |
| + private: |
| + friend class base::DeleteHelper<BlobURLLoaderFactory>; |
| + friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>; |
| + |
| + ~BlobURLLoaderFactory() override; |
| + |
| + void BindOnIO(mojom::URLLoaderFactoryRequest request); |
| + |
| + // mojom::URLLoaderFactory implementation: |
| + void CreateLoaderAndStart(mojom::URLLoaderAssociatedRequest loader, |
| + int32_t routing_id, |
| + int32_t request_id, |
| + uint32_t options, |
| + const ResourceRequest& request, |
| + mojom::URLLoaderClientPtr client) override; |
| + void SyncLoad(int32_t routing_id, |
| + int32_t request_id, |
| + const ResourceRequest& request, |
| + SyncLoadCallback callback) override; |
| + |
| + scoped_refptr<ChromeBlobStorageContext> blob_storage_context_; |
| + scoped_refptr<storage::FileSystemContext> file_system_context_; |
| + |
| + // Used on the IO thread. |
| + mojo::BindingSet<mojom::URLLoaderFactory> loader_factory_bindings_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(BlobURLLoaderFactory); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_BROWSER_BLOB_STORAGE_BLOB_URL_LOADER_FACTORY_H_ |