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_GDATA_GDATA_DIRECTORY_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_DIRECTORY_SERVICE_H_ |
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_DIRECTORY_SERVICE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_DIRECTORY_SERVICE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 void AddEntryToResourceMap(GDataEntry* entry); | 181 void AddEntryToResourceMap(GDataEntry* entry); |
182 | 182 |
183 // Removes the entry from resource map. | 183 // Removes the entry from resource map. |
184 void RemoveEntryFromResourceMap(const std::string& resource_id); | 184 void RemoveEntryFromResourceMap(const std::string& resource_id); |
185 | 185 |
186 // Searches for |file_path| synchronously. | 186 // Searches for |file_path| synchronously. |
187 // TODO(satorux): Replace this with an async version crbug.com/137160 | 187 // TODO(satorux): Replace this with an async version crbug.com/137160 |
188 GDataEntry* FindEntryByPathSync(const FilePath& file_path); | 188 GDataEntry* FindEntryByPathSync(const FilePath& file_path); |
189 | 189 |
190 // Returns the GDataEntry* with the corresponding |resource_id|. | 190 // Returns the GDataEntry* with the corresponding |resource_id|. |
191 // TODO(achuith): Get rid of this in favor of async version crbug.com/13957. | 191 // TODO(satorux): Remove this in favor of GetEntryInfoByResourceId() |
| 192 // but can be difficult. See crbug.com/137374 |
192 GDataEntry* GetEntryByResourceId(const std::string& resource_id); | 193 GDataEntry* GetEntryByResourceId(const std::string& resource_id); |
193 | 194 |
194 // Returns the GDataEntry* in the callback with the corresponding | 195 // Returns the GDataEntry* in the callback with the corresponding |
195 // |resource_id|. TODO(achuith): Rename this to GetEntryByResourceId. | 196 // |resource_id|. TODO(satorux): Remove this in favor of |
| 197 // GetEntryInfoByResourceId(). crbug.com/137512 |
196 void GetEntryByResourceIdAsync(const std::string& resource_id, | 198 void GetEntryByResourceIdAsync(const std::string& resource_id, |
197 const GetEntryByResourceIdCallback& callback); | 199 const GetEntryByResourceIdCallback& callback); |
198 | 200 |
| 201 // Finds an entry (a file or a directory) by |resource_id|. |
| 202 // |
| 203 // Must be called from UI thread. |callback| is run on UI thread. |
| 204 // |callback| must not be null. |
| 205 void GetEntryInfoByResourceId(const std::string& resource_id, |
| 206 const GetEntryInfoCallback& callback); |
| 207 |
199 // Finds an entry (a file or a directory) by |file_path|. | 208 // Finds an entry (a file or a directory) by |file_path|. |
200 // | 209 // |
201 // Must be called from UI thread. |callback| is run on UI thread. | 210 // Must be called from UI thread. |callback| is run on UI thread. |
| 211 // |callback| must not be null. |
202 void GetEntryInfoByPath(const FilePath& file_path, | 212 void GetEntryInfoByPath(const FilePath& file_path, |
203 const GetEntryInfoCallback& callback); | 213 const GetEntryInfoCallback& callback); |
204 | 214 |
205 // Finds and reads a directory by |file_path|. | 215 // Finds and reads a directory by |file_path|. |
206 // | 216 // |
207 // Must be called from UI thread. |callback| is run on UI thread. | 217 // Must be called from UI thread. |callback| is run on UI thread. |
| 218 // |callback| must not be null. |
208 void ReadDirectoryByPath(const FilePath& file_path, | 219 void ReadDirectoryByPath(const FilePath& file_path, |
209 const ReadDirectoryCallback& callback); | 220 const ReadDirectoryCallback& callback); |
210 | 221 |
211 // Similar to GetEntryInfoByPath() but this function finds a pair of | 222 // Similar to GetEntryInfoByPath() but this function finds a pair of |
212 // entries by |first_path| and |second_path|. If the entry for | 223 // entries by |first_path| and |second_path|. If the entry for |
213 // |first_path| is not found, this function does not try to get the | 224 // |first_path| is not found, this function does not try to get the |
214 // entry of |second_path|. | 225 // entry of |second_path|. |
215 // | 226 // |
216 // Must be called from UI thread. |callback| is run on UI thread. | 227 // Must be called from UI thread. |callback| is run on UI thread. |
| 228 // |callback| must not be null. |
217 void GetEntryInfoPairByPaths( | 229 void GetEntryInfoPairByPaths( |
218 const FilePath& first_path, | 230 const FilePath& first_path, |
219 const FilePath& second_path, | 231 const FilePath& second_path, |
220 const GetEntryInfoPairCallback& callback); | 232 const GetEntryInfoPairCallback& callback); |
221 | 233 |
222 // Replaces file entry with the same resource id as |fresh_file| with its | 234 // Replaces file entry with the same resource id as |fresh_file| with its |
223 // fresh value |fresh_file|. | 235 // fresh value |fresh_file|. |
224 void RefreshFile(scoped_ptr<GDataFile> fresh_file); | 236 void RefreshFile(scoped_ptr<GDataFile> fresh_file); |
225 | 237 |
226 // Removes all child files of |directory| and replace with file_map. | 238 // Removes all child files of |directory| and replace with file_map. |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 // This should remain the last member so it'll be destroyed first and | 312 // This should remain the last member so it'll be destroyed first and |
301 // invalidate its weak pointers before other members are destroyed. | 313 // invalidate its weak pointers before other members are destroyed. |
302 base::WeakPtrFactory<GDataDirectoryService> weak_ptr_factory_; | 314 base::WeakPtrFactory<GDataDirectoryService> weak_ptr_factory_; |
303 | 315 |
304 DISALLOW_COPY_AND_ASSIGN(GDataDirectoryService); | 316 DISALLOW_COPY_AND_ASSIGN(GDataDirectoryService); |
305 }; | 317 }; |
306 | 318 |
307 } // namespace gdata | 319 } // namespace gdata |
308 | 320 |
309 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_DIRECTORY_SERVICE_H_ | 321 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_DIRECTORY_SERVICE_H_ |
OLD | NEW |