| 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/drive/drive_file_system.h" | 5 #include "chrome/browser/chromeos/drive/drive_file_system.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 const base::FilePath& path, | 74 const base::FilePath& path, |
| 75 FileError error, | 75 FileError error, |
| 76 scoped_ptr<DriveEntryProto> entry_proto) { | 76 scoped_ptr<DriveEntryProto> entry_proto) { |
| 77 DCHECK(!callback.is_null()); | 77 DCHECK(!callback.is_null()); |
| 78 callback.Run(error, path, entry_proto.Pass()); | 78 callback.Run(error, path, entry_proto.Pass()); |
| 79 } | 79 } |
| 80 | 80 |
| 81 // Callback for ResourceMetadata::GetLargestChangestamp. | 81 // Callback for ResourceMetadata::GetLargestChangestamp. |
| 82 // |callback| must not be null. | 82 // |callback| must not be null. |
| 83 void OnGetLargestChangestamp( | 83 void OnGetLargestChangestamp( |
| 84 DriveFileSystemMetadata metadata, // Will be modified. | 84 FileSystemMetadata metadata, // Will be modified. |
| 85 const GetFilesystemMetadataCallback& callback, | 85 const GetFilesystemMetadataCallback& callback, |
| 86 int64 largest_changestamp) { | 86 int64 largest_changestamp) { |
| 87 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 87 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 88 DCHECK(!callback.is_null()); | 88 DCHECK(!callback.is_null()); |
| 89 | 89 |
| 90 metadata.largest_changestamp = largest_changestamp; | 90 metadata.largest_changestamp = largest_changestamp; |
| 91 callback.Run(metadata); | 91 callback.Run(metadata); |
| 92 } | 92 } |
| 93 | 93 |
| 94 // Thin adapter to map GetFileCallback to FileOperationCallback. | 94 // Thin adapter to map GetFileCallback to FileOperationCallback. |
| (...skipping 1322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1417 params.file_content_path, | 1417 params.file_content_path, |
| 1418 DriveCache::FILE_OPERATION_COPY, | 1418 DriveCache::FILE_OPERATION_COPY, |
| 1419 params.callback); | 1419 params.callback); |
| 1420 } | 1420 } |
| 1421 | 1421 |
| 1422 void DriveFileSystem::GetMetadata( | 1422 void DriveFileSystem::GetMetadata( |
| 1423 const GetFilesystemMetadataCallback& callback) { | 1423 const GetFilesystemMetadataCallback& callback) { |
| 1424 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1424 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 1425 DCHECK(!callback.is_null()); | 1425 DCHECK(!callback.is_null()); |
| 1426 | 1426 |
| 1427 DriveFileSystemMetadata metadata; | 1427 FileSystemMetadata metadata; |
| 1428 metadata.refreshing = change_list_loader_->IsRefreshing(); | 1428 metadata.refreshing = change_list_loader_->IsRefreshing(); |
| 1429 | 1429 |
| 1430 // Metadata related to delta update. | 1430 // Metadata related to delta update. |
| 1431 metadata.last_update_check_time = last_update_check_time_; | 1431 metadata.last_update_check_time = last_update_check_time_; |
| 1432 metadata.last_update_check_error = last_update_check_error_; | 1432 metadata.last_update_check_error = last_update_check_error_; |
| 1433 | 1433 |
| 1434 resource_metadata_->GetLargestChangestamp( | 1434 resource_metadata_->GetLargestChangestamp( |
| 1435 base::Bind(&OnGetLargestChangestamp, metadata, callback)); | 1435 base::Bind(&OnGetLargestChangestamp, metadata, callback)); |
| 1436 } | 1436 } |
| 1437 | 1437 |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1828 util::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info); | 1828 util::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info); |
| 1829 *entry_proto->mutable_file_info() = entry_file_info; | 1829 *entry_proto->mutable_file_info() = entry_file_info; |
| 1830 callback.Run(FILE_ERROR_OK, entry_proto.Pass()); | 1830 callback.Run(FILE_ERROR_OK, entry_proto.Pass()); |
| 1831 } | 1831 } |
| 1832 | 1832 |
| 1833 void DriveFileSystem::CancelJobInScheduler(JobID id) { | 1833 void DriveFileSystem::CancelJobInScheduler(JobID id) { |
| 1834 scheduler_->CancelJob(id); | 1834 scheduler_->CancelJob(id); |
| 1835 } | 1835 } |
| 1836 | 1836 |
| 1837 } // namespace drive | 1837 } // namespace drive |
| OLD | NEW |