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(achuith): Get rid of this in favor of async version crbug.com/13957. |
achuithb
2012/08/20 18:53:31
Can we update this comment to say we want to get r
satorux1
2012/08/20 19:07:20
Done, but this one is tricky as it's used in proce
| |
192 GDataEntry* GetEntryByResourceId(const std::string& resource_id); | 192 GDataEntry* GetEntryByResourceId(const std::string& resource_id); |
193 | 193 |
194 // Returns the GDataEntry* in the callback with the corresponding | 194 // Returns the GDataEntry* in the callback with the corresponding |
195 // |resource_id|. TODO(achuith): Rename this to GetEntryByResourceId. | 195 // |resource_id|. TODO(achuith): Rename this to GetEntryByResourceId. |
achuithb
2012/08/20 18:53:31
Can we update this comment to say we want to get r
satorux1
2012/08/20 19:07:20
Done.
| |
196 void GetEntryByResourceIdAsync(const std::string& resource_id, | 196 void GetEntryByResourceIdAsync(const std::string& resource_id, |
197 const GetEntryByResourceIdCallback& callback); | 197 const GetEntryByResourceIdCallback& callback); |
198 | 198 |
199 // Finds an entry (a file or a directory) by |resource_id|. | |
200 // | |
201 // Must be called from UI thread. |callback| is run on UI thread. | |
202 // |callback| must not be null. | |
203 void GetEntryInfoByResourceId(const std::string& resource_id, | |
204 const GetEntryInfoCallback& callback); | |
205 | |
199 // Finds an entry (a file or a directory) by |file_path|. | 206 // Finds an entry (a file or a directory) by |file_path|. |
200 // | 207 // |
201 // Must be called from UI thread. |callback| is run on UI thread. | 208 // Must be called from UI thread. |callback| is run on UI thread. |
209 // |callback| must not be null. | |
202 void GetEntryInfoByPath(const FilePath& file_path, | 210 void GetEntryInfoByPath(const FilePath& file_path, |
203 const GetEntryInfoCallback& callback); | 211 const GetEntryInfoCallback& callback); |
204 | 212 |
205 // Finds and reads a directory by |file_path|. | 213 // Finds and reads a directory by |file_path|. |
206 // | 214 // |
207 // Must be called from UI thread. |callback| is run on UI thread. | 215 // Must be called from UI thread. |callback| is run on UI thread. |
216 // |callback| must not be null. | |
208 void ReadDirectoryByPath(const FilePath& file_path, | 217 void ReadDirectoryByPath(const FilePath& file_path, |
209 const ReadDirectoryCallback& callback); | 218 const ReadDirectoryCallback& callback); |
210 | 219 |
211 // Similar to GetEntryInfoByPath() but this function finds a pair of | 220 // Similar to GetEntryInfoByPath() but this function finds a pair of |
212 // entries by |first_path| and |second_path|. If the entry for | 221 // 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 | 222 // |first_path| is not found, this function does not try to get the |
214 // entry of |second_path|. | 223 // entry of |second_path|. |
215 // | 224 // |
216 // Must be called from UI thread. |callback| is run on UI thread. | 225 // Must be called from UI thread. |callback| is run on UI thread. |
226 // |callback| must not be null. | |
217 void GetEntryInfoPairByPaths( | 227 void GetEntryInfoPairByPaths( |
218 const FilePath& first_path, | 228 const FilePath& first_path, |
219 const FilePath& second_path, | 229 const FilePath& second_path, |
220 const GetEntryInfoPairCallback& callback); | 230 const GetEntryInfoPairCallback& callback); |
221 | 231 |
222 // Replaces file entry with the same resource id as |fresh_file| with its | 232 // Replaces file entry with the same resource id as |fresh_file| with its |
223 // fresh value |fresh_file|. | 233 // fresh value |fresh_file|. |
224 void RefreshFile(scoped_ptr<GDataFile> fresh_file); | 234 void RefreshFile(scoped_ptr<GDataFile> fresh_file); |
225 | 235 |
226 // Removes all child files of |directory| and replace with file_map. | 236 // 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 | 310 // This should remain the last member so it'll be destroyed first and |
301 // invalidate its weak pointers before other members are destroyed. | 311 // invalidate its weak pointers before other members are destroyed. |
302 base::WeakPtrFactory<GDataDirectoryService> weak_ptr_factory_; | 312 base::WeakPtrFactory<GDataDirectoryService> weak_ptr_factory_; |
303 | 313 |
304 DISALLOW_COPY_AND_ASSIGN(GDataDirectoryService); | 314 DISALLOW_COPY_AND_ASSIGN(GDataDirectoryService); |
305 }; | 315 }; |
306 | 316 |
307 } // namespace gdata | 317 } // namespace gdata |
308 | 318 |
309 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_DIRECTORY_SERVICE_H_ | 319 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_DIRECTORY_SERVICE_H_ |
OLD | NEW |