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 a7e9bfd7b2f23a194d4d9eadf789e0a3e7daf9a7..d22457b99f3bf04959de4cc22dc1e8813f4aff8d 100644 |
--- a/chrome/browser/chromeos/gdata/gdata_files.cc |
+++ b/chrome/browser/chromeos/gdata/gdata_files.cc |
@@ -18,7 +18,6 @@ namespace { |
const char kSlash[] = "/"; |
const char kEscapedSlash[] = "\xE2\x88\x95"; |
-const FilePath::CharType kGDataRootDirectory[] = FILE_PATH_LITERAL("drive"); |
std::string CacheSubDirectoryTypeToString( |
GDataRootDirectory::CacheSubDirectoryType subdir) { |
@@ -431,6 +430,10 @@ GDataRootDirectory::GDataRootDirectory() |
largest_changestamp_(0), serialized_size_(0) { |
title_ = kGDataRootDirectory; |
SetFileNameFromTitle(); |
+ resource_id_ = kGDataRootDirectoryResourceId; |
+ // Add self to the map so the root directory can be looked up by the |
+ // resource ID. |
+ AddEntryToResourceMap(this); |
} |
GDataRootDirectory::~GDataRootDirectory() { |
@@ -869,9 +872,15 @@ bool GDataRootDirectory::ParseFromString(const std::string& serialized_proto) { |
// The title field for the root directory was originally empty, then |
// changed to "gdata", then changed to "drive". Discard the proto data if |
// the older formats are detected. See crbug.com/128133 for details. |
- const std::string& title = proto->gdata_directory().gdata_entry().title(); |
- if (title != "drive") { |
- LOG(ERROR) << "Incompatible proto detected: " << title; |
+ const GDataEntryProto& entry = proto->gdata_directory().gdata_entry(); |
achuithb
2012/05/18 17:42:56
nit: maybe call this entry_proto?
satorux1
2012/05/18 17:55:28
Done.
|
+ if (entry.title() != "drive") { |
+ LOG(ERROR) << "Incompatible proto detected (bad title): " |
+ << entry.title(); |
+ return false; |
+ } |
+ if (entry.resource_id() != kGDataRootDirectoryResourceId) { |
+ LOG(ERROR) << "Incompatible proto detected (bad resource id): " |
+ << entry.resource_id(); |
return false; |
} |