OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_RESOURCE_METADATA_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_RESOURCE_METADATA_H_ |
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_RESOURCE_METADATA_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_RESOURCE_METADATA_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 99 |
100 // Returns the local ID associated with the given resource ID. | 100 // Returns the local ID associated with the given resource ID. |
101 FileError GetIdByResourceId(const std::string& resource_id, | 101 FileError GetIdByResourceId(const std::string& resource_id, |
102 std::string* out_local_id); | 102 std::string* out_local_id); |
103 | 103 |
104 private: | 104 private: |
105 // Note: Use Destroy() to delete this object. | 105 // Note: Use Destroy() to delete this object. |
106 ~ResourceMetadata(); | 106 ~ResourceMetadata(); |
107 | 107 |
108 // Sets up entries which should be present by default. | 108 // Sets up entries which should be present by default. |
109 bool SetUpDefaultEntries(); | 109 FileError SetUpDefaultEntries(); |
110 | 110 |
111 // Used to implement Destroy(). | 111 // Used to implement Destroy(). |
112 void DestroyOnBlockingPool(); | 112 void DestroyOnBlockingPool(); |
113 | 113 |
114 // Puts an entry under its parent directory. Removes the child from the old | 114 // Puts an entry under its parent directory. Removes the child from the old |
115 // parent if there is. This method will also do name de-duplication to ensure | 115 // parent if there is. This method will also do name de-duplication to ensure |
116 // that the exposed presentation path does not have naming conflicts. Two | 116 // that the exposed presentation path does not have naming conflicts. Two |
117 // files with the same name "Foo" will be renamed to "Foo (1)" and "Foo (2)". | 117 // files with the same name "Foo" will be renamed to "Foo (1)" and "Foo (2)". |
118 bool PutEntryUnderDirectory(const ResourceEntry& entry); | 118 FileError PutEntryUnderDirectory(const ResourceEntry& entry); |
119 | 119 |
120 // Returns an unused base name for |entry|. | 120 // Returns an unused base name for |entry|. |
121 std::string GetDeduplicatedBaseName(const ResourceEntry& entry); | 121 FileError GetDeduplicatedBaseName(const ResourceEntry& entry, |
| 122 std::string* base_name); |
122 | 123 |
123 // Removes the entry and its descendants. | 124 // Removes the entry and its descendants. |
124 bool RemoveEntryRecursively(const std::string& id); | 125 FileError RemoveEntryRecursively(const std::string& id); |
125 | 126 |
126 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 127 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
127 | 128 |
128 ResourceMetadataStorage* storage_; | 129 ResourceMetadataStorage* storage_; |
129 | 130 |
130 DISALLOW_COPY_AND_ASSIGN(ResourceMetadata); | 131 DISALLOW_COPY_AND_ASSIGN(ResourceMetadata); |
131 }; | 132 }; |
132 | 133 |
133 } // namespace internal | 134 } // namespace internal |
134 } // namespace drive | 135 } // namespace drive |
135 | 136 |
136 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_RESOURCE_METADATA_H_ | 137 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_RESOURCE_METADATA_H_ |
OLD | NEW |