OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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_LOADER_DOWNLOADED_TEMP_FILE_IMPL_H_ |
| 6 #define CONTENT_BROWSER_LOADER_DOWNLOADED_TEMP_FILE_IMPL_H_ |
| 7 |
| 8 #include "base/files/file_path.h" |
| 9 #include "base/macros.h" |
| 10 #include "base/memory/ref_counted.h" |
| 11 #include "content/common/content_export.h" |
| 12 #include "content/common/url_loader_factory.mojom.h" |
| 13 #include "mojo/public/cpp/bindings/binding.h" |
| 14 |
| 15 namespace storage { |
| 16 class ShareableFileReference; |
| 17 } |
| 18 |
| 19 namespace content { |
| 20 |
| 21 class ResourceDispatcherHostImpl; |
| 22 |
| 23 // DownloadedTempFileImpl is created on the download_to_file mode of resource |
| 24 // loading. The instance is held by ResourceDispatcherHostImpl and slightly |
| 25 // outlives URLLoader until the client destroyes the interface. |
| 26 class CONTENT_EXPORT DownloadedTempFileImpl final |
| 27 : public mojom::DownloadedTempFile { |
| 28 public: |
| 29 DownloadedTempFileImpl(ResourceDispatcherHostImpl* rdh, |
| 30 int child_id, |
| 31 int request_id, |
| 32 const base::FilePath& path); |
| 33 ~DownloadedTempFileImpl() override; |
| 34 |
| 35 mojo::InterfacePtr<mojom::DownloadedTempFile> CreateInterfacePtrAndBind(); |
| 36 |
| 37 int child_id() const { return child_id_; } |
| 38 int request_id() const { return request_id_; } |
| 39 const scoped_refptr<storage::ShareableFileReference>& reference() const { |
| 40 return reference_; |
| 41 } |
| 42 |
| 43 private: |
| 44 void OnConnectionError(); |
| 45 |
| 46 mojo::Binding<DownloadedTempFile> binding_; |
| 47 |
| 48 ResourceDispatcherHostImpl* rdh_; |
| 49 int child_id_; |
| 50 int request_id_; |
| 51 |
| 52 scoped_refptr<storage::ShareableFileReference> reference_; |
| 53 |
| 54 DISALLOW_COPY_AND_ASSIGN(DownloadedTempFileImpl); |
| 55 }; |
| 56 |
| 57 } // namespace content |
| 58 |
| 59 #endif // CONTENT_BROWSER_LOADER_DOWNLOADED_TEMP_FILE_IMPL_H_ |
OLD | NEW |