Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Side by Side Diff: chrome/browser/chromeos/drive/drive_resource_metadata.h

Issue 14108009: chromeos: Use WriteBatch to update DriveResourceMetadata DB (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rename method Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/chromeos/drive/drive_resource_metadata.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_DRIVE_RESOURCE_METADATA_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_RESOURCE_METADATA_H_
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_RESOURCE_METADATA_H_ 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_RESOURCE_METADATA_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 // corresponding entry is not a directory. 333 // corresponding entry is not a directory.
334 scoped_ptr<DriveEntryProto> GetDirectory(const std::string& resource_id); 334 scoped_ptr<DriveEntryProto> GetDirectory(const std::string& resource_id);
335 335
336 // Returns virtual file path of the entry. 336 // Returns virtual file path of the entry.
337 base::FilePath GetFilePath(const std::string& resource_id); 337 base::FilePath GetFilePath(const std::string& resource_id);
338 338
339 // Recursively extracts the paths set of all sub-directories. 339 // Recursively extracts the paths set of all sub-directories.
340 void GetDescendantDirectoryPaths(const std::string& resource_id, 340 void GetDescendantDirectoryPaths(const std::string& resource_id,
341 std::set<base::FilePath>* child_directories); 341 std::set<base::FilePath>* child_directories);
342 342
343 // Adds a child entry to its parent directory. 343 // Puts an entry under its parent directory. Removes the child from the old
344 // The method will also do name de-duplication to ensure that the 344 // parent if there is. This method will also do name de-duplication to ensure
345 // exposed presentation path does not have naming conflicts. Two files with 345 // that the exposed presentation path does not have naming conflicts. Two
346 // the same name "Foo" will be renames to "Foo (1)" and "Foo (2)". 346 // files with the same name "Foo" will be renames to "Foo (1)" and "Foo (2)".
347 void AddEntryToDirectory(const DriveEntryProto& entry); 347 bool PutEntryUnderDirectory(const DriveEntryProto& entry);
348 348
349 // Removes the entry from its parent directory. 349 // Removes the entry and its descendants.
350 void RemoveDirectoryChild(const std::string& child_resource_id); 350 bool RemoveEntryRecursively(const std::string& resource_id);
351
352 // Detaches the entry from its parent directory.
353 void DetachEntryFromDirectory(const std::string& child_resource_id);
354
355 // Removes child elements of directory.
356 void RemoveDirectoryChildren(const std::string& directory_resource_id);
357 351
358 // Converts the children as a vector of DriveEntryProto. 352 // Converts the children as a vector of DriveEntryProto.
359 scoped_ptr<DriveEntryProtoVector> DirectoryChildrenToProtoVector( 353 scoped_ptr<DriveEntryProtoVector> DirectoryChildrenToProtoVector(
360 const std::string& directory_resource_id); 354 const std::string& directory_resource_id);
361 355
362 const base::FilePath data_directory_path_; 356 const base::FilePath data_directory_path_;
363 357
364 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; 358 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
365 359
366 scoped_ptr<DriveResourceMetadataStorage> storage_; 360 scoped_ptr<DriveResourceMetadataStorage> storage_;
367 361
368 // This should remain the last member so it'll be destroyed first and 362 // This should remain the last member so it'll be destroyed first and
369 // invalidate its weak pointers before other members are destroyed. 363 // invalidate its weak pointers before other members are destroyed.
370 base::WeakPtrFactory<DriveResourceMetadata> weak_ptr_factory_; 364 base::WeakPtrFactory<DriveResourceMetadata> weak_ptr_factory_;
371 365
372 DISALLOW_COPY_AND_ASSIGN(DriveResourceMetadata); 366 DISALLOW_COPY_AND_ASSIGN(DriveResourceMetadata);
373 }; 367 };
374 368
375 } // namespace drive 369 } // namespace drive
376 370
377 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_RESOURCE_METADATA_H_ 371 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_RESOURCE_METADATA_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/drive/drive_resource_metadata.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698