| 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/eintr_wrapper.h" | 10 #include "base/eintr_wrapper.h" |
| 11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 12 #include "base/json/json_reader.h" | 12 #include "base/json/json_reader.h" |
| 13 #include "base/json/json_writer.h" | 13 #include "base/json/json_writer.h" |
| 14 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
| 15 #include "base/message_loop_proxy.h" | 15 #include "base/message_loop_proxy.h" |
| 16 #include "base/platform_file.h" | 16 #include "base/platform_file.h" |
| 17 #include "base/synchronization/waitable_event.h" | 17 #include "base/synchronization/waitable_event.h" |
| 18 #include "base/values.h" | 18 #include "base/values.h" |
| 19 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/browser_process.h" |
| 20 #include "chrome/browser/chromeos/gdata/gdata.h" | 20 #include "chrome/browser/chromeos/gdata/gdata.h" |
| 21 #include "chrome/browser/chromeos/gdata/gdata_download_observer.h" | 21 #include "chrome/browser/chromeos/gdata/gdata_download_observer.h" |
| 22 #include "chrome/browser/chromeos/gdata/gdata_parser.h" |
| 22 #include "chrome/browser/download/download_service.h" | 23 #include "chrome/browser/download/download_service.h" |
| 23 #include "chrome/browser/download/download_service_factory.h" | 24 #include "chrome/browser/download/download_service_factory.h" |
| 24 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
| 25 #include "chrome/browser/profiles/profile_dependency_manager.h" | 26 #include "chrome/browser/profiles/profile_dependency_manager.h" |
| 26 #include "chrome/common/chrome_constants.h" | 27 #include "chrome/common/chrome_constants.h" |
| 27 #include "chrome/common/chrome_paths_internal.h" | 28 #include "chrome/common/chrome_paths_internal.h" |
| 28 #include "content/public/browser/browser_thread.h" | 29 #include "content/public/browser/browser_thread.h" |
| 29 #include "webkit/fileapi/file_system_file_util_proxy.h" | 30 #include "webkit/fileapi/file_system_file_util_proxy.h" |
| 30 #include "webkit/fileapi/file_system_types.h" | 31 #include "webkit/fileapi/file_system_types.h" |
| 31 #include "webkit/fileapi/file_system_util.h" | 32 #include "webkit/fileapi/file_system_util.h" |
| (...skipping 1225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1257 return; | 1258 return; |
| 1258 } | 1259 } |
| 1259 | 1260 |
| 1260 SaveFeed(data.Pass(), FilePath(kAccountMetadataFile)); | 1261 SaveFeed(data.Pass(), FilePath(kAccountMetadataFile)); |
| 1261 | 1262 |
| 1262 callback.Run(base::PLATFORM_FILE_OK, | 1263 callback.Run(base::PLATFORM_FILE_OK, |
| 1263 feed->quota_bytes_total(), | 1264 feed->quota_bytes_total(), |
| 1264 feed->quota_bytes_used()); | 1265 feed->quota_bytes_used()); |
| 1265 } | 1266 } |
| 1266 | 1267 |
| 1267 std::vector<GDataOperationRegistry::ProgressStatus> | |
| 1268 GDataFileSystem::GetProgressStatusList() { | |
| 1269 return documents_service_->operation_registry()->GetProgressStatusList(); | |
| 1270 } | |
| 1271 | |
| 1272 void GDataFileSystem::AddOperationObserver( | |
| 1273 GDataOperationRegistry::Observer* observer) { | |
| 1274 return documents_service_->operation_registry()->AddObserver(observer); | |
| 1275 } | |
| 1276 | |
| 1277 void GDataFileSystem::RemoveOperationObserver( | |
| 1278 GDataOperationRegistry::Observer* observer) { | |
| 1279 return documents_service_->operation_registry()->RemoveObserver(observer); | |
| 1280 } | |
| 1281 | |
| 1282 | |
| 1283 void GDataFileSystem::OnCreateDirectoryCompleted( | 1268 void GDataFileSystem::OnCreateDirectoryCompleted( |
| 1284 const CreateDirectoryParams& params, | 1269 const CreateDirectoryParams& params, |
| 1285 GDataErrorCode status, | 1270 GDataErrorCode status, |
| 1286 scoped_ptr<base::Value> data) { | 1271 scoped_ptr<base::Value> data) { |
| 1287 | 1272 |
| 1288 base::PlatformFileError error = GDataToPlatformError(status); | 1273 base::PlatformFileError error = GDataToPlatformError(status); |
| 1289 if (error != base::PLATFORM_FILE_OK) { | 1274 if (error != base::PLATFORM_FILE_OK) { |
| 1290 if (!params.callback.is_null()) | 1275 if (!params.callback.is_null()) |
| 1291 params.callback.Run(error); | 1276 params.callback.Run(error); |
| 1292 | 1277 |
| (...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2334 | 2319 |
| 2335 GDataFileSystemFactory::~GDataFileSystemFactory() { | 2320 GDataFileSystemFactory::~GDataFileSystemFactory() { |
| 2336 } | 2321 } |
| 2337 | 2322 |
| 2338 ProfileKeyedService* GDataFileSystemFactory::BuildServiceInstanceFor( | 2323 ProfileKeyedService* GDataFileSystemFactory::BuildServiceInstanceFor( |
| 2339 Profile* profile) const { | 2324 Profile* profile) const { |
| 2340 return new GDataFileSystem(profile, new DocumentsService); | 2325 return new GDataFileSystem(profile, new DocumentsService); |
| 2341 } | 2326 } |
| 2342 | 2327 |
| 2343 } // namespace gdata | 2328 } // namespace gdata |
| OLD | NEW |