Revert 137558 - Revert 136935 - Sometimes data is NULL. I am not sure if it's...

Revert 137558 - Revert 136935 - Sometimes data is NULL. I am not sure if it's correct behavior , but it's safe just to check pointer.

Reverted by mistake instead of branch.

BUG=127865


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

TBR=vitalybuka@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10383225

TBR=vitalybuka@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10389186

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137567 0039d316-1c4b-4281-b951-d872f2087c98
parent 15397b4b
......@@ -715,7 +715,7 @@ void PrintPreviewHandler::SendCloudPrintJob(const DictionaryValue& settings,
web_ui()->GetController());
print_preview_ui->GetPrintPreviewDataForIndex(
printing::COMPLETE_PREVIEW_DOCUMENT_INDEX, &data);
if (data->size() > 0U && data->front()) {
if (data.get() && data->size() > 0U && data->front()) {
string16 print_job_title_utf16 =
preview_tab_wrapper()->print_view_manager()->RenderSourceName();
std::string print_job_title = UTF16ToUTF8(print_job_title_utf16);
......@@ -841,12 +841,14 @@ void PrintPreviewHandler::FileSelected(const FilePath& path,
print_preview_ui->GetPrintPreviewDataForIndex(
printing::COMPLETE_PREVIEW_DOCUMENT_INDEX, &data);
print_to_pdf_path_.reset(new FilePath(path));
if (data.get())
PostPrintToPdfTask(data);
}
void PrintPreviewHandler::PostPrintToPdfTask(
scoped_refptr<base::RefCountedBytes> data) {
void PrintPreviewHandler::PostPrintToPdfTask(base::RefCountedBytes* data) {
if (!data) {
NOTREACHED();
return;
}
printing::PreviewMetafile* metafile = new printing::PreviewMetafile;
metafile->InitFromData(static_cast<const void*>(data->front()), data->size());
// PrintToPdfCallback takes ownership of |metafile|.
......
......@@ -176,7 +176,7 @@ class PrintPreviewHandler : public content::WebUIMessageHandler,
void ClearInitiatorTabDetails();
// Posts a task to save |data| to pdf at |print_to_pdf_path_|.
void PostPrintToPdfTask(scoped_refptr<base::RefCountedBytes> data);
void PostPrintToPdfTask(base::RefCountedBytes* data);
// Populates |settings| according to the current locale.
void GetNumberFormatAndMeasurementSystem(base::DictionaryValue* settings);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment