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

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

Issue 547203002: Delete temporarily dir for PDF to EMF conversion after all EMF files closed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mon Sep 8 12:19:46 PDT 2014 Created 6 years, 3 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
« no previous file with comments | « chrome/browser/printing/print_view_manager_base.h ('k') | printing/emf_win.h » ('j') | 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 } 123 }
124 124
125 void PrintViewManagerBase::OnDidGetDocumentCookie(int cookie) { 125 void PrintViewManagerBase::OnDidGetDocumentCookie(int cookie) {
126 cookie_ = cookie; 126 cookie_ = cookie;
127 } 127 }
128 128
129 #if defined(OS_WIN) 129 #if defined(OS_WIN)
130 void PrintViewManagerBase::OnPdfToEmfConverted( 130 void PrintViewManagerBase::OnPdfToEmfConverted(
131 const PrintHostMsg_DidPrintPage_Params& params, 131 const PrintHostMsg_DidPrintPage_Params& params,
132 double scale_factor, 132 double scale_factor,
133 const std::vector<base::FilePath>& emf_files) { 133 ScopedVector<Metafile>* emf_files) {
134 if (!print_job_.get()) 134 if (!print_job_.get())
135 return; 135 return;
136 136
137 PrintedDocument* document = print_job_->document(); 137 PrintedDocument* document = print_job_->document();
138 if (!document) 138 if (!document)
139 return; 139 return;
140 140
141 for (size_t i = 0; i < emf_files.size(); ++i) { 141 for (size_t i = 0; i < emf_files->size(); ++i) {
142 scoped_ptr<printing::Emf> metafile(new printing::Emf); 142 if (!(*emf_files)[i]) {
143 if (!metafile->InitFromFile(emf_files[i])) {
144 NOTREACHED() << "Invalid metafile";
145 web_contents()->Stop(); 143 web_contents()->Stop();
146 return; 144 return;
147 } 145 }
146 }
147
148 for (size_t i = 0; i < emf_files->size(); ++i) {
148 // Update the rendered document. It will send notifications to the listener. 149 // Update the rendered document. It will send notifications to the listener.
149 document->SetPage(i, 150 document->SetPage(i,
150 metafile.release(), 151 (*emf_files)[i],
151 scale_factor, 152 scale_factor,
152 params.page_size, 153 params.page_size,
153 params.content_area); 154 params.content_area);
154 } 155 }
156 // document->SetPage took ownership of all EMFs.
157 emf_files->weak_clear();
155 158
156 ShouldQuitFromInnerMessageLoop(); 159 ShouldQuitFromInnerMessageLoop();
157 } 160 }
158 #endif // OS_WIN 161 #endif // OS_WIN
159 162
160 void PrintViewManagerBase::OnDidPrintPage( 163 void PrintViewManagerBase::OnDidPrintPage(
161 const PrintHostMsg_DidPrintPage_Params& params) { 164 const PrintHostMsg_DidPrintPage_Params& params) {
162 if (!OpportunisticallyCreatePrintJob(params.document_cookie)) 165 if (!OpportunisticallyCreatePrintJob(params.document_cookie))
163 return; 166 return;
164 167
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 scoped_refptr<printing::PrinterQuery> printer_query; 566 scoped_refptr<printing::PrinterQuery> printer_query;
564 printer_query = queue_->PopPrinterQuery(cookie); 567 printer_query = queue_->PopPrinterQuery(cookie);
565 if (!printer_query.get()) 568 if (!printer_query.get())
566 return; 569 return;
567 BrowserThread::PostTask( 570 BrowserThread::PostTask(
568 BrowserThread::IO, FROM_HERE, 571 BrowserThread::IO, FROM_HERE,
569 base::Bind(&PrinterQuery::StopWorker, printer_query.get())); 572 base::Bind(&PrinterQuery::StopWorker, printer_query.get()));
570 } 573 }
571 574
572 } // namespace printing 575 } // namespace printing
OLDNEW
« no previous file with comments | « chrome/browser/printing/print_view_manager_base.h ('k') | printing/emf_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698