Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(462)

Side by Side Diff: chrome/browser/chromeos/drive/drive_file_system.cc

Issue 11876002: Make largest_changestamp setter/getter asynchronous. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: rebase + comment Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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(
159 DriveFileSystemMetadata metadata, // Will be modified.
160 const GetFilesystemMetadataCallback& callback,
161 int64 largest_changestamp) {
162 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
163 DCHECK(!callback.is_null());
164
165 metadata.largest_changestamp = largest_changestamp;
166 callback.Run(metadata);
167 }
168
156 } // namespace 169 } // namespace
157 170
158 // DriveFileSystem::FindFirstMissingParentDirectoryParams implementation. 171 // DriveFileSystem::FindFirstMissingParentDirectoryParams implementation.
159 struct DriveFileSystem::FindFirstMissingParentDirectoryParams { 172 struct DriveFileSystem::FindFirstMissingParentDirectoryParams {
160 FindFirstMissingParentDirectoryParams( 173 FindFirstMissingParentDirectoryParams(
161 const std::vector<FilePath::StringType>& path_parts, 174 const std::vector<FilePath::StringType>& path_parts,
162 const FindFirstMissingParentDirectoryCallback& callback) 175 const FindFirstMissingParentDirectoryCallback& callback)
163 : path_parts(path_parts), 176 : path_parts(path_parts),
164 index(0), 177 index(0),
165 callback(callback) { 178 callback(callback) {
(...skipping 1608 matching lines...) Expand 10 before | Expand all | Expand 10 after
1774 1787
1775 OnDirectoryChanged(file_path.DirName()); 1788 OnDirectoryChanged(file_path.DirName());
1776 1789
1777 cache_->Store(params.resource_id, 1790 cache_->Store(params.resource_id,
1778 params.md5, 1791 params.md5,
1779 params.file_content_path, 1792 params.file_content_path,
1780 DriveCache::FILE_OPERATION_COPY, 1793 DriveCache::FILE_OPERATION_COPY,
1781 params.callback); 1794 params.callback);
1782 } 1795 }
1783 1796
1784 DriveFileSystemMetadata DriveFileSystem::GetMetadata() const { 1797 void DriveFileSystem::GetMetadata(
1798 const GetFilesystemMetadataCallback& callback) {
1799 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1800 DCHECK(!callback.is_null());
1801
1785 DriveFileSystemMetadata metadata; 1802 DriveFileSystemMetadata metadata;
1786 metadata.largest_changestamp = resource_metadata_->largest_changestamp();
1787 metadata.loaded = resource_metadata_->loaded(); 1803 metadata.loaded = resource_metadata_->loaded();
1788 metadata.refreshing = feed_loader_->refreshing(); 1804 metadata.refreshing = feed_loader_->refreshing();
1789 1805
1790 // Metadata related to delta update. 1806 // Metadata related to delta update.
1791 metadata.push_notification_enabled = push_notification_enabled_; 1807 metadata.push_notification_enabled = push_notification_enabled_;
1792 metadata.polling_interval_sec = polling_interval_sec_; 1808 metadata.polling_interval_sec = polling_interval_sec_;
1793 metadata.last_update_check_time = last_update_check_time_; 1809 metadata.last_update_check_time = last_update_check_time_;
1794 metadata.last_update_check_error = last_update_check_error_; 1810 metadata.last_update_check_error = last_update_check_error_;
1795 1811
1796 return metadata; 1812 resource_metadata_->GetLargestChangestamp(
1813 base::Bind(&OnGetLargestChangestamp, metadata, callback));
1797 } 1814 }
1798 1815
1799 void DriveFileSystem::OnDisableDriveHostedFilesChanged() { 1816 void DriveFileSystem::OnDisableDriveHostedFilesChanged() {
1800 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1817 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1801 PrefService* pref_service = profile_->GetPrefs(); 1818 PrefService* pref_service = profile_->GetPrefs();
1802 SetHideHostedDocuments( 1819 SetHideHostedDocuments(
1803 pref_service->GetBoolean(prefs::kDisableDriveHostedFiles)); 1820 pref_service->GetBoolean(prefs::kDisableDriveHostedFiles));
1804 } 1821 }
1805 1822
1806 void DriveFileSystem::SetHideHostedDocuments(bool hide) { 1823 void DriveFileSystem::SetHideHostedDocuments(bool hide) {
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
2141 return; 2158 return;
2142 } 2159 }
2143 2160
2144 PlatformFileInfoProto entry_file_info; 2161 PlatformFileInfoProto entry_file_info;
2145 util::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info); 2162 util::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info);
2146 *entry_proto->mutable_file_info() = entry_file_info; 2163 *entry_proto->mutable_file_info() = entry_file_info;
2147 callback.Run(DRIVE_FILE_OK, entry_proto.Pass()); 2164 callback.Run(DRIVE_FILE_OK, entry_proto.Pass());
2148 } 2165 }
2149 2166
2150 } // namespace drive 2167 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/drive_file_system.h ('k') | chrome/browser/chromeos/drive/drive_file_system_interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698