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

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

Issue 881403003: Rename gdata_errorcode.h to drive_api_error_codes.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typos in BUILD.gn Created 5 years, 10 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
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/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "chrome/browser/chromeos/drive/change_list_loader.h" 10 #include "chrome/browser/chromeos/drive/change_list_loader.h"
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 filtered->push_back(entries->at(i)); 225 filtered->push_back(entries->at(i));
226 } 226 }
227 entries.swap(filtered); 227 entries.swap(filtered);
228 } 228 }
229 callback.Run(entries.Pass()); 229 callback.Run(entries.Pass());
230 } 230 }
231 231
232 // Adapter for using FileOperationCallback as google_apis::EntryActionCallback. 232 // Adapter for using FileOperationCallback as google_apis::EntryActionCallback.
233 void RunFileOperationCallbackAsEntryActionCallback( 233 void RunFileOperationCallbackAsEntryActionCallback(
234 const FileOperationCallback& callback, 234 const FileOperationCallback& callback,
235 google_apis::GDataErrorCode error) { 235 google_apis::DriveApiErrorCode error) {
236 callback.Run(GDataToFileError(error)); 236 callback.Run(GDataToFileError(error));
237 } 237 }
238 238
239 // Checks if the |entry|'s hash is included in |hashes|. 239 // Checks if the |entry|'s hash is included in |hashes|.
240 bool CheckHashes(const std::set<std::string>& hashes, 240 bool CheckHashes(const std::set<std::string>& hashes,
241 const ResourceEntry& entry) { 241 const ResourceEntry& entry) {
242 return hashes.find(entry.file_specific_info().md5()) != hashes.end(); 242 return hashes.find(entry.file_specific_info().md5()) != hashes.end();
243 } 243 }
244 244
245 // Runs |callback| with |error| and the list of HashAndFilePath obtained from 245 // Runs |callback| with |error| and the list of HashAndFilePath obtained from
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 DCHECK(!callback.is_null()); 685 DCHECK(!callback.is_null());
686 686
687 about_resource_loader_->GetAboutResource( 687 about_resource_loader_->GetAboutResource(
688 base::Bind(&FileSystem::OnGetAboutResource, 688 base::Bind(&FileSystem::OnGetAboutResource,
689 weak_ptr_factory_.GetWeakPtr(), 689 weak_ptr_factory_.GetWeakPtr(),
690 callback)); 690 callback));
691 } 691 }
692 692
693 void FileSystem::OnGetAboutResource( 693 void FileSystem::OnGetAboutResource(
694 const GetAvailableSpaceCallback& callback, 694 const GetAvailableSpaceCallback& callback,
695 google_apis::GDataErrorCode status, 695 google_apis::DriveApiErrorCode status,
696 scoped_ptr<google_apis::AboutResource> about_resource) { 696 scoped_ptr<google_apis::AboutResource> about_resource) {
697 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 697 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
698 DCHECK(!callback.is_null()); 698 DCHECK(!callback.is_null());
699 699
700 FileError error = GDataToFileError(status); 700 FileError error = GDataToFileError(status);
701 if (error != FILE_ERROR_OK) { 701 if (error != FILE_ERROR_OK) {
702 callback.Run(error, -1, -1); 702 callback.Run(error, -1, -1);
703 return; 703 return;
704 } 704 }
705 DCHECK(about_resource); 705 DCHECK(about_resource);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 entry->resource_id(), 755 entry->resource_id(),
756 embed_origin, 756 embed_origin,
757 ClientContext(USER_INITIATED), 757 ClientContext(USER_INITIATED),
758 base::Bind(&FileSystem::OnGetResourceEntryForGetShareUrl, 758 base::Bind(&FileSystem::OnGetResourceEntryForGetShareUrl,
759 weak_ptr_factory_.GetWeakPtr(), 759 weak_ptr_factory_.GetWeakPtr(),
760 callback)); 760 callback));
761 } 761 }
762 762
763 void FileSystem::OnGetResourceEntryForGetShareUrl( 763 void FileSystem::OnGetResourceEntryForGetShareUrl(
764 const GetShareUrlCallback& callback, 764 const GetShareUrlCallback& callback,
765 google_apis::GDataErrorCode status, 765 google_apis::DriveApiErrorCode status,
766 const GURL& share_url) { 766 const GURL& share_url) {
767 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 767 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
768 DCHECK(!callback.is_null()); 768 DCHECK(!callback.is_null());
769 769
770 FileError error = GDataToFileError(status); 770 FileError error = GDataToFileError(status);
771 if (error != FILE_ERROR_OK) { 771 if (error != FILE_ERROR_OK) {
772 callback.Run(error, GURL()); 772 callback.Run(error, GURL());
773 return; 773 return;
774 } 774 }
775 775
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
1018 FROM_HERE, 1018 FROM_HERE,
1019 base::Bind(&GetPathFromResourceIdOnBlockingPool, 1019 base::Bind(&GetPathFromResourceIdOnBlockingPool,
1020 resource_metadata_, 1020 resource_metadata_,
1021 resource_id, 1021 resource_id,
1022 file_path), 1022 file_path),
1023 base::Bind(&GetPathFromResourceIdAfterGetPath, 1023 base::Bind(&GetPathFromResourceIdAfterGetPath,
1024 base::Owned(file_path), 1024 base::Owned(file_path),
1025 callback)); 1025 callback));
1026 } 1026 }
1027 } // namespace drive 1027 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698