Chromium Code Reviews| 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. | |
|
dcheng
2016/11/17 11:16:02
Nit: destroys
mmenke
2016/11/17 16:59:33
"outlives until" isn't grammatically correct. May
mmenke
2016/11/17 16:59:33
"URLLoader"? This is also used on the non-Mojo pa
tzik
2016/11/22 13:54:45
Done.
| |
| 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_; } | |
|
mmenke
2016/11/17 16:59:33
Not actually used? (Well, it's used in RDH, but n
| |
| 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 |