Code: GDataFileError GDataFileSystem::AddNewDirectory(
    const FilePath& directory_path, base::Value* entry_value) {
  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));

  if (!entry_value)
    return GDATA_FILE_ERROR_FAILED;

  scoped_ptr<DocumentEntry> doc_entry(DocumentEntry::CreateFrom(*entry_value));

  if (!doc_entry.get())
    return GDATA_FILE_ERROR_FAILED;

  GDataEntry* entry = directory_service_->FindEntryByPathSync(directory_path);
  if (!entry)
    return GDATA_FILE_ERROR_FAILED;

  GDataDirectory* parent_dir = entry->AsGDataDirectory();
   if (!parent_dir)
     return GDATA_FILE_ERROR_FAILED;
 
  GDataEntry* new_entry = GDataEntry::FromDocumentEntry(
      NULL, doc_entry.get(), directory_service_.get());
   if (!new_entry)
     return GDATA_FILE_ERROR_FAILED;
 
  parent_dir->AddEntry(new_entry);

  OnDirectoryChanged(directory_path);
  return GDATA_FILE_OK;
}

Vulnerability Type: DoS 
CWE ID: CWE-399
Summary: Use-after-free vulnerability in Google Chrome before 24.0.1312.56 allows remote attackers to cause a denial of service or possibly have unspecified other impact via vectors related to the handling of fonts in CANVAS elements.
Commit Message: 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