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/sync_file_system/drive_file_sync_client.h" | 5 #include "chrome/browser/sync_file_system/drive_file_sync_client.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 #include <sstream> | 9 #include <sstream> |
10 #include <string> | 10 #include <string> |
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
830 return; | 830 return; |
831 } | 831 } |
832 | 832 |
833 DVLOG(2) << "no conflict detected"; | 833 DVLOG(2) << "no conflict detected"; |
834 DCHECK_EQ(1u, entries.size()); | 834 DCHECK_EQ(1u, entries.size()); |
835 scoped_ptr<google_apis::ResourceEntry> entry(entries.front()); | 835 scoped_ptr<google_apis::ResourceEntry> entry(entries.front()); |
836 entries.weak_clear(); | 836 entries.weak_clear(); |
837 callback.Run(google_apis::HTTP_FOUND, entry.Pass()); | 837 callback.Run(google_apis::HTTP_FOUND, entry.Pass()); |
838 } | 838 } |
839 | 839 |
840 void DriveFileSyncClient::DeleteEntries( | 840 void DriveFileSyncClient::DeleteEntries( |
kinuko
2013/02/12 07:57:30
This method name might be misnomer?
DeleteDuplicat
tzik
2013/02/12 11:48:18
Done.
| |
841 ScopedVector<google_apis::ResourceEntry> entries, | 841 ScopedVector<google_apis::ResourceEntry> entries, |
842 const GDataErrorCallback& callback) { | 842 const GDataErrorCallback& callback) { |
843 DCHECK(CalledOnValidThread()); | 843 DCHECK(CalledOnValidThread()); |
844 DVLOG(2) << "Cleaning up conflict on entry creation"; | 844 DVLOG(2) << "Cleaning up conflict on entry creation"; |
845 | 845 |
846 if (entries.empty()) { | 846 if (entries.empty()) { |
847 callback.Run(google_apis::HTTP_SUCCESS); | 847 callback.Run(google_apis::HTTP_SUCCESS); |
848 return; | 848 return; |
849 } | 849 } |
850 | 850 |
851 scoped_ptr<google_apis::ResourceEntry> entry(entries.back()); | 851 scoped_ptr<google_apis::ResourceEntry> entry(entries.back()); |
852 entries.back() = NULL; | 852 entries.back() = NULL; |
853 entries.get().pop_back(); | 853 entries.get().pop_back(); |
854 | 854 |
855 drive_service_->DeleteResource( | 855 drive_service_->DeleteResource( |
856 entry->resource_id(), | 856 entry->resource_id(), |
857 entry->etag(), | 857 std::string(), // etag |
kinuko
2013/02/12 07:57:30
Can we elaborate this comment? Like:
// We don't
tzik
2013/02/12 11:48:18
Done.
| |
858 base::Bind(&DriveFileSyncClient::DidDeleteEntry, AsWeakPtr(), | 858 base::Bind(&DriveFileSyncClient::DidDeleteEntry, AsWeakPtr(), |
859 base::Passed(&entries), callback)); | 859 base::Passed(&entries), callback)); |
860 } | 860 } |
861 | 861 |
862 void DriveFileSyncClient::DidDeleteEntry( | 862 void DriveFileSyncClient::DidDeleteEntry( |
863 ScopedVector<google_apis::ResourceEntry> entries, | 863 ScopedVector<google_apis::ResourceEntry> entries, |
864 const GDataErrorCallback& callback, | 864 const GDataErrorCallback& callback, |
865 google_apis::GDataErrorCode error) { | 865 google_apis::GDataErrorCode error) { |
866 DCHECK(CalledOnValidThread()); | 866 DCHECK(CalledOnValidThread()); |
867 | 867 |
868 if (error != google_apis::HTTP_SUCCESS && | 868 if (error != google_apis::HTTP_SUCCESS && |
869 error != google_apis::HTTP_NOT_FOUND) { | 869 error != google_apis::HTTP_NOT_FOUND) { |
870 DVLOG(2) << "Error on deleting file: " << error; | 870 DVLOG(2) << "Error on deleting file: " << error; |
871 callback.Run(error); | 871 callback.Run(error); |
872 return; | 872 return; |
873 } | 873 } |
874 | 874 |
875 DVLOG(2) << "Deletion completed"; | 875 DVLOG(2) << "Deletion completed"; |
876 DeleteEntries(entries.Pass(), callback); | 876 DeleteEntries(entries.Pass(), callback); |
877 } | 877 } |
878 | 878 |
879 } // namespace sync_file_system | 879 } // namespace sync_file_system |
OLD | NEW |