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/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 | 8 |
9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 return NULL; | 322 return NULL; |
323 | 323 |
324 if (i == components.size() - 1) // Last component. | 324 if (i == components.size() - 1) // Last component. |
325 return entry; | 325 return entry; |
326 else | 326 else |
327 current_dir = entry->AsGDataDirectory(); | 327 current_dir = entry->AsGDataDirectory(); |
328 } | 328 } |
329 return NULL; | 329 return NULL; |
330 } | 330 } |
331 | 331 |
332 void GDataDirectoryService::FindEntryByPathAndRunSync( | |
333 const FilePath& search_file_path, | |
334 const FindEntryCallback& callback) { | |
335 GDataEntry* entry = FindEntryByPathSync(search_file_path); | |
336 callback.Run(entry ? GDATA_FILE_OK : GDATA_FILE_ERROR_NOT_FOUND, entry); | |
337 } | |
338 | |
339 GDataEntry* GDataDirectoryService::GetEntryByResourceId( | 332 GDataEntry* GDataDirectoryService::GetEntryByResourceId( |
340 const std::string& resource) { | 333 const std::string& resource) { |
341 // GDataFileSystem has already locked. | 334 // GDataFileSystem has already locked. |
342 ResourceMap::const_iterator iter = resource_map_.find(resource); | 335 ResourceMap::const_iterator iter = resource_map_.find(resource); |
343 return iter == resource_map_.end() ? NULL : iter->second; | 336 return iter == resource_map_.end() ? NULL : iter->second; |
344 } | 337 } |
345 | 338 |
346 void GDataDirectoryService::GetEntryByResourceIdAsync( | 339 void GDataDirectoryService::GetEntryByResourceIdAsync( |
347 const std::string& resource_id, | 340 const std::string& resource_id, |
348 const GetEntryByResourceIdCallback& callback) { | 341 const GetEntryByResourceIdCallback& callback) { |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 DCHECK(result.get()); | 746 DCHECK(result.get()); |
754 | 747 |
755 result->second.path = second_path; | 748 result->second.path = second_path; |
756 result->second.error = error; | 749 result->second.error = error; |
757 result->second.proto = entry_proto.Pass(); | 750 result->second.proto = entry_proto.Pass(); |
758 | 751 |
759 callback.Run(result.Pass()); | 752 callback.Run(result.Pass()); |
760 } | 753 } |
761 | 754 |
762 } // namespace gdata | 755 } // namespace gdata |
OLD | NEW |