| 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 #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 Loading... |
| 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); |
| 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 Loading... |
| 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 |
| OLD | NEW |