| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_BROWSER_LOADER_DOWNLOADED_TEMP_FILE_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_LOADER_DOWNLOADED_TEMP_FILE_IMPL_H_ |
| 6 #define CONTENT_BROWSER_LOADER_DOWNLOADED_TEMP_FILE_IMPL_H_ | 6 #define CONTENT_BROWSER_LOADER_DOWNLOADED_TEMP_FILE_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
| 10 #include "content/common/url_loader_factory.mojom.h" | 10 #include "content/common/url_loader_factory.mojom.h" |
| 11 | 11 |
| 12 namespace mojo { | |
| 13 class AssociatedGroup; | |
| 14 } | |
| 15 | |
| 16 namespace content { | 12 namespace content { |
| 17 | 13 |
| 18 // DownloadedTempFileImpl is created on the download_to_file mode of resource | 14 // DownloadedTempFileImpl is created on the download_to_file mode of resource |
| 19 // loading. The instance is held by the client and lives until the client | 15 // loading. The instance is held by the client and lives until the client |
| 20 // destroys the interface, slightly after the URLLoader is destroyed. | 16 // destroys the interface, slightly after the URLLoader is destroyed. |
| 21 class CONTENT_EXPORT DownloadedTempFileImpl final | 17 class CONTENT_EXPORT DownloadedTempFileImpl final |
| 22 : public mojom::DownloadedTempFile { | 18 : public mojom::DownloadedTempFile { |
| 23 public: | 19 public: |
| 24 // Creates a DownloadedTempFileImpl, binds it as a strong associated | 20 // Creates a DownloadedTempFileImpl, binds it as a strong associated |
| 25 // interface, and returns the interface ptr info to be passed to the client. | 21 // interface, and returns the interface ptr info to be passed to the client. |
| 26 // That means: | 22 // That means: |
| 27 // * The DownloadedTempFile object created here is essentially owned by the | 23 // * The DownloadedTempFile object created here is essentially owned by the |
| 28 // client. It keeps alive until the client destroys the other endpoint. | 24 // client. It keeps alive until the client destroys the other endpoint. |
| 29 // * The resulting interface is associated to the given |associated_group|, | 25 // * The resulting interface will be associated to the same message pipe on |
| 30 // all Mojo IPCs messages that share |associated_group| will arrive in a | 26 // which the returned pointer info object is sent. |
| 31 // sequence. | 27 static mojom::DownloadedTempFileAssociatedPtrInfo Create(int child_id, |
| 32 static mojom::DownloadedTempFileAssociatedPtrInfo | 28 int request_id); |
| 33 Create(mojo::AssociatedGroup* associated_group, int child_id, int request_id); | |
| 34 | 29 |
| 35 static mojom::DownloadedTempFilePtr CreateForTesting(int child_id, | 30 static mojom::DownloadedTempFilePtr CreateForTesting(int child_id, |
| 36 int request_id); | 31 int request_id); |
| 37 | 32 |
| 38 DownloadedTempFileImpl(int child_id, int request_id); | 33 DownloadedTempFileImpl(int child_id, int request_id); |
| 39 ~DownloadedTempFileImpl() override; | 34 ~DownloadedTempFileImpl() override; |
| 40 | 35 |
| 41 private: | 36 private: |
| 42 int child_id_; | 37 int child_id_; |
| 43 int request_id_; | 38 int request_id_; |
| 44 | 39 |
| 45 DISALLOW_COPY_AND_ASSIGN(DownloadedTempFileImpl); | 40 DISALLOW_COPY_AND_ASSIGN(DownloadedTempFileImpl); |
| 46 }; | 41 }; |
| 47 | 42 |
| 48 } // namespace content | 43 } // namespace content |
| 49 | 44 |
| 50 #endif // CONTENT_BROWSER_LOADER_DOWNLOADED_TEMP_FILE_IMPL_H_ | 45 #endif // CONTENT_BROWSER_LOADER_DOWNLOADED_TEMP_FILE_IMPL_H_ |
| OLD | NEW |