| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 // This file contains utility functions around the mojo files service. | 5 // This file contains utility functions around the mojo files service. |
| 6 | 6 |
| 7 #ifndef MOJO_FILE_UTILS_FILE_UTIL_H_ | 7 #ifndef MOJO_FILE_UTILS_FILE_UTIL_H_ |
| 8 #define MOJO_FILE_UTILS_FILE_UTIL_H_ | 8 #define MOJO_FILE_UTILS_FILE_UTIL_H_ |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "mojo/services/files/interfaces/directory.mojom.h" | 12 #include "mojo/public/cpp/bindings/interface_handle.h" |
| 13 #include "mojo/public/cpp/bindings/synchronous_interface_ptr.h" |
| 14 #include "mojo/services/files/interfaces/directory.mojom-sync.h" |
| 13 #include "mojo/services/files/interfaces/file.mojom.h" | 15 #include "mojo/services/files/interfaces/file.mojom.h" |
| 14 | 16 |
| 15 namespace file_utils { | 17 namespace file_utils { |
| 16 | 18 |
| 17 // Creates a new temp file, placed in the (input) directory |directory| along | 19 // Creates a new temp file, placed in the (input) directory |directory| along |
| 18 // with the (output) file location in |path_name|. This function blocks the | 20 // with the (output) file location in |path_name|. This function blocks the |
| 19 // calling thread, and there must not be any calls pending on the |directory| | 21 // calling thread, and there must not be any calls pending on the |directory| |
| 20 // when this function is called. | 22 // when this function is called. |
| 21 // Returns a FilePtr on success, and null on failure. | 23 // Returns a FilePtr on success, and null on failure. |
| 22 // On failure, |path_name| is unchanged. | 24 // On failure, |path_name| is unchanged. |
| 23 mojo::files::FilePtr CreateTemporaryFileInDir( | 25 mojo::InterfaceHandle<mojo::files::File> CreateTemporaryFileInDir( |
| 24 mojo::files::DirectoryPtr* directory, | 26 mojo::SynchronousInterfacePtr<mojo::files::Directory>* directory, |
| 25 std::string* path_name); | 27 std::string* path_name); |
| 26 | 28 |
| 27 } // namespace file_utils | 29 } // namespace file_utils |
| 28 | 30 |
| 29 #endif // MOJO_FILE_UTILS_FILE_UTIL_H_ | 31 #endif // MOJO_FILE_UTILS_FILE_UTIL_H_ |
| OLD | NEW |