| Index: chrome/browser/chromeos/gdata/gdata_files.cc
|
| ===================================================================
|
| --- chrome/browser/chromeos/gdata/gdata_files.cc (revision 150448)
|
| +++ chrome/browser/chromeos/gdata/gdata_files.cc (working copy)
|
| @@ -324,16 +324,6 @@
|
| entry->SetParent(this);
|
| }
|
|
|
| -bool GDataDirectory::TakeEntry(GDataEntry* entry) {
|
| - DCHECK(entry);
|
| - DCHECK(entry->parent());
|
| -
|
| - entry->parent()->RemoveChild(entry);
|
| - AddEntry(entry);
|
| -
|
| - return true;
|
| -}
|
| -
|
| bool GDataDirectory::TakeOverEntries(GDataDirectory* dir) {
|
| for (GDataFileCollection::iterator iter = dir->child_files_.begin();
|
| iter != dir->child_files_.end(); ++iter) {
|
| @@ -580,8 +570,15 @@
|
| void GDataDirectoryService::AddEntryToDirectory(
|
| const FilePath& directory_path,
|
| GDataEntry* entry,
|
| - const FileOperationCallback& callback) {
|
| + const FilePathUpdateCallback& callback) {
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| + DCHECK(entry);
|
| +
|
| + if (entry->parent())
|
| + entry->parent()->RemoveChild(entry);
|
| +
|
| GDataEntry* destination = FindEntryByPathSync(directory_path);
|
| + FilePath updated_file_path;
|
| GDataFileError error = GDATA_FILE_ERROR_FAILED;
|
| if (!destination) {
|
| error = GDATA_FILE_ERROR_NOT_FOUND;
|
| @@ -589,11 +586,12 @@
|
| error = GDATA_FILE_ERROR_NOT_A_DIRECTORY;
|
| } else {
|
| destination->AsGDataDirectory()->AddEntry(entry);
|
| + updated_file_path = entry->GetFilePath();
|
| error = GDATA_FILE_OK;
|
| }
|
| if (!callback.is_null()) {
|
| base::MessageLoopProxy::current()->PostTask(
|
| - FROM_HERE, base::Bind(callback, error));
|
| + FROM_HERE, base::Bind(callback, error, updated_file_path));
|
| }
|
| }
|
|
|
| @@ -956,7 +954,7 @@
|
| DCHECK(!proto.gdata_entry().has_file_specific_info());
|
|
|
| for (int i = 0; i < proto.child_files_size(); ++i) {
|
| - scoped_ptr<GDataFile> file(new GDataFile(this, directory_service_));
|
| + scoped_ptr<GDataFile> file(new GDataFile(NULL, directory_service_));
|
| if (!file->FromProto(proto.child_files(i))) {
|
| RemoveChildren();
|
| return false;
|
| @@ -964,7 +962,7 @@
|
| AddEntry(file.release());
|
| }
|
| for (int i = 0; i < proto.child_directories_size(); ++i) {
|
| - scoped_ptr<GDataDirectory> dir(new GDataDirectory(this,
|
| + scoped_ptr<GDataDirectory> dir(new GDataDirectory(NULL,
|
| directory_service_));
|
| if (!dir->FromProto(proto.child_directories(i))) {
|
| RemoveChildren();
|
|
|