Chromium Code Reviews| 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 23d565d704145f678aed1fb0c2f789ee6b871fc4..2b5b721dd414ac649773533f25dfc9c9fe809f3d 100644 |
| --- a/chrome/browser/chromeos/gdata/gdata_files.cc |
| +++ b/chrome/browser/chromeos/gdata/gdata_files.cc |
| @@ -314,7 +314,6 @@ void GDataDirectory::AddEntry(GDataEntry* entry) { |
| << ", parent resource = " << entry->parent_resource_id() |
| << ", resource = " + entry->resource_id(); |
| - |
| // Add entry to resource map. |
| if (directory_service_) |
| directory_service_->AddEntryToResourceMap(entry); |
| @@ -552,10 +551,8 @@ GDataDirectoryService::GDataDirectoryService() |
| origin_(UNINITIALIZED), |
| weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { |
| root_.reset(new GDataDirectory(NULL, this)); |
| - root_->set_title(kGDataRootDirectory); |
| - root_->SetBaseNameFromTitle(); |
| - root_->set_resource_id(kGDataRootDirectoryResourceId); |
| - AddEntryToResourceMap(root_.get()); |
| + if (!util::IsDriveV2ApiEnabled()) |
| + SetRootResourceId(kGDataRootDirectoryResourceId); |
|
satorux1
2012/08/08 13:18:51
The function name looks wrong. Here, we are doing
kochi
2012/08/08 16:53:27
Nope, I introduced the function as Drive v2 uses a
|
| } |
| GDataDirectoryService::~GDataDirectoryService() { |
| @@ -567,6 +564,14 @@ GDataDirectoryService::~GDataDirectoryService() { |
| directory_service_db_.release()); |
| } |
| +void GDataDirectoryService::SetRootResourceId(const std::string& root_id) { |
| + root_.reset(new GDataDirectory(NULL, this)); |
| + root_->set_title(kGDataRootDirectory); |
| + root_->SetBaseNameFromTitle(); |
| + root_->set_resource_id(root_id); |
| + AddEntryToResourceMap(root_.get()); |
| +} |
| + |
| void GDataDirectoryService::ClearRoot() { |
| // Note that children have a reference to root_, |
| // so we need to delete them here. |
| @@ -739,7 +744,7 @@ void GDataDirectoryService::InitResourceMap( |
| // Get the largest changestamp. |
| iter = serialized_resources->find(kDBKeyLargestChangestamp); |
| if (iter == serialized_resources->end() || |
| - !base::StringToInt(iter->second, &largest_changestamp_)) { |
| + !base::StringToInt64(iter->second, &largest_changestamp_)) { |
| NOTREACHED() << "Could not find/parse largest_changestamp"; |
| if (!callback.is_null()) |
| callback.Run(GDATA_FILE_ERROR_FAILED); |