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_FILES_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILES_H_ |
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILES_H_ | 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILES_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 | 283 |
284 // Takes the ownership of |entry| from its current parent. If this directory | 284 // Takes the ownership of |entry| from its current parent. If this directory |
285 // is already the current parent of |file|, this method effectively goes | 285 // is already the current parent of |file|, this method effectively goes |
286 // through the name de-duplication for |file| based on the current state of | 286 // through the name de-duplication for |file| based on the current state of |
287 // the file system. | 287 // the file system. |
288 bool TakeEntry(GDataEntry* entry); | 288 bool TakeEntry(GDataEntry* entry); |
289 | 289 |
290 // Takes over all entries from |dir|. | 290 // Takes over all entries from |dir|. |
291 bool TakeOverEntries(GDataDirectory* dir); | 291 bool TakeOverEntries(GDataDirectory* dir); |
292 | 292 |
293 // Find a child by its name. | |
294 GDataEntry* FindChild(const FilePath::StringType& file_name) const; | |
295 | |
296 // Removes the entry from its children list and destroys the entry instance. | 293 // Removes the entry from its children list and destroys the entry instance. |
297 bool RemoveEntry(GDataEntry* entry); | 294 bool RemoveEntry(GDataEntry* entry); |
298 | 295 |
299 // Removes child elements. | 296 // Removes child elements. |
300 void RemoveChildren(); | 297 void RemoveChildren(); |
301 void RemoveChildFiles(); | 298 void RemoveChildFiles(); |
302 void RemoveChildDirectories(); | 299 void RemoveChildDirectories(); |
303 | 300 |
304 // Collection of children files/directories. | 301 // Collection of children files/directories. |
305 const GDataFileCollection& child_files() const { return child_files_; } | 302 const GDataFileCollection& child_files() const { return child_files_; } |
306 const GDataDirectoryCollection& child_directories() const { | 303 const GDataDirectoryCollection& child_directories() const { |
307 return child_directories_; | 304 return child_directories_; |
308 } | 305 } |
309 | 306 |
310 private: | 307 private: |
| 308 friend class GDataDirectoryService; |
| 309 |
| 310 // Find a child by its name. |
| 311 // TODO(satorux): Remove this. crbug.com/139649 |
| 312 GDataEntry* FindChild(const FilePath::StringType& file_name) const; |
| 313 |
311 // Add |entry| to children. | 314 // Add |entry| to children. |
312 void AddChild(GDataEntry* entry); | 315 void AddChild(GDataEntry* entry); |
313 | 316 |
314 // Removes the entry from its children without destroying the | 317 // Removes the entry from its children without destroying the |
315 // entry instance. | 318 // entry instance. |
316 bool RemoveChild(GDataEntry* entry); | 319 bool RemoveChild(GDataEntry* entry); |
317 | 320 |
318 // Collection of children GDataEntry items. | 321 // Collection of children GDataEntry items. |
319 GDataFileCollection child_files_; | 322 GDataFileCollection child_files_; |
320 GDataDirectoryCollection child_directories_; | 323 GDataDirectoryCollection child_directories_; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 size_t serialized_size_; | 390 size_t serialized_size_; |
388 int largest_changestamp_; // Stored in the serialized proto. | 391 int largest_changestamp_; // Stored in the serialized proto. |
389 ContentOrigin origin_; | 392 ContentOrigin origin_; |
390 | 393 |
391 DISALLOW_COPY_AND_ASSIGN(GDataDirectoryService); | 394 DISALLOW_COPY_AND_ASSIGN(GDataDirectoryService); |
392 }; | 395 }; |
393 | 396 |
394 } // namespace gdata | 397 } // namespace gdata |
395 | 398 |
396 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILES_H_ | 399 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILES_H_ |
OLD | NEW |