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

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

Issue 15650008: drive: Rename drive::DriveClientContext to drive::ClientContext (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 6 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/file_system.h" 5 #include "chrome/browser/chromeos/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/message_loop_proxy.h" 9 #include "base/message_loop/message_loop_proxy.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 entry->file_specific_info().file_md5(), callback); 376 entry->file_specific_info().file_md5(), callback);
377 } 377 }
378 378
379 void FileSystem::GetFileByPath(const base::FilePath& file_path, 379 void FileSystem::GetFileByPath(const base::FilePath& file_path,
380 const GetFileCallback& callback) { 380 const GetFileCallback& callback) {
381 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 381 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
382 DCHECK(!callback.is_null()); 382 DCHECK(!callback.is_null());
383 383
384 operations_.EnsureFileDownloaded( 384 operations_.EnsureFileDownloaded(
385 file_path, 385 file_path,
386 DriveClientContext(USER_INITIATED), 386 ClientContext(USER_INITIATED),
387 GetFileContentInitializedCallback(), 387 GetFileContentInitializedCallback(),
388 google_apis::GetContentCallback(), 388 google_apis::GetContentCallback(),
389 callback); 389 callback);
390 } 390 }
391 391
392 void FileSystem::GetFileByResourceId( 392 void FileSystem::GetFileByResourceId(
393 const std::string& resource_id, 393 const std::string& resource_id,
394 const DriveClientContext& context, 394 const ClientContext& context,
395 const GetFileCallback& get_file_callback, 395 const GetFileCallback& get_file_callback,
396 const google_apis::GetContentCallback& get_content_callback) { 396 const google_apis::GetContentCallback& get_content_callback) {
397 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 397 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
398 DCHECK(!resource_id.empty()); 398 DCHECK(!resource_id.empty());
399 DCHECK(!get_file_callback.is_null()); 399 DCHECK(!get_file_callback.is_null());
400 400
401 resource_metadata_->GetResourceEntryByIdOnUIThread( 401 resource_metadata_->GetResourceEntryByIdOnUIThread(
402 resource_id, 402 resource_id,
403 base::Bind(&FileSystem::GetFileByResourceIdAfterGetEntry, 403 base::Bind(&FileSystem::GetFileByResourceIdAfterGetEntry,
404 weak_ptr_factory_.GetWeakPtr(), 404 weak_ptr_factory_.GetWeakPtr(),
405 context, 405 context,
406 get_file_callback, 406 get_file_callback,
407 get_content_callback)); 407 get_content_callback));
408 } 408 }
409 409
410 void FileSystem::GetFileByResourceIdAfterGetEntry( 410 void FileSystem::GetFileByResourceIdAfterGetEntry(
411 const DriveClientContext& context, 411 const ClientContext& context,
412 const GetFileCallback& get_file_callback, 412 const GetFileCallback& get_file_callback,
413 const google_apis::GetContentCallback& get_content_callback, 413 const google_apis::GetContentCallback& get_content_callback,
414 FileError error, 414 FileError error,
415 const base::FilePath& file_path, 415 const base::FilePath& file_path,
416 scoped_ptr<ResourceEntry> entry) { 416 scoped_ptr<ResourceEntry> entry) {
417 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 417 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
418 DCHECK(!get_file_callback.is_null()); 418 DCHECK(!get_file_callback.is_null());
419 419
420 if (error != FILE_ERROR_OK) { 420 if (error != FILE_ERROR_OK) {
421 get_file_callback.Run(FILE_ERROR_NOT_FOUND, base::FilePath(), 421 get_file_callback.Run(FILE_ERROR_NOT_FOUND, base::FilePath(),
(...skipping 14 matching lines...) Expand all
436 const GetFileContentInitializedCallback& initialized_callback, 436 const GetFileContentInitializedCallback& initialized_callback,
437 const google_apis::GetContentCallback& get_content_callback, 437 const google_apis::GetContentCallback& get_content_callback,
438 const FileOperationCallback& completion_callback) { 438 const FileOperationCallback& completion_callback) {
439 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 439 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
440 DCHECK(!initialized_callback.is_null()); 440 DCHECK(!initialized_callback.is_null());
441 DCHECK(!get_content_callback.is_null()); 441 DCHECK(!get_content_callback.is_null());
442 DCHECK(!completion_callback.is_null()); 442 DCHECK(!completion_callback.is_null());
443 443
444 operations_.EnsureFileDownloaded( 444 operations_.EnsureFileDownloaded(
445 file_path, 445 file_path,
446 DriveClientContext(USER_INITIATED), 446 ClientContext(USER_INITIATED),
447 initialized_callback, 447 initialized_callback,
448 get_content_callback, 448 get_content_callback,
449 base::Bind(&GetFileCallbackToFileOperationCallbackAdapter, 449 base::Bind(&GetFileCallbackToFileOperationCallbackAdapter,
450 completion_callback)); 450 completion_callback));
451 } 451 }
452 452
453 void FileSystem::GetResourceEntryByPath( 453 void FileSystem::GetResourceEntryByPath(
454 const base::FilePath& file_path, 454 const base::FilePath& file_path,
455 const GetResourceEntryCallback& callback) { 455 const GetResourceEntryCallback& callback) {
456 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 456 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 return; 663 return;
664 } 664 }
665 665
666 change_list_loader_->LoadDirectoryFromServer( 666 change_list_loader_->LoadDirectoryFromServer(
667 entry->resource_id(), 667 entry->resource_id(),
668 callback); 668 callback);
669 } 669 }
670 670
671 void FileSystem::UpdateFileByResourceId( 671 void FileSystem::UpdateFileByResourceId(
672 const std::string& resource_id, 672 const std::string& resource_id,
673 const DriveClientContext& context, 673 const ClientContext& context,
674 const FileOperationCallback& callback) { 674 const FileOperationCallback& callback) {
675 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 675 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
676 DCHECK(!callback.is_null()); 676 DCHECK(!callback.is_null());
677 677
678 operations_.UpdateFileByResourceId(resource_id, context, callback); 678 operations_.UpdateFileByResourceId(resource_id, context, callback);
679 } 679 }
680 680
681 void FileSystem::GetAvailableSpace( 681 void FileSystem::GetAvailableSpace(
682 const GetAvailableSpaceCallback& callback) { 682 const GetAvailableSpaceCallback& callback) {
683 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 683 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 if (open_files_.find(file_path) != open_files_.end()) { 883 if (open_files_.find(file_path) != open_files_.end()) {
884 base::MessageLoopProxy::current()->PostTask( 884 base::MessageLoopProxy::current()->PostTask(
885 FROM_HERE, 885 FROM_HERE,
886 base::Bind(callback, FILE_ERROR_IN_USE, base::FilePath())); 886 base::Bind(callback, FILE_ERROR_IN_USE, base::FilePath()));
887 return; 887 return;
888 } 888 }
889 open_files_.insert(file_path); 889 open_files_.insert(file_path);
890 890
891 operations_.EnsureFileDownloaded( 891 operations_.EnsureFileDownloaded(
892 file_path, 892 file_path,
893 DriveClientContext(USER_INITIATED), 893 ClientContext(USER_INITIATED),
894 GetFileContentInitializedCallback(), 894 GetFileContentInitializedCallback(),
895 google_apis::GetContentCallback(), 895 google_apis::GetContentCallback(),
896 base::Bind(&FileSystem::OpenFileAfterFileDownloaded, 896 base::Bind(&FileSystem::OpenFileAfterFileDownloaded,
897 weak_ptr_factory_.GetWeakPtr(), 897 weak_ptr_factory_.GetWeakPtr(),
898 file_path, 898 file_path,
899 base::Bind(&FileSystem::OnOpenFileFinished, 899 base::Bind(&FileSystem::OnOpenFileFinished,
900 weak_ptr_factory_.GetWeakPtr(), 900 weak_ptr_factory_.GetWeakPtr(),
901 file_path, 901 file_path,
902 callback))); 902 callback)));
903 } 903 }
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1132 return; 1132 return;
1133 } 1133 }
1134 1134
1135 PlatformFileInfoProto entry_file_info; 1135 PlatformFileInfoProto entry_file_info;
1136 util::ConvertPlatformFileInfoToResourceEntry(*file_info, &entry_file_info); 1136 util::ConvertPlatformFileInfoToResourceEntry(*file_info, &entry_file_info);
1137 *entry->mutable_file_info() = entry_file_info; 1137 *entry->mutable_file_info() = entry_file_info;
1138 callback.Run(FILE_ERROR_OK, entry.Pass()); 1138 callback.Run(FILE_ERROR_OK, entry.Pass());
1139 } 1139 }
1140 1140
1141 } // namespace drive 1141 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/file_system.h ('k') | chrome/browser/chromeos/drive/file_system/create_file_operation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698