Chromium Code Reviews| 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 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 293 GDataEntry* GDataDirectoryService::FindEntryByPathSync( | 293 GDataEntry* GDataDirectoryService::FindEntryByPathSync( |
| 294 const FilePath& file_path) { | 294 const FilePath& file_path) { |
| 295 if (file_path == root_->GetFilePath()) | 295 if (file_path == root_->GetFilePath()) |
| 296 return root_.get(); | 296 return root_.get(); |
| 297 | 297 |
| 298 std::vector<FilePath::StringType> components; | 298 std::vector<FilePath::StringType> components; |
| 299 file_path.GetComponents(&components); | 299 file_path.GetComponents(&components); |
| 300 GDataDirectory* current_dir = root_.get(); | 300 GDataDirectory* current_dir = root_.get(); |
| 301 | 301 |
| 302 for (size_t i = 1; i < components.size() && current_dir; ++i) { | 302 for (size_t i = 1; i < components.size() && current_dir; ++i) { |
| 303 GDataEntry* entry = current_dir->FindChild(components[i]); | 303 GDataEntry* entry = |
| 304 GetEntryByResourceId(current_dir->FindChild(components[i])); | |
|
satorux1
2012/08/20 16:40:08
looks a bit scary. Maybe:
const std::string resou
achuithb
2012/08/20 21:14:57
Done. I've added a DCHECK for entry instead of a r
| |
| 304 if (!entry) | 305 if (!entry) |
| 305 return NULL; | 306 return NULL; |
| 306 | 307 |
| 307 if (i == components.size() - 1) // Last component. | 308 if (i == components.size() - 1) // Last component. |
| 308 return entry; | 309 return entry; |
| 309 else | 310 else |
| 310 current_dir = entry->AsGDataDirectory(); | 311 current_dir = entry->AsGDataDirectory(); |
| 311 } | 312 } |
| 312 return NULL; | 313 return NULL; |
| 313 } | 314 } |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 720 DCHECK(result.get()); | 721 DCHECK(result.get()); |
| 721 | 722 |
| 722 result->second.path = second_path; | 723 result->second.path = second_path; |
| 723 result->second.error = error; | 724 result->second.error = error; |
| 724 result->second.proto = entry_proto.Pass(); | 725 result->second.proto = entry_proto.Pass(); |
| 725 | 726 |
| 726 callback.Run(result.Pass()); | 727 callback.Run(result.Pass()); |
| 727 } | 728 } |
| 728 | 729 |
| 729 } // namespace gdata | 730 } // namespace gdata |
| OLD | NEW |