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

Unified Diff: chrome/browser/chromeos/gdata/gdata_files.cc

Issue 10831076: gdata: Get rid of callback from GDataDirectoryService::FindEntryByPath() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_files.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/gdata/gdata_files.cc
diff --git a/chrome/browser/chromeos/gdata/gdata_files.cc b/chrome/browser/chromeos/gdata/gdata_files.cc
index 9d3551bbb2ebddd7749d15d85c2425da36997d0b..beab18f18a6d4fd111ee2f1d1e26d65236ed3d5f 100644
--- a/chrome/browser/chromeos/gdata/gdata_files.cc
+++ b/chrome/browser/chromeos/gdata/gdata_files.cc
@@ -467,11 +467,8 @@ void GDataDirectoryService::RemoveEntryFromResourceMap(GDataEntry* entry) {
resource_map_.erase(entry->resource_id());
}
-void GDataDirectoryService::FindEntryByPath(const FilePath& file_path,
- const FindEntryCallback& callback) {
- // GDataFileSystem has already locked.
- DCHECK(!callback.is_null());
-
+GDataEntry* GDataDirectoryService::FindEntryByPathSync(
+ const FilePath& file_path) {
std::vector<FilePath::StringType> components;
file_path.GetComponents(&components);
@@ -484,17 +481,15 @@ void GDataDirectoryService::FindEntryByPath(const FilePath& file_path,
// Last element must match, if not last then it must be a directory.
if (i == components.size() - 1) {
if (current_dir->base_name() == components[i])
- callback.Run(GDATA_FILE_OK, current_dir);
+ return current_dir;
else
- callback.Run(GDATA_FILE_ERROR_NOT_FOUND, NULL);
- return;
+ return NULL;
}
// Not the last part of the path, search for the next segment.
GDataEntry* entry = current_dir->FindChild(components[i + 1]);
if (!entry) {
- callback.Run(GDATA_FILE_ERROR_NOT_FOUND, NULL);
- return;
+ return NULL;
}
// Found file, must be the last segment.
@@ -503,14 +498,12 @@ void GDataDirectoryService::FindEntryByPath(const FilePath& file_path,
current_dir = entry->AsGDataDirectory();
} else {
if ((i + 1) == (components.size() - 1))
- callback.Run(GDATA_FILE_OK, entry);
+ return entry;
else
- callback.Run(GDATA_FILE_ERROR_NOT_FOUND, NULL);
-
- return;
+ return NULL;
}
}
- callback.Run(GDATA_FILE_ERROR_NOT_FOUND, NULL);
+ return NULL;
}
GDataEntry* GDataDirectoryService::GetEntryByResourceId(
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_files.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698