| 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 <errno.h> | 7 #include <errno.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1048 new ReadOnlyFindFileDelegate()); | 1048 new ReadOnlyFindFileDelegate()); |
| 1049 UnsafeFindFileByPath(file_path, update_delegate); | 1049 UnsafeFindFileByPath(file_path, update_delegate); |
| 1050 | 1050 |
| 1051 GDataFileBase* file = update_delegate->file(); | 1051 GDataFileBase* file = update_delegate->file(); |
| 1052 | 1052 |
| 1053 if (!file) | 1053 if (!file) |
| 1054 return base::PLATFORM_FILE_ERROR_NOT_FOUND; | 1054 return base::PLATFORM_FILE_ERROR_NOT_FOUND; |
| 1055 | 1055 |
| 1056 // If it's a file (only files have resource), remove it from cache. | 1056 // If it's a file (only files have resource), remove it from cache. |
| 1057 if (file->AsGDataFile()) { | 1057 if (file->AsGDataFile()) { |
| 1058 RemoveFromCache(file->AsGDataFile()->resource(), | 1058 RemoveFromCache(file->AsGDataFile()->resource_id(), |
| 1059 base::Bind(&GDataFileSystem::OnRemovedFromCache, | 1059 base::Bind(&GDataFileSystem::OnRemovedFromCache, |
| 1060 weak_ptr_factory_.GetWeakPtr())); | 1060 weak_ptr_factory_.GetWeakPtr())); |
| 1061 } | 1061 } |
| 1062 | 1062 |
| 1063 // You can't remove root element. | 1063 // You can't remove root element. |
| 1064 if (!file->parent()) | 1064 if (!file->parent()) |
| 1065 return base::PLATFORM_FILE_ERROR_ACCESS_DENIED; | 1065 return base::PLATFORM_FILE_ERROR_ACCESS_DENIED; |
| 1066 | 1066 |
| 1067 if (!file->parent()->RemoveFile(file)) | 1067 if (!file->parent()->RemoveFile(file)) |
| 1068 return base::PLATFORM_FILE_ERROR_NOT_FOUND; | 1068 return base::PLATFORM_FILE_ERROR_NOT_FOUND; |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1472 | 1472 |
| 1473 GDataFileSystemFactory::~GDataFileSystemFactory() { | 1473 GDataFileSystemFactory::~GDataFileSystemFactory() { |
| 1474 } | 1474 } |
| 1475 | 1475 |
| 1476 ProfileKeyedService* GDataFileSystemFactory::BuildServiceInstanceFor( | 1476 ProfileKeyedService* GDataFileSystemFactory::BuildServiceInstanceFor( |
| 1477 Profile* profile) const { | 1477 Profile* profile) const { |
| 1478 return new GDataFileSystem(profile, new DocumentsService); | 1478 return new GDataFileSystem(profile, new DocumentsService); |
| 1479 } | 1479 } |
| 1480 | 1480 |
| 1481 } // namespace gdata | 1481 } // namespace gdata |
| OLD | NEW |