Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1569)

Unified Diff: content/browser/blob_storage/blob_url_loader_factory.h

Issue 2906543002: Add support for reading blobs when using the network service. (Closed)
Patch Set: review comment Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..9d724e48a73a372fdf0869b996b7bc9201943255
--- /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,
+ 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::URLLoaderRequest 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_

Powered by Google App Engine
This is Rietveld 408576698