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

Side by Side 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 comments Created 3 years, 6 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 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_BLOB_STORAGE_BLOB_URL_LOADER_FACTORY_H_
6 #define CONTENT_BROWSER_BLOB_STORAGE_BLOB_URL_LOADER_FACTORY_H_
7
8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h"
10 #include "content/common/url_loader_factory.mojom.h"
11 #include "content/public/browser/browser_thread.h"
12 #include "mojo/public/cpp/bindings/binding_set.h"
13
14 namespace storage {
15 class FileSystemContext;
16 }
17
18 namespace content {
19 class ChromeBlobStorageContext;
20 class StoragePartitionImpl;
21
22 // A class for creating URLLoaderFactory for blob scheme.
23 // There should be one owned per StoragePartition.
24 class BlobURLLoaderFactory
25 : public base::RefCountedThreadSafe<BlobURLLoaderFactory,
26 BrowserThread::DeleteOnIOThread>,
27 public mojom::URLLoaderFactory {
28 public:
29 explicit BlobURLLoaderFactory(StoragePartitionImpl* storage_partition);
30
31 // Creates a URLLoaderFactory interface pointer for serving blob requests.
32 // Called on the UI thread.
33 mojom::URLLoaderFactoryPtr CreateFactory();
34
35 private:
36 friend class base::DeleteHelper<BlobURLLoaderFactory>;
37 friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>;
38
39 ~BlobURLLoaderFactory() override;
40
41 void BindOnIO(mojom::URLLoaderFactoryRequest request);
42
43 // mojom::URLLoaderFactory implementation:
44 void CreateLoaderAndStart(mojom::URLLoaderAssociatedRequest loader,
45 int32_t routing_id,
46 int32_t request_id,
47 uint32_t options,
48 const ResourceRequest& request,
49 mojom::URLLoaderClientPtr client) override;
50 void SyncLoad(int32_t routing_id,
51 int32_t request_id,
52 const ResourceRequest& request,
53 SyncLoadCallback callback) override;
54
55 scoped_refptr<ChromeBlobStorageContext> blob_storage_context_;
56 scoped_refptr<storage::FileSystemContext> file_system_context_;
57
58 // Used on the IO thread.
59 mojo::BindingSet<mojom::URLLoaderFactory> loader_factory_bindings_;
60
61 DISALLOW_COPY_AND_ASSIGN(BlobURLLoaderFactory);
62 };
63
64 } // namespace content
65
66 #endif // CONTENT_BROWSER_BLOB_STORAGE_BLOB_URL_LOADER_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698