OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_CREATE_DIRECTORY_OPERATION_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_CREATE_DIRECTORY_OPERATION_H_ |
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_CREATE_DIRECTORY_OPERATION_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_CREATE_DIRECTORY_OPERATION_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 // already at the |directory_path|. | 51 // already at the |directory_path|. |
52 // If |is_recursive| is true, the invocation creates parent directories as | 52 // If |is_recursive| is true, the invocation creates parent directories as |
53 // needed just like mkdir -p does. | 53 // needed just like mkdir -p does. |
54 // Invokes |callback| when finished with the result of the operation. | 54 // Invokes |callback| when finished with the result of the operation. |
55 // |callback| must not be null. | 55 // |callback| must not be null. |
56 void CreateDirectory(const base::FilePath& directory_path, | 56 void CreateDirectory(const base::FilePath& directory_path, |
57 bool is_exclusive, | 57 bool is_exclusive, |
58 bool is_recursive, | 58 bool is_recursive, |
59 const FileOperationCallback& callback); | 59 const FileOperationCallback& callback); |
60 | 60 |
| 61 private: |
61 // Returns the file path to the existing deepest directory, which appears | 62 // Returns the file path to the existing deepest directory, which appears |
62 // in the |file_path|, with |entry| storing the directory's resource entry. | 63 // in the |file_path|, with |entry| storing the directory's resource entry. |
63 // If not found, returns an empty file path. | 64 // If not found, returns an empty file path. |
64 // This should run on |blocking_task_runner_|. | 65 // This should run on |blocking_task_runner_|. |
65 // This is public for testing. | |
66 static base::FilePath GetExistingDeepestDirectory( | 66 static base::FilePath GetExistingDeepestDirectory( |
67 internal::ResourceMetadata* metadata, | 67 internal::ResourceMetadata* metadata, |
68 const base::FilePath& directory_path, | 68 const base::FilePath& directory_path, |
69 ResourceEntry* entry); | 69 ResourceEntry* entry); |
70 | 70 |
71 private: | |
72 // Part of CreateDirectory(). Called after GetExistingDeepestDirectory | 71 // Part of CreateDirectory(). Called after GetExistingDeepestDirectory |
73 // is completed. | 72 // is completed. |
74 void CreateDirectoryAfterGetExistingDeepestDirectory( | 73 void CreateDirectoryAfterGetExistingDeepestDirectory( |
75 const base::FilePath& directory_path, | 74 const base::FilePath& directory_path, |
76 bool is_exclusive, | 75 bool is_exclusive, |
77 bool is_recursive, | 76 bool is_recursive, |
78 const FileOperationCallback& callback, | 77 const FileOperationCallback& callback, |
79 ResourceEntry* existing_deepest_directory_entry, | 78 ResourceEntry* existing_deepest_directory_entry, |
80 const base::FilePath& existing_deepest_directory_path); | 79 const base::FilePath& existing_deepest_directory_path); |
81 | 80 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 // Note: This should remain the last member so it'll be destroyed and | 113 // Note: This should remain the last member so it'll be destroyed and |
115 // invalidate the weak pointers before any other members are destroyed. | 114 // invalidate the weak pointers before any other members are destroyed. |
116 base::WeakPtrFactory<CreateDirectoryOperation> weak_ptr_factory_; | 115 base::WeakPtrFactory<CreateDirectoryOperation> weak_ptr_factory_; |
117 DISALLOW_COPY_AND_ASSIGN(CreateDirectoryOperation); | 116 DISALLOW_COPY_AND_ASSIGN(CreateDirectoryOperation); |
118 }; | 117 }; |
119 | 118 |
120 } // namespace file_system | 119 } // namespace file_system |
121 } // namespace drive | 120 } // namespace drive |
122 | 121 |
123 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_CREATE_DIRECTORY_OPERATION_
H_ | 122 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_CREATE_DIRECTORY_OPERATION_
H_ |
OLD | NEW |