| OLD | NEW |
| (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 STORAGE_BROWSER_BLOB_BLOB_REGISTRY_IMPL_H_ |
| 6 #define STORAGE_BROWSER_BLOB_BLOB_REGISTRY_IMPL_H_ |
| 7 |
| 8 #include "mojo/public/cpp/bindings/binding_set.h" |
| 9 #include "services/service_manager/public/cpp/bind_source_info.h" |
| 10 #include "storage/browser/blob/blob_memory_controller.h" |
| 11 #include "storage/browser/storage_browser_export.h" |
| 12 #include "third_party/WebKit/public/platform/blobs.mojom.h" |
| 13 |
| 14 namespace storage { |
| 15 |
| 16 class BlobDataBuilder; |
| 17 class BlobStorageContext; |
| 18 |
| 19 class STORAGE_EXPORT BlobRegistryImpl : public mojom::BlobRegistry { |
| 20 public: |
| 21 explicit BlobRegistryImpl(BlobStorageContext* context); |
| 22 ~BlobRegistryImpl() override; |
| 23 |
| 24 void Bind(const service_manager::BindSourceInfo& source_info, |
| 25 mojom::BlobRegistryRequest request); |
| 26 |
| 27 void Register(mojom::BlobRequest blob, |
| 28 const std::string& uuid, |
| 29 const std::string& content_type, |
| 30 const std::string& content_disposition, |
| 31 std::vector<mojom::DataElementPtr> elements, |
| 32 RegisterCallback callback) override; |
| 33 void DeprecatedGetBlob(const std::string& uuid, |
| 34 mojom::BlobRequest blob) override; |
| 35 |
| 36 private: |
| 37 void RegisterWithBlobUUIDs(mojom::BlobRequest blob, |
| 38 const std::string& uuid, |
| 39 const std::string& content_type, |
| 40 const std::string& content_disposition, |
| 41 std::vector<mojom::DataElementPtr> elements, |
| 42 std::vector<std::string> blob_uuids, |
| 43 RegisterCallback callback, |
| 44 const std::string& next_blob); |
| 45 |
| 46 void OnReadyForDataStreams( |
| 47 const std::string& uuid, |
| 48 std::unique_ptr<BlobDataBuilder> builder, |
| 49 std::list<std::pair<size_t, mojom::BytesProviderPtr>> future_data, |
| 50 std::list<size_t> file_sizes, |
| 51 BlobStatus status, |
| 52 std::vector<BlobMemoryController::FileCreationInfo> file_info); |
| 53 void OnReadDatastream(const std::string& uuid, |
| 54 base::OnceClosure next_read_callback, |
| 55 |
| 56 bool success); |
| 57 void OnReadyForFileTransport( |
| 58 const std::string& uuid, |
| 59 std::unique_ptr<BlobDataBuilder> builder, |
| 60 std::list<std::pair<size_t, mojom::BytesProviderPtr>> future_data, |
| 61 std::list<size_t> file_sizes, |
| 62 BlobStatus status, |
| 63 std::vector<BlobMemoryController::FileCreationInfo> file_info); |
| 64 |
| 65 void OnDataStreamDone(const std::string& uuid); |
| 66 void OnFileDone(const std::string& uuid, |
| 67 BlobDataBuilder* builder, |
| 68 size_t item_index, |
| 69 mojom::BytesProviderPtr ptr, |
| 70 const scoped_refptr<ShareableFileReference>& file_reference, |
| 71 base::Optional<base::Time> time_file_modified); |
| 72 |
| 73 BlobStorageContext* context_; |
| 74 |
| 75 mojo::BindingSet<mojom::BlobRegistry> bindings_; |
| 76 |
| 77 base::WeakPtrFactory<BlobRegistryImpl> weak_ptr_factory_; |
| 78 DISALLOW_COPY_AND_ASSIGN(BlobRegistryImpl); |
| 79 }; |
| 80 |
| 81 } // namespace storage |
| 82 |
| 83 #endif // STORAGE_BROWSER_BLOB_BLOB_REGISTRY_IMPL_H_ |
| OLD | NEW |