Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Side by Side Diff: chrome/browser/printing/print_view_manager_base.cc

Issue 399143009: Add NULL check in OnPdfToEmfConverted (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/printing/print_view_manager_base.h" 5 #include "chrome/browser/printing/print_view_manager_base.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 127
128 void PrintViewManagerBase::OnDidGetDocumentCookie(int cookie) { 128 void PrintViewManagerBase::OnDidGetDocumentCookie(int cookie) {
129 cookie_ = cookie; 129 cookie_ = cookie;
130 } 130 }
131 131
132 #if defined(WIN_PDF_METAFILE_FOR_PRINTING) 132 #if defined(WIN_PDF_METAFILE_FOR_PRINTING)
133 void PrintViewManagerBase::OnPdfToEmfConverted( 133 void PrintViewManagerBase::OnPdfToEmfConverted(
134 const PrintHostMsg_DidPrintPage_Params& params, 134 const PrintHostMsg_DidPrintPage_Params& params,
135 double scale_factor, 135 double scale_factor,
136 const std::vector<base::FilePath>& emf_files) { 136 const std::vector<base::FilePath>& emf_files) {
137 if (!print_job_.get())
138 return;
139
137 PrintedDocument* document = print_job_->document(); 140 PrintedDocument* document = print_job_->document();
138 if (!document) 141 if (!document)
139 return; 142 return;
140 143
141 for (size_t i = 0; i < emf_files.size(); ++i) { 144 for (size_t i = 0; i < emf_files.size(); ++i) {
142 scoped_ptr<printing::Emf> metafile(new printing::Emf); 145 scoped_ptr<printing::Emf> metafile(new printing::Emf);
143 if (!metafile->InitFromFile(emf_files[i])) { 146 if (!metafile->InitFromFile(emf_files[i])) {
144 NOTREACHED() << "Invalid metafile"; 147 NOTREACHED() << "Invalid metafile";
145 web_contents()->Stop(); 148 web_contents()->Stop();
146 return; 149 return;
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 scoped_refptr<printing::PrinterQuery> printer_query; 592 scoped_refptr<printing::PrinterQuery> printer_query;
590 printer_query = queue_->PopPrinterQuery(cookie); 593 printer_query = queue_->PopPrinterQuery(cookie);
591 if (!printer_query) 594 if (!printer_query)
592 return; 595 return;
593 BrowserThread::PostTask( 596 BrowserThread::PostTask(
594 BrowserThread::IO, FROM_HERE, 597 BrowserThread::IO, FROM_HERE,
595 base::Bind(&PrinterQuery::StopWorker, printer_query.get())); 598 base::Bind(&PrinterQuery::StopWorker, printer_query.get()));
596 } 599 }
597 600
598 } // namespace printing 601 } // namespace printing
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698