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

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_directory_service.cc

Issue 10823427: gdata: Change callback type of GDataDirectoryService::GetEntryInfoByResourceId() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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/gdata/gdata_directory_service.h" 5 #include "chrome/browser/chromeos/gdata/gdata_directory_service.h"
6 6
7 #include <leveldb/db.h> 7 #include <leveldb/db.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/message_loop_proxy.h" 10 #include "base/message_loop_proxy.h"
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 321
322 void GDataDirectoryService::GetEntryByResourceIdAsync( 322 void GDataDirectoryService::GetEntryByResourceIdAsync(
323 const std::string& resource_id, 323 const std::string& resource_id,
324 const GetEntryByResourceIdCallback& callback) { 324 const GetEntryByResourceIdCallback& callback) {
325 GDataEntry* entry = GetEntryByResourceId(resource_id); 325 GDataEntry* entry = GetEntryByResourceId(resource_id);
326 callback.Run(entry); 326 callback.Run(entry);
327 } 327 }
328 328
329 void GDataDirectoryService::GetEntryInfoByResourceId( 329 void GDataDirectoryService::GetEntryInfoByResourceId(
330 const std::string& resource_id, 330 const std::string& resource_id,
331 const GetEntryInfoCallback& callback) { 331 const GetEntryInfoWithFilePathCallback& callback) {
332 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 332 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
333 DCHECK(!callback.is_null()); 333 DCHECK(!callback.is_null());
334 334
335 scoped_ptr<GDataEntryProto> entry_proto; 335 scoped_ptr<GDataEntryProto> entry_proto;
336 GDataFileError error = GDATA_FILE_ERROR_FAILED; 336 GDataFileError error = GDATA_FILE_ERROR_FAILED;
337 FilePath drive_file_path;
337 338
338 GDataEntry* entry = GetEntryByResourceId(resource_id); 339 GDataEntry* entry = GetEntryByResourceId(resource_id);
339 if (entry) { 340 if (entry) {
340 entry_proto.reset(new GDataEntryProto); 341 entry_proto.reset(new GDataEntryProto);
341 entry->ToProtoFull(entry_proto.get()); 342 entry->ToProtoFull(entry_proto.get());
342 error = GDATA_FILE_OK; 343 error = GDATA_FILE_OK;
344 drive_file_path = entry->GetFilePath();
343 } else { 345 } else {
344 error = GDATA_FILE_ERROR_NOT_FOUND; 346 error = GDATA_FILE_ERROR_NOT_FOUND;
345 } 347 }
346 348
347 base::MessageLoopProxy::current()->PostTask( 349 base::MessageLoopProxy::current()->PostTask(
348 FROM_HERE, 350 FROM_HERE,
349 base::Bind(callback, error, base::Passed(&entry_proto))); 351 base::Bind(callback,
352 error,
353 drive_file_path,
354 base::Passed(&entry_proto)));
350 } 355 }
351 356
352 void GDataDirectoryService::GetEntryInfoByPath( 357 void GDataDirectoryService::GetEntryInfoByPath(
353 const FilePath& path, 358 const FilePath& path,
354 const GetEntryInfoCallback& callback) { 359 const GetEntryInfoCallback& callback) {
355 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 360 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
356 DCHECK(!callback.is_null()); 361 DCHECK(!callback.is_null());
357 362
358 scoped_ptr<GDataEntryProto> entry_proto; 363 scoped_ptr<GDataEntryProto> entry_proto;
359 GDataFileError error = GDATA_FILE_ERROR_FAILED; 364 GDataFileError error = GDATA_FILE_ERROR_FAILED;
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 DCHECK(result.get()); 748 DCHECK(result.get());
744 749
745 result->second.path = second_path; 750 result->second.path = second_path;
746 result->second.error = error; 751 result->second.error = error;
747 result->second.proto = entry_proto.Pass(); 752 result->second.proto = entry_proto.Pass();
748 753
749 callback.Run(result.Pass()); 754 callback.Run(result.Pass());
750 } 755 }
751 756
752 } // namespace gdata 757 } // namespace gdata
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698