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

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

Issue 568633002: Extracted MetafilePlayer interface from printing::MetafilePlayer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@no_expose
Patch Set: Thu Sep 11 16:10:13 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
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 ScopedVector<Metafile>* emf_files) { 133 ScopedVector<MetafilePlayer>* 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 if (!(*emf_files)[i]) { 142 if (!(*emf_files)[i]) {
143 web_contents()->Stop(); 143 web_contents()->Stop();
144 return; 144 return;
145 } 145 }
146 } 146 }
147 147
148 for (size_t i = 0; i < emf_files->size(); ++i) { 148 for (size_t i = 0; i < emf_files->size(); ++i) {
149 // Update the rendered document. It will send notifications to the listener. 149 // Update the rendered document. It will send notifications to the listener.
150 document->SetPage(i, 150 document->SetPage(i,
151 (*emf_files)[i], 151 make_scoped_ptr((*emf_files)[i]),
152 scale_factor, 152 scale_factor,
153 params.page_size, 153 params.page_size,
154 params.content_area); 154 params.content_area);
155 } 155 }
156 // document->SetPage took ownership of all EMFs. 156 // document->SetPage took ownership of all EMFs.
157 emf_files->weak_clear(); 157 emf_files->weak_clear();
158 158
159 ShouldQuitFromInnerMessageLoop(); 159 ShouldQuitFromInnerMessageLoop();
160 } 160 }
161 #endif // OS_WIN 161 #endif // OS_WIN
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 scoped_refptr<printing::PrinterQuery> printer_query; 566 scoped_refptr<printing::PrinterQuery> printer_query;
567 printer_query = queue_->PopPrinterQuery(cookie); 567 printer_query = queue_->PopPrinterQuery(cookie);
568 if (!printer_query.get()) 568 if (!printer_query.get())
569 return; 569 return;
570 BrowserThread::PostTask( 570 BrowserThread::PostTask(
571 BrowserThread::IO, FROM_HERE, 571 BrowserThread::IO, FROM_HERE,
572 base::Bind(&PrinterQuery::StopWorker, printer_query.get())); 572 base::Bind(&PrinterQuery::StopWorker, printer_query.get()));
573 } 573 }
574 574
575 } // namespace printing 575 } // namespace printing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698