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

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_file_system.cc

Issue 10825218: Simplify implementation of FindEntryByPathSync (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: remove FindChildAsync 2 Created 8 years, 4 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
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 #include "chrome/browser/chromeos/gdata/gdata_file_system.h" 5 #include "chrome/browser/chromeos/gdata/gdata_file_system.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 2848 matching lines...) Expand 10 before | Expand all | Expand 10 after
2859 // You can't remove root element. 2859 // You can't remove root element.
2860 if (!entry->parent()) 2860 if (!entry->parent())
2861 return GDATA_FILE_ERROR_ACCESS_DENIED; 2861 return GDATA_FILE_ERROR_ACCESS_DENIED;
2862 2862
2863 // If it's a file (only files have resource id), get its resource id so that 2863 // If it's a file (only files have resource id), get its resource id so that
2864 // we can remove it after releasing the auto lock. 2864 // we can remove it after releasing the auto lock.
2865 if (entry->AsGDataFile()) 2865 if (entry->AsGDataFile())
2866 *resource_id = entry->AsGDataFile()->resource_id(); 2866 *resource_id = entry->AsGDataFile()->resource_id();
2867 2867
2868 GDataDirectory* parent_dir = entry->parent(); 2868 GDataDirectory* parent_dir = entry->parent();
2869 if (!parent_dir->RemoveEntry(entry)) 2869 parent_dir->RemoveEntry(entry);
satorux1 2012/08/07 22:27:05 Is this a good thing to do? I think removing an no
achuithb 2012/08/07 22:28:32 We already look up the entry using FindEntryByPath
satorux1 2012/08/07 22:38:09 Ah that's a good point.
2870 return GDATA_FILE_ERROR_NOT_FOUND;
2871 2870
2872 FOR_EACH_OBSERVER(GDataFileSystemInterface::Observer, observers_, 2871 FOR_EACH_OBSERVER(GDataFileSystemInterface::Observer, observers_,
2873 OnDirectoryChanged(parent_dir->GetFilePath())); 2872 OnDirectoryChanged(parent_dir->GetFilePath()));
2874 return GDATA_FILE_OK; 2873 return GDATA_FILE_OK;
2875 } 2874 }
2876 2875
2877 void GDataFileSystem::AddUploadedFile( 2876 void GDataFileSystem::AddUploadedFile(
2878 UploadMode upload_mode, 2877 UploadMode upload_mode,
2879 const FilePath& virtual_dir_path, 2878 const FilePath& virtual_dir_path,
2880 scoped_ptr<DocumentEntry> entry, 2879 scoped_ptr<DocumentEntry> entry,
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
3425 } 3424 }
3426 3425
3427 PlatformFileInfoProto entry_file_info; 3426 PlatformFileInfoProto entry_file_info;
3428 GDataEntry::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info); 3427 GDataEntry::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info);
3429 *entry_proto->mutable_file_info() = entry_file_info; 3428 *entry_proto->mutable_file_info() = entry_file_info;
3430 if (!callback.is_null()) 3429 if (!callback.is_null())
3431 callback.Run(GDATA_FILE_OK, entry_proto.Pass()); 3430 callback.Run(GDATA_FILE_OK, entry_proto.Pass());
3432 } 3431 }
3433 3432
3434 } // namespace gdata 3433 } // namespace gdata
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/gdata/gdata_files.h » ('j') | chrome/browser/chromeos/gdata/gdata_files.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698