| 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 <set> | 7 #include <set> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 12 #include "base/json/json_file_value_serializer.h" | 12 #include "base/json/json_file_value_serializer.h" |
| 13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
| 14 #include "base/message_loop_proxy.h" | 14 #include "base/message_loop_proxy.h" |
| 15 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
| 16 #include "base/platform_file.h" | 16 #include "base/platform_file.h" |
| 17 #include "base/threading/sequenced_worker_pool.h" | 17 #include "base/threading/sequenced_worker_pool.h" |
| 18 #include "base/values.h" | 18 #include "base/values.h" |
| 19 #include "chrome/browser/chromeos/gdata/documents_service_interface.h" | |
| 20 #include "chrome/browser/chromeos/gdata/drive_api_parser.h" | 19 #include "chrome/browser/chromeos/gdata/drive_api_parser.h" |
| 20 #include "chrome/browser/chromeos/gdata/drive_service_interface.h" |
| 21 #include "chrome/browser/chromeos/gdata/drive_webapps_registry.h" | 21 #include "chrome/browser/chromeos/gdata/drive_webapps_registry.h" |
| 22 #include "chrome/browser/chromeos/gdata/gdata.pb.h" | 22 #include "chrome/browser/chromeos/gdata/gdata.pb.h" |
| 23 #include "chrome/browser/chromeos/gdata/gdata_download_observer.h" | 23 #include "chrome/browser/chromeos/gdata/gdata_download_observer.h" |
| 24 #include "chrome/browser/chromeos/gdata/gdata_files.h" | 24 #include "chrome/browser/chromeos/gdata/gdata_files.h" |
| 25 #include "chrome/browser/chromeos/gdata/gdata_protocol_handler.h" | 25 #include "chrome/browser/chromeos/gdata/gdata_protocol_handler.h" |
| 26 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" | 26 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" |
| 27 #include "chrome/browser/chromeos/gdata/gdata_uploader.h" | 27 #include "chrome/browser/chromeos/gdata/gdata_uploader.h" |
| 28 #include "chrome/browser/chromeos/gdata/gdata_util.h" | 28 #include "chrome/browser/chromeos/gdata/gdata_util.h" |
| 29 #include "chrome/browser/chromeos/gdata/task_util.h" | 29 #include "chrome/browser/chromeos/gdata/task_util.h" |
| 30 #include "chrome/browser/prefs/pref_service.h" | 30 #include "chrome/browser/prefs/pref_service.h" |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 std::string resource_id; | 407 std::string resource_id; |
| 408 std::string md5; | 408 std::string md5; |
| 409 }; | 409 }; |
| 410 | 410 |
| 411 | 411 |
| 412 // GDataFileSystem class implementation. | 412 // GDataFileSystem class implementation. |
| 413 | 413 |
| 414 GDataFileSystem::GDataFileSystem( | 414 GDataFileSystem::GDataFileSystem( |
| 415 Profile* profile, | 415 Profile* profile, |
| 416 GDataCache* cache, | 416 GDataCache* cache, |
| 417 DocumentsServiceInterface* documents_service, | 417 DriveServiceInterface* drive_service, |
| 418 GDataUploaderInterface* uploader, | 418 GDataUploaderInterface* uploader, |
| 419 DriveWebAppsRegistryInterface* webapps_registry, | 419 DriveWebAppsRegistryInterface* webapps_registry, |
| 420 base::SequencedTaskRunner* blocking_task_runner) | 420 base::SequencedTaskRunner* blocking_task_runner) |
| 421 : profile_(profile), | 421 : profile_(profile), |
| 422 cache_(cache), | 422 cache_(cache), |
| 423 uploader_(uploader), | 423 uploader_(uploader), |
| 424 documents_service_(documents_service), | 424 drive_service_(drive_service), |
| 425 webapps_registry_(webapps_registry), | 425 webapps_registry_(webapps_registry), |
| 426 update_timer_(true /* retain_user_task */, true /* is_repeating */), | 426 update_timer_(true /* retain_user_task */, true /* is_repeating */), |
| 427 hide_hosted_docs_(false), | 427 hide_hosted_docs_(false), |
| 428 blocking_task_runner_(blocking_task_runner), | 428 blocking_task_runner_(blocking_task_runner), |
| 429 ui_weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), | 429 ui_weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), |
| 430 ui_weak_ptr_(ui_weak_ptr_factory_.GetWeakPtr()) { | 430 ui_weak_ptr_(ui_weak_ptr_factory_.GetWeakPtr()) { |
| 431 // Should be created from the file browser extension API on UI thread. | 431 // Should be created from the file browser extension API on UI thread. |
| 432 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 432 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 433 } | 433 } |
| 434 | 434 |
| 435 void GDataFileSystem::Initialize() { | 435 void GDataFileSystem::Initialize() { |
| 436 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 436 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 437 | 437 |
| 438 documents_service_->Initialize(profile_); | 438 drive_service_->Initialize(profile_); |
| 439 | 439 |
| 440 directory_service_.reset(new GDataDirectoryService); | 440 directory_service_.reset(new GDataDirectoryService); |
| 441 feed_loader_.reset(new GDataWapiFeedLoader(directory_service_.get(), | 441 feed_loader_.reset(new GDataWapiFeedLoader(directory_service_.get(), |
| 442 documents_service_, | 442 drive_service_, |
| 443 webapps_registry_, | 443 webapps_registry_, |
| 444 cache_, | 444 cache_, |
| 445 blocking_task_runner_)); | 445 blocking_task_runner_)); |
| 446 feed_loader_->AddObserver(this); | 446 feed_loader_->AddObserver(this); |
| 447 | 447 |
| 448 PrefService* pref_service = profile_->GetPrefs(); | 448 PrefService* pref_service = profile_->GetPrefs(); |
| 449 hide_hosted_docs_ = pref_service->GetBoolean(prefs::kDisableGDataHostedFiles); | 449 hide_hosted_docs_ = pref_service->GetBoolean(prefs::kDisableGDataHostedFiles); |
| 450 | 450 |
| 451 InitializePreferenceObserver(); | 451 InitializePreferenceObserver(); |
| 452 } | 452 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 474 } | 474 } |
| 475 | 475 |
| 476 GDataFileSystem::~GDataFileSystem() { | 476 GDataFileSystem::~GDataFileSystem() { |
| 477 // This should be called from UI thread, from GDataSystemService shutdown. | 477 // This should be called from UI thread, from GDataSystemService shutdown. |
| 478 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 478 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 479 | 479 |
| 480 feed_loader_->RemoveObserver(this); | 480 feed_loader_->RemoveObserver(this); |
| 481 | 481 |
| 482 // Cancel all the in-flight operations. | 482 // Cancel all the in-flight operations. |
| 483 // This asynchronously cancels the URL fetch operations. | 483 // This asynchronously cancels the URL fetch operations. |
| 484 documents_service_->CancelAll(); | 484 drive_service_->CancelAll(); |
| 485 } | 485 } |
| 486 | 486 |
| 487 void GDataFileSystem::AddObserver( | 487 void GDataFileSystem::AddObserver( |
| 488 GDataFileSystemInterface::Observer* observer) { | 488 GDataFileSystemInterface::Observer* observer) { |
| 489 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 489 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 490 observers_.AddObserver(observer); | 490 observers_.AddObserver(observer); |
| 491 } | 491 } |
| 492 | 492 |
| 493 void GDataFileSystem::RemoveObserver( | 493 void GDataFileSystem::RemoveObserver( |
| 494 GDataFileSystemInterface::Observer* observer) { | 494 GDataFileSystemInterface::Observer* observer) { |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 940 } | 940 } |
| 941 | 941 |
| 942 void GDataFileSystem::CopyDocumentToDirectory( | 942 void GDataFileSystem::CopyDocumentToDirectory( |
| 943 const FilePath& dir_path, | 943 const FilePath& dir_path, |
| 944 const std::string& resource_id, | 944 const std::string& resource_id, |
| 945 const FilePath::StringType& new_name, | 945 const FilePath::StringType& new_name, |
| 946 const FileOperationCallback& callback) { | 946 const FileOperationCallback& callback) { |
| 947 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 947 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 948 DCHECK(!callback.is_null()); | 948 DCHECK(!callback.is_null()); |
| 949 | 949 |
| 950 documents_service_->CopyDocument(resource_id, new_name, | 950 drive_service_->CopyDocument(resource_id, new_name, |
| 951 base::Bind(&GDataFileSystem::OnCopyDocumentCompleted, | 951 base::Bind(&GDataFileSystem::OnCopyDocumentCompleted, |
| 952 ui_weak_ptr_, | 952 ui_weak_ptr_, |
| 953 dir_path, | 953 dir_path, |
| 954 callback)); | 954 callback)); |
| 955 } | 955 } |
| 956 | 956 |
| 957 void GDataFileSystem::Rename(const FilePath& file_path, | 957 void GDataFileSystem::Rename(const FilePath& file_path, |
| 958 const FilePath::StringType& new_name, | 958 const FilePath::StringType& new_name, |
| 959 const FileMoveCallback& callback) { | 959 const FileMoveCallback& callback) { |
| 960 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 960 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 998 FilePath::StringType file_name = new_name; | 998 FilePath::StringType file_name = new_name; |
| 999 if (entry_proto->has_file_specific_info() && | 999 if (entry_proto->has_file_specific_info() && |
| 1000 entry_proto->file_specific_info().is_hosted_document()) { | 1000 entry_proto->file_specific_info().is_hosted_document()) { |
| 1001 FilePath new_file(file_name); | 1001 FilePath new_file(file_name); |
| 1002 if (new_file.Extension() == | 1002 if (new_file.Extension() == |
| 1003 entry_proto->file_specific_info().document_extension()) { | 1003 entry_proto->file_specific_info().document_extension()) { |
| 1004 file_name = new_file.RemoveExtension().value(); | 1004 file_name = new_file.RemoveExtension().value(); |
| 1005 } | 1005 } |
| 1006 } | 1006 } |
| 1007 | 1007 |
| 1008 documents_service_->RenameResource( | 1008 drive_service_->RenameResource( |
| 1009 GURL(entry_proto->edit_url()), | 1009 GURL(entry_proto->edit_url()), |
| 1010 file_name, | 1010 file_name, |
| 1011 base::Bind(&GDataFileSystem::RenameEntryLocally, | 1011 base::Bind(&GDataFileSystem::RenameEntryLocally, |
| 1012 ui_weak_ptr_, | 1012 ui_weak_ptr_, |
| 1013 file_path, | 1013 file_path, |
| 1014 file_name, | 1014 file_name, |
| 1015 callback)); | 1015 callback)); |
| 1016 } | 1016 } |
| 1017 | 1017 |
| 1018 void GDataFileSystem::Move(const FilePath& src_file_path, | 1018 void GDataFileSystem::Move(const FilePath& src_file_path, |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1146 scoped_ptr<GDataEntryProto> src_proto = result->first.proto.Pass(); | 1146 scoped_ptr<GDataEntryProto> src_proto = result->first.proto.Pass(); |
| 1147 scoped_ptr<GDataEntryProto> dir_proto = result->second.proto.Pass(); | 1147 scoped_ptr<GDataEntryProto> dir_proto = result->second.proto.Pass(); |
| 1148 | 1148 |
| 1149 if (!dir_proto->file_info().is_directory()) { | 1149 if (!dir_proto->file_info().is_directory()) { |
| 1150 callback.Run(GDATA_FILE_ERROR_NOT_A_DIRECTORY); | 1150 callback.Run(GDATA_FILE_ERROR_NOT_A_DIRECTORY); |
| 1151 return; | 1151 return; |
| 1152 } | 1152 } |
| 1153 | 1153 |
| 1154 const FilePath& file_path = result->first.path; | 1154 const FilePath& file_path = result->first.path; |
| 1155 const FilePath& dir_path = result->second.path; | 1155 const FilePath& dir_path = result->second.path; |
| 1156 documents_service_->AddResourceToDirectory( | 1156 drive_service_->AddResourceToDirectory( |
| 1157 GURL(dir_proto->content_url()), | 1157 GURL(dir_proto->content_url()), |
| 1158 GURL(src_proto->edit_url()), | 1158 GURL(src_proto->edit_url()), |
| 1159 base::Bind(&GDataFileSystem::OnMoveEntryFromRootDirectoryCompleted, | 1159 base::Bind(&GDataFileSystem::OnMoveEntryFromRootDirectoryCompleted, |
| 1160 ui_weak_ptr_, | 1160 ui_weak_ptr_, |
| 1161 callback, | 1161 callback, |
| 1162 file_path, | 1162 file_path, |
| 1163 dir_path)); | 1163 dir_path)); |
| 1164 } | 1164 } |
| 1165 | 1165 |
| 1166 void GDataFileSystem::RemoveEntryFromNonRootDirectory( | 1166 void GDataFileSystem::RemoveEntryFromNonRootDirectory( |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1204 } | 1204 } |
| 1205 | 1205 |
| 1206 scoped_ptr<GDataEntryProto> entry_proto = result->first.proto.Pass(); | 1206 scoped_ptr<GDataEntryProto> entry_proto = result->first.proto.Pass(); |
| 1207 scoped_ptr<GDataEntryProto> dir_proto = result->second.proto.Pass(); | 1207 scoped_ptr<GDataEntryProto> dir_proto = result->second.proto.Pass(); |
| 1208 | 1208 |
| 1209 if (!dir_proto->file_info().is_directory()) { | 1209 if (!dir_proto->file_info().is_directory()) { |
| 1210 callback.Run(GDATA_FILE_ERROR_NOT_A_DIRECTORY, file_path); | 1210 callback.Run(GDATA_FILE_ERROR_NOT_A_DIRECTORY, file_path); |
| 1211 return; | 1211 return; |
| 1212 } | 1212 } |
| 1213 | 1213 |
| 1214 documents_service_->RemoveResourceFromDirectory( | 1214 drive_service_->RemoveResourceFromDirectory( |
| 1215 GURL(dir_proto->content_url()), | 1215 GURL(dir_proto->content_url()), |
| 1216 GURL(entry_proto->edit_url()), | 1216 GURL(entry_proto->edit_url()), |
| 1217 entry_proto->resource_id(), | 1217 entry_proto->resource_id(), |
| 1218 base::Bind(&GDataFileSystem::MoveEntryToRootDirectoryLocally, | 1218 base::Bind(&GDataFileSystem::MoveEntryToRootDirectoryLocally, |
| 1219 ui_weak_ptr_, | 1219 ui_weak_ptr_, |
| 1220 callback, | 1220 callback, |
| 1221 file_path, | 1221 file_path, |
| 1222 dir_path)); | 1222 dir_path)); |
| 1223 } | 1223 } |
| 1224 | 1224 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1261 | 1261 |
| 1262 if (error != GDATA_FILE_OK) { | 1262 if (error != GDATA_FILE_OK) { |
| 1263 if (!callback.is_null()) { | 1263 if (!callback.is_null()) { |
| 1264 base::MessageLoopProxy::current()->PostTask( | 1264 base::MessageLoopProxy::current()->PostTask( |
| 1265 FROM_HERE, base::Bind(callback, error)); | 1265 FROM_HERE, base::Bind(callback, error)); |
| 1266 } | 1266 } |
| 1267 return; | 1267 return; |
| 1268 } | 1268 } |
| 1269 | 1269 |
| 1270 DCHECK(entry_proto.get()); | 1270 DCHECK(entry_proto.get()); |
| 1271 documents_service_->DeleteDocument( | 1271 drive_service_->DeleteDocument( |
| 1272 GURL(entry_proto->edit_url()), | 1272 GURL(entry_proto->edit_url()), |
| 1273 base::Bind(&GDataFileSystem::OnRemovedDocument, | 1273 base::Bind(&GDataFileSystem::OnRemovedDocument, |
| 1274 ui_weak_ptr_, | 1274 ui_weak_ptr_, |
| 1275 callback, | 1275 callback, |
| 1276 file_path)); | 1276 file_path)); |
| 1277 } | 1277 } |
| 1278 | 1278 |
| 1279 void GDataFileSystem::CreateDirectory( | 1279 void GDataFileSystem::CreateDirectory( |
| 1280 const FilePath& directory_path, | 1280 const FilePath& directory_path, |
| 1281 bool is_exclusive, | 1281 bool is_exclusive, |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1338 // Do we have a parent directory here as well? We can't then create target | 1338 // Do we have a parent directory here as well? We can't then create target |
| 1339 // directory if this is not a recursive operation. | 1339 // directory if this is not a recursive operation. |
| 1340 if (directory_path != first_missing_path && !is_recursive) { | 1340 if (directory_path != first_missing_path && !is_recursive) { |
| 1341 if (!callback.is_null()) { | 1341 if (!callback.is_null()) { |
| 1342 MessageLoop::current()->PostTask(FROM_HERE, | 1342 MessageLoop::current()->PostTask(FROM_HERE, |
| 1343 base::Bind(callback, GDATA_FILE_ERROR_NOT_FOUND)); | 1343 base::Bind(callback, GDATA_FILE_ERROR_NOT_FOUND)); |
| 1344 } | 1344 } |
| 1345 return; | 1345 return; |
| 1346 } | 1346 } |
| 1347 | 1347 |
| 1348 documents_service_->CreateDirectory( | 1348 drive_service_->CreateDirectory( |
| 1349 last_parent_dir_url, | 1349 last_parent_dir_url, |
| 1350 first_missing_path.BaseName().value(), | 1350 first_missing_path.BaseName().value(), |
| 1351 base::Bind(&GDataFileSystem::OnCreateDirectoryCompleted, | 1351 base::Bind(&GDataFileSystem::OnCreateDirectoryCompleted, |
| 1352 ui_weak_ptr_, | 1352 ui_weak_ptr_, |
| 1353 CreateDirectoryParams( | 1353 CreateDirectoryParams( |
| 1354 first_missing_path, | 1354 first_missing_path, |
| 1355 directory_path, | 1355 directory_path, |
| 1356 is_exclusive, | 1356 is_exclusive, |
| 1357 is_recursive, | 1357 is_recursive, |
| 1358 callback))); | 1358 callback))); |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1633 // instead. This logic is rather complicated but here's how this works: | 1633 // instead. This logic is rather complicated but here's how this works: |
| 1634 // | 1634 // |
| 1635 // Retrieve fresh file metadata from server. We will extract file size and | 1635 // Retrieve fresh file metadata from server. We will extract file size and |
| 1636 // content url from there (we want to make sure used content url is not | 1636 // content url from there (we want to make sure used content url is not |
| 1637 // stale). | 1637 // stale). |
| 1638 // | 1638 // |
| 1639 // Check if we have enough space, based on the expected file size. | 1639 // Check if we have enough space, based on the expected file size. |
| 1640 // - if we don't have enough space, try to free up the disk space | 1640 // - if we don't have enough space, try to free up the disk space |
| 1641 // - if we still don't have enough space, return "no space" error | 1641 // - if we still don't have enough space, return "no space" error |
| 1642 // - if we have enough space, start downloading the file from the server | 1642 // - if we have enough space, start downloading the file from the server |
| 1643 documents_service_->GetDocumentEntry( | 1643 drive_service_->GetDocumentEntry( |
| 1644 resource_id, | 1644 resource_id, |
| 1645 base::Bind(&GDataFileSystem::OnGetDocumentEntry, | 1645 base::Bind(&GDataFileSystem::OnGetDocumentEntry, |
| 1646 ui_weak_ptr_, | 1646 ui_weak_ptr_, |
| 1647 cache_file_path, | 1647 cache_file_path, |
| 1648 GetFileFromCacheParams(params.virtual_file_path, | 1648 GetFileFromCacheParams(params.virtual_file_path, |
| 1649 params.local_tmp_path, | 1649 params.local_tmp_path, |
| 1650 params.content_url, | 1650 params.content_url, |
| 1651 params.resource_id, | 1651 params.resource_id, |
| 1652 params.md5, | 1652 params.md5, |
| 1653 params.mime_type, | 1653 params.mime_type, |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1720 if (!params.get_file_callback.is_null()) { | 1720 if (!params.get_file_callback.is_null()) { |
| 1721 params.get_file_callback.Run(GDATA_FILE_ERROR_NO_SPACE, | 1721 params.get_file_callback.Run(GDATA_FILE_ERROR_NO_SPACE, |
| 1722 cache_file_path, | 1722 cache_file_path, |
| 1723 params.mime_type, | 1723 params.mime_type, |
| 1724 REGULAR_FILE); | 1724 REGULAR_FILE); |
| 1725 } | 1725 } |
| 1726 return; | 1726 return; |
| 1727 } | 1727 } |
| 1728 | 1728 |
| 1729 // We have enough disk space. Start downloading the file. | 1729 // We have enough disk space. Start downloading the file. |
| 1730 documents_service_->DownloadFile( | 1730 drive_service_->DownloadFile( |
| 1731 params.virtual_file_path, | 1731 params.virtual_file_path, |
| 1732 params.local_tmp_path, | 1732 params.local_tmp_path, |
| 1733 content_url, | 1733 content_url, |
| 1734 base::Bind(&GDataFileSystem::OnFileDownloaded, | 1734 base::Bind(&GDataFileSystem::OnFileDownloaded, |
| 1735 ui_weak_ptr_, | 1735 ui_weak_ptr_, |
| 1736 params), | 1736 params), |
| 1737 params.get_content_callback); | 1737 params.get_content_callback); |
| 1738 } | 1738 } |
| 1739 | 1739 |
| 1740 void GDataFileSystem::GetEntryInfoByPath(const FilePath& file_path, | 1740 void GDataFileSystem::GetEntryInfoByPath(const FilePath& file_path, |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2099 RunTaskOnUIThread(base::Bind(&GDataFileSystem::GetAvailableSpaceOnUIThread, | 2099 RunTaskOnUIThread(base::Bind(&GDataFileSystem::GetAvailableSpaceOnUIThread, |
| 2100 ui_weak_ptr_, | 2100 ui_weak_ptr_, |
| 2101 CreateRelayCallback(callback))); | 2101 CreateRelayCallback(callback))); |
| 2102 } | 2102 } |
| 2103 | 2103 |
| 2104 void GDataFileSystem::GetAvailableSpaceOnUIThread( | 2104 void GDataFileSystem::GetAvailableSpaceOnUIThread( |
| 2105 const GetAvailableSpaceCallback& callback) { | 2105 const GetAvailableSpaceCallback& callback) { |
| 2106 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 2106 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 2107 DCHECK(!callback.is_null()); | 2107 DCHECK(!callback.is_null()); |
| 2108 | 2108 |
| 2109 documents_service_->GetAccountMetadata( | 2109 drive_service_->GetAccountMetadata( |
| 2110 gdata::util::IsDriveV2ApiEnabled() ? | 2110 gdata::util::IsDriveV2ApiEnabled() ? |
| 2111 base::Bind(&GDataFileSystem::OnGetAboutResource, | 2111 base::Bind(&GDataFileSystem::OnGetAboutResource, |
| 2112 ui_weak_ptr_, | 2112 ui_weak_ptr_, |
| 2113 callback) : | 2113 callback) : |
| 2114 base::Bind(&GDataFileSystem::OnGetAvailableSpace, | 2114 base::Bind(&GDataFileSystem::OnGetAvailableSpace, |
| 2115 ui_weak_ptr_, | 2115 ui_weak_ptr_, |
| 2116 callback)); | 2116 callback)); |
| 2117 } | 2117 } |
| 2118 | 2118 |
| 2119 void GDataFileSystem::OnGetAvailableSpace( | 2119 void GDataFileSystem::OnGetAvailableSpace( |
| (...skipping 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3303 return; | 3303 return; |
| 3304 } | 3304 } |
| 3305 | 3305 |
| 3306 PlatformFileInfoProto entry_file_info; | 3306 PlatformFileInfoProto entry_file_info; |
| 3307 GDataEntry::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info); | 3307 GDataEntry::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info); |
| 3308 *entry_proto->mutable_file_info() = entry_file_info; | 3308 *entry_proto->mutable_file_info() = entry_file_info; |
| 3309 callback.Run(GDATA_FILE_OK, entry_proto.Pass()); | 3309 callback.Run(GDATA_FILE_OK, entry_proto.Pass()); |
| 3310 } | 3310 } |
| 3311 | 3311 |
| 3312 } // namespace gdata | 3312 } // namespace gdata |
| OLD | NEW |