Remove parent* arg from GDataEntry ctor.

* Remove static FromDocumentEntry from GDataEntry, GDataFile, GDataDirectory. Replace with InitFromDocumentEntry.
* Move common code from GDataFile::InitFromDocumentEntry and GDataDirectory::InitFromDocumentEntry to GDataEntry::InitFromDocumentEntry.
* Add GDataDirectoryService::FromDocumentEntry and use this everywhere.
* Make ctors of GDataFile, GDataDirectory private, so these must be created by GDataDirectoryService's CreateGDataFile and
CreateGDataDirectory. Make GDataEntry ctor protected.

BUG=141494
TEST=unit tests.
Review URL: https://chromiumcodereview.appspot.com/10854083

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151008 0039d316-1c4b-4281-b951-d872f2087c98
scoped_ptr<GDataEntry> GDataDirectoryService::FromProtoString(
    const std::string& serialized_proto) {
  GDataEntryProto entry_proto;
  if (!entry_proto.ParseFromString(serialized_proto))
    return scoped_ptr<GDataEntry>();
 
   scoped_ptr<GDataEntry> entry;
   if (entry_proto.file_info().is_directory()) {
    entry.reset(CreateGDataDirectory());
     if (!entry->FromProto(entry_proto)) {
       NOTREACHED() << "FromProto (directory) failed";
       entry.reset();
     }
   } else {
    scoped_ptr<GDataFile> file(CreateGDataFile());
     if (file->FromProto(entry_proto)) {
       entry.reset(file.release());
    } else {
      NOTREACHED() << "FromProto (file) failed";
    }
  }
  return entry.Pass();
}

scoped_ptr<GDataEntry> GDataDirectoryService::FromProtoString(
    const std::string& serialized_proto) {
  GDataEntryProto entry_proto;
  if (!entry_proto.ParseFromString(serialized_proto))
    return scoped_ptr<GDataEntry>();
 
   scoped_ptr<GDataEntry> entry;
   if (entry_proto.file_info().is_directory()) {
    entry.reset(new GDataDirectory(NULL, this));
     if (!entry->FromProto(entry_proto)) {
       NOTREACHED() << "FromProto (directory) failed";
       entry.reset();
     }
   } else {
    scoped_ptr<GDataFile> file(new GDataFile(NULL, this));
     if (file->FromProto(entry_proto)) {
       entry.reset(file.release());
    } else {
      NOTREACHED() << "FromProto (file) failed";
    }
  }
  return entry.Pass();
}
