OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/service/service_utility_process_host.h" | 5 #include "chrome/service/service_utility_process_host.h" |
6 | 6 |
7 #include <queue> | 7 #include <queue> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 } | 315 } |
316 | 316 |
317 void ServiceUtilityProcessHost::OnRenderPDFPagesToMetafilesPageDone( | 317 void ServiceUtilityProcessHost::OnRenderPDFPagesToMetafilesPageDone( |
318 bool success, | 318 bool success, |
319 float scale_factor) { | 319 float scale_factor) { |
320 DCHECK(waiting_for_reply_); | 320 DCHECK(waiting_for_reply_); |
321 if (!pdf_to_emf_state_ || !success) | 321 if (!pdf_to_emf_state_ || !success) |
322 return OnPDFToEmfFinished(false); | 322 return OnPDFToEmfFinished(false); |
323 base::File emf_file = pdf_to_emf_state_->TakeNextFile(); | 323 base::File emf_file = pdf_to_emf_state_->TakeNextFile(); |
324 base::PostTaskAndReplyWithResult( | 324 base::PostTaskAndReplyWithResult( |
325 client_message_loop_proxy_, | 325 client_message_loop_proxy_.get(), FROM_HERE, |
326 FROM_HERE, | 326 base::Bind(&Client::MetafileAvailable, client_.get(), scale_factor, |
327 base::Bind(&Client::MetafileAvailable, | |
328 client_.get(), | |
329 scale_factor, | |
330 base::Passed(&emf_file)), | 327 base::Passed(&emf_file)), |
331 base::Bind(&ServiceUtilityProcessHost::OnMetafileSpooled, | 328 base::Bind(&ServiceUtilityProcessHost::OnMetafileSpooled, |
332 weak_ptr_factory_.GetWeakPtr())); | 329 weak_ptr_factory_.GetWeakPtr())); |
333 } | 330 } |
334 | 331 |
335 void ServiceUtilityProcessHost::OnPDFToEmfFinished(bool success) { | 332 void ServiceUtilityProcessHost::OnPDFToEmfFinished(bool success) { |
336 if (!waiting_for_reply_) | 333 if (!waiting_for_reply_) |
337 return; | 334 return; |
338 waiting_for_reply_ = false; | 335 waiting_for_reply_ = false; |
339 if (success) { | 336 if (success) { |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 return false; | 418 return false; |
422 } | 419 } |
423 printing::Emf emf; | 420 printing::Emf emf; |
424 if (!emf.InitFromData(data.data(), data.size())) { | 421 if (!emf.InitFromData(data.data(), data.size())) { |
425 OnRenderPDFPagesToMetafileDone(false); | 422 OnRenderPDFPagesToMetafileDone(false); |
426 return false; | 423 return false; |
427 } | 424 } |
428 OnRenderPDFPagesToMetafilePageDone(scale_factor, emf); | 425 OnRenderPDFPagesToMetafilePageDone(scale_factor, emf); |
429 return true; | 426 return true; |
430 } | 427 } |
OLD | NEW |