Chromium Code Reviews| 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/json/json_file_value_serializer.h" | 9 #include "base/json/json_file_value_serializer.h" |
| 10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 146 // create GetEntryInfoCallback. | 146 // create GetEntryInfoCallback. |
| 147 void RunGetEntryInfoWithFilePathCallback( | 147 void RunGetEntryInfoWithFilePathCallback( |
| 148 const GetEntryInfoWithFilePathCallback& callback, | 148 const GetEntryInfoWithFilePathCallback& callback, |
| 149 const FilePath& path, | 149 const FilePath& path, |
| 150 DriveFileError error, | 150 DriveFileError error, |
| 151 scoped_ptr<DriveEntryProto> entry_proto) { | 151 scoped_ptr<DriveEntryProto> entry_proto) { |
| 152 DCHECK(!callback.is_null()); | 152 DCHECK(!callback.is_null()); |
| 153 callback.Run(error, path, entry_proto.Pass()); | 153 callback.Run(error, path, entry_proto.Pass()); |
| 154 } | 154 } |
| 155 | 155 |
| 156 // Callback for DriveResourceMetadata::GetLargestChangestamp. | |
| 157 // |callback| must not be null. | |
| 158 void OnGetLargestChangestamp(DriveFileSystemMetadata metadata, | |
|
satorux1
2013/01/15 19:19:01
Maybe: const DriveFileSystemMetadata& metadata
achuithb
2013/01/15 22:10:36
How strongly do you feel about this? I need to mod
satorux1
2013/01/16 00:47:30
Ah then this is fine. Maybe:
DriveFileSystemMetad
achuithb
2013/01/16 01:00:22
Done.
| |
| 159 const GetFilesystemMetadataCallback& callback, | |
| 160 int64 largest_changestamp) { | |
| 161 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
| 162 DCHECK(!callback.is_null()); | |
| 163 | |
| 164 metadata.largest_changestamp = largest_changestamp; | |
| 165 callback.Run(metadata); | |
| 166 } | |
| 167 | |
| 156 } // namespace | 168 } // namespace |
| 157 | 169 |
| 158 // DriveFileSystem::FindFirstMissingParentDirectoryParams implementation. | 170 // DriveFileSystem::FindFirstMissingParentDirectoryParams implementation. |
| 159 struct DriveFileSystem::FindFirstMissingParentDirectoryParams { | 171 struct DriveFileSystem::FindFirstMissingParentDirectoryParams { |
| 160 FindFirstMissingParentDirectoryParams( | 172 FindFirstMissingParentDirectoryParams( |
| 161 const std::vector<FilePath::StringType>& path_parts, | 173 const std::vector<FilePath::StringType>& path_parts, |
| 162 const FindFirstMissingParentDirectoryCallback& callback) | 174 const FindFirstMissingParentDirectoryCallback& callback) |
| 163 : path_parts(path_parts), | 175 : path_parts(path_parts), |
| 164 index(0), | 176 index(0), |
| 165 callback(callback) { | 177 callback(callback) { |
| (...skipping 1608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1774 | 1786 |
| 1775 OnDirectoryChanged(file_path.DirName()); | 1787 OnDirectoryChanged(file_path.DirName()); |
| 1776 | 1788 |
| 1777 cache_->Store(params.resource_id, | 1789 cache_->Store(params.resource_id, |
| 1778 params.md5, | 1790 params.md5, |
| 1779 params.file_content_path, | 1791 params.file_content_path, |
| 1780 DriveCache::FILE_OPERATION_COPY, | 1792 DriveCache::FILE_OPERATION_COPY, |
| 1781 params.callback); | 1793 params.callback); |
| 1782 } | 1794 } |
| 1783 | 1795 |
| 1784 DriveFileSystemMetadata DriveFileSystem::GetMetadata() const { | 1796 void DriveFileSystem::GetMetadata( |
| 1797 const GetFilesystemMetadataCallback& callback) { | |
| 1798 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
| 1799 DCHECK(!callback.is_null()); | |
| 1800 | |
| 1785 DriveFileSystemMetadata metadata; | 1801 DriveFileSystemMetadata metadata; |
| 1786 metadata.largest_changestamp = resource_metadata_->largest_changestamp(); | |
| 1787 metadata.loaded = resource_metadata_->loaded(); | 1802 metadata.loaded = resource_metadata_->loaded(); |
| 1788 metadata.refreshing = feed_loader_->refreshing(); | 1803 metadata.refreshing = feed_loader_->refreshing(); |
| 1789 | 1804 |
| 1790 // Metadata related to delta update. | 1805 // Metadata related to delta update. |
| 1791 metadata.push_notification_enabled = push_notification_enabled_; | 1806 metadata.push_notification_enabled = push_notification_enabled_; |
| 1792 metadata.polling_interval_sec = polling_interval_sec_; | 1807 metadata.polling_interval_sec = polling_interval_sec_; |
| 1793 metadata.last_update_check_time = last_update_check_time_; | 1808 metadata.last_update_check_time = last_update_check_time_; |
| 1794 metadata.last_update_check_error = last_update_check_error_; | 1809 metadata.last_update_check_error = last_update_check_error_; |
| 1795 | 1810 |
| 1796 return metadata; | 1811 resource_metadata_->GetLargestChangestamp( |
| 1812 base::Bind(&OnGetLargestChangestamp, metadata, callback)); | |
| 1797 } | 1813 } |
| 1798 | 1814 |
| 1799 void DriveFileSystem::OnDisableDriveHostedFilesChanged() { | 1815 void DriveFileSystem::OnDisableDriveHostedFilesChanged() { |
| 1800 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1816 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 1801 PrefService* pref_service = profile_->GetPrefs(); | 1817 PrefService* pref_service = profile_->GetPrefs(); |
| 1802 SetHideHostedDocuments( | 1818 SetHideHostedDocuments( |
| 1803 pref_service->GetBoolean(prefs::kDisableDriveHostedFiles)); | 1819 pref_service->GetBoolean(prefs::kDisableDriveHostedFiles)); |
| 1804 } | 1820 } |
| 1805 | 1821 |
| 1806 void DriveFileSystem::SetHideHostedDocuments(bool hide) { | 1822 void DriveFileSystem::SetHideHostedDocuments(bool hide) { |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2141 return; | 2157 return; |
| 2142 } | 2158 } |
| 2143 | 2159 |
| 2144 PlatformFileInfoProto entry_file_info; | 2160 PlatformFileInfoProto entry_file_info; |
| 2145 util::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info); | 2161 util::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info); |
| 2146 *entry_proto->mutable_file_info() = entry_file_info; | 2162 *entry_proto->mutable_file_info() = entry_file_info; |
| 2147 callback.Run(DRIVE_FILE_OK, entry_proto.Pass()); | 2163 callback.Run(DRIVE_FILE_OK, entry_proto.Pass()); |
| 2148 } | 2164 } |
| 2149 | 2165 |
| 2150 } // namespace drive | 2166 } // namespace drive |
| OLD | NEW |