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

Side by Side Diff: chrome/browser/sync_file_system/drive_backend/drive_backend_util.cc

Issue 216433002: drive: Make FileResource copyable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_backend/drive_backend_util.h" 5 #include "chrome/browser/sync_file_system/drive_backend/drive_backend_util.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_vector.h" 9 #include "base/memory/scoped_vector.h"
10 #include "base/message_loop/message_loop_proxy.h" 10 #include "base/message_loop/message_loop_proxy.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 void PutFileTrackerDeletionToBatch(int64 tracker_id, 61 void PutFileTrackerDeletionToBatch(int64 tracker_id,
62 leveldb::WriteBatch* batch) { 62 leveldb::WriteBatch* batch) {
63 if (batch) 63 if (batch)
64 batch->Delete(kFileTrackerKeyPrefix + base::Int64ToString(tracker_id)); 64 batch->Delete(kFileTrackerKeyPrefix + base::Int64ToString(tracker_id));
65 } 65 }
66 66
67 void PopulateFileDetailsByFileResource( 67 void PopulateFileDetailsByFileResource(
68 const google_apis::FileResource& file_resource, 68 const google_apis::FileResource& file_resource,
69 FileDetails* details) { 69 FileDetails* details) {
70 details->clear_parent_folder_ids(); 70 details->clear_parent_folder_ids();
71 for (ScopedVector<google_apis::ParentReference>::const_iterator itr = 71 for (std::vector<google_apis::ParentReference>::const_iterator itr =
72 file_resource.parents().begin(); 72 file_resource.parents().begin();
73 itr != file_resource.parents().end(); 73 itr != file_resource.parents().end();
74 ++itr) { 74 ++itr) {
75 details->add_parent_folder_ids((*itr)->file_id()); 75 details->add_parent_folder_ids(itr->file_id());
76 } 76 }
77 details->set_title(file_resource.title()); 77 details->set_title(file_resource.title());
78 78
79 google_apis::DriveEntryKind kind = drive::util::GetKind(file_resource); 79 google_apis::DriveEntryKind kind = drive::util::GetKind(file_resource);
80 if (kind == google_apis::ENTRY_KIND_FILE) 80 if (kind == google_apis::ENTRY_KIND_FILE)
81 details->set_file_kind(FILE_KIND_FILE); 81 details->set_file_kind(FILE_KIND_FILE);
82 else if (kind == google_apis::ENTRY_KIND_FOLDER) 82 else if (kind == google_apis::ENTRY_KIND_FOLDER)
83 details->set_file_kind(FILE_KIND_FOLDER); 83 details->set_file_kind(FILE_KIND_FOLDER);
84 else 84 else
85 details->set_file_kind(FILE_KIND_UNSUPPORTED); 85 details->set_file_kind(FILE_KIND_UNSUPPORTED);
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 } 267 }
268 268
269 scoped_ptr<FileTracker> CloneFileTracker(const FileTracker* obj) { 269 scoped_ptr<FileTracker> CloneFileTracker(const FileTracker* obj) {
270 if (!obj) 270 if (!obj)
271 return scoped_ptr<FileTracker>(); 271 return scoped_ptr<FileTracker>();
272 return scoped_ptr<FileTracker>(new FileTracker(*obj)); 272 return scoped_ptr<FileTracker>(new FileTracker(*obj));
273 } 273 }
274 274
275 } // namespace drive_backend 275 } // namespace drive_backend
276 } // namespace sync_file_system 276 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698