gdata: Define the resource ID for the root directory

Per the spec, the resource ID for the root directory is defined
as "folder:root". Add the resource ID to the root directory in our
file system representation so we can look up the root directory by
the resource ID.

BUG=127697
TEST=add unit tests

Review URL: https://chromiumcodereview.appspot.com/10332253

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137928 0039d316-1c4b-4281-b951-d872f2087c98
void GDataEntry::SerializeToString(std::string* serialized_proto) const {
  const GDataFile* file = AsGDataFileConst();
  const GDataDirectory* dir = AsGDataDirectoryConst();

  if (file) {
    scoped_ptr<GDataFileProto> proto(new GDataFileProto());
    file->ToProto(proto.get());
    const bool ok = proto->SerializeToString(serialized_proto);
    DCHECK(ok);
  } else if (dir) {
    scoped_ptr<GDataDirectoryProto> proto(new GDataDirectoryProto());
    dir->ToProto(proto.get());
    const bool ok = proto->SerializeToString(serialized_proto);
    DCHECK(ok);
  }
}

void GDataEntry::SerializeToString(std::string* serialized_proto) const {
  const GDataFile* file = AsGDataFileConst();
  const GDataDirectory* dir = AsGDataDirectoryConst();

  if (file) {
    scoped_ptr<GDataFileProto> proto(new GDataFileProto());
    file->ToProto(proto.get());
    const bool ok = proto->SerializeToString(serialized_proto);
    DCHECK(ok);
  } else if (dir) {
    scoped_ptr<GDataDirectoryProto> proto(new GDataDirectoryProto());
    dir->ToProto(proto.get());
    const bool ok = proto->SerializeToString(serialized_proto);
    DCHECK(ok);
  }
}
