| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 BASE_FILES_SCOPED_TEMP_DIR_H_ | 5 #ifndef BASE_FILES_SCOPED_TEMP_DIR_H_ |
| 6 #define BASE_FILES_SCOPED_TEMP_DIR_H_ | 6 #define BASE_FILES_SCOPED_TEMP_DIR_H_ |
| 7 | 7 |
| 8 // An object representing a temporary / scratch directory that should be cleaned | 8 // An object representing a temporary / scratch directory that should be cleaned |
| 9 // up (recursively) when this object goes out of scope. Note that since | 9 // up (recursively) when this object goes out of scope. Note that since |
| 10 // deletion occurs during the destructor, no further error handling is possible | 10 // deletion occurs during the destructor, no further error handling is possible |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 // Don't call multiple times unless Take() has been called first. | 40 // Don't call multiple times unless Take() has been called first. |
| 41 bool Set(const FilePath& path) WARN_UNUSED_RESULT; | 41 bool Set(const FilePath& path) WARN_UNUSED_RESULT; |
| 42 | 42 |
| 43 // Deletes the temporary directory wrapped by this object. | 43 // Deletes the temporary directory wrapped by this object. |
| 44 bool Delete() WARN_UNUSED_RESULT; | 44 bool Delete() WARN_UNUSED_RESULT; |
| 45 | 45 |
| 46 // Caller takes ownership of the temporary directory so it won't be destroyed | 46 // Caller takes ownership of the temporary directory so it won't be destroyed |
| 47 // when this object goes out of scope. | 47 // when this object goes out of scope. |
| 48 FilePath Take(); | 48 FilePath Take(); |
| 49 | 49 |
| 50 // DEPRECATED: Use GetPath instead. See https://crbug.com/640599 for more | |
| 51 // info. | |
| 52 const FilePath& path() const { return path_; } | |
| 53 | |
| 54 // Returns the path to the created directory. Call one of the | 50 // Returns the path to the created directory. Call one of the |
| 55 // CreateUniqueTempDir* methods before getting the path. | 51 // CreateUniqueTempDir* methods before getting the path. |
| 56 const FilePath& GetPath() const; | 52 const FilePath& GetPath() const; |
| 57 | 53 |
| 58 // Returns true if path_ is non-empty and exists. | 54 // Returns true if path_ is non-empty and exists. |
| 59 bool IsValid() const; | 55 bool IsValid() const; |
| 60 | 56 |
| 61 private: | 57 private: |
| 62 FilePath path_; | 58 FilePath path_; |
| 63 | 59 |
| 64 DISALLOW_COPY_AND_ASSIGN(ScopedTempDir); | 60 DISALLOW_COPY_AND_ASSIGN(ScopedTempDir); |
| 65 }; | 61 }; |
| 66 | 62 |
| 67 } // namespace base | 63 } // namespace base |
| 68 | 64 |
| 69 #endif // BASE_FILES_SCOPED_TEMP_DIR_H_ | 65 #endif // BASE_FILES_SCOPED_TEMP_DIR_H_ |
| OLD | NEW |