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

Side by Side Diff: chrome/service/service_utility_process_host.cc

Issue 2835193007: Revert of clean up printing::Image and printing::Metafile (Closed)
Patch Set: Created 3 years, 7 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/service/service_utility_process_host.h ('k') | components/printing/test/mock_printer.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 (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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include <queue> 9 #include <queue>
10 #include <utility> 10 #include <utility>
(...skipping 19 matching lines...) Expand all
30 #include "content/public/common/child_process_host.h" 30 #include "content/public/common/child_process_host.h"
31 #include "content/public/common/content_switches.h" 31 #include "content/public/common/content_switches.h"
32 #include "content/public/common/mojo_channel_switches.h" 32 #include "content/public/common/mojo_channel_switches.h"
33 #include "content/public/common/result_codes.h" 33 #include "content/public/common/result_codes.h"
34 #include "content/public/common/sandbox_init.h" 34 #include "content/public/common/sandbox_init.h"
35 #include "content/public/common/sandboxed_process_launcher_delegate.h" 35 #include "content/public/common/sandboxed_process_launcher_delegate.h"
36 #include "mojo/edk/embedder/embedder.h" 36 #include "mojo/edk/embedder/embedder.h"
37 #include "mojo/edk/embedder/named_platform_channel_pair.h" 37 #include "mojo/edk/embedder/named_platform_channel_pair.h"
38 #include "mojo/edk/embedder/platform_channel_pair.h" 38 #include "mojo/edk/embedder/platform_channel_pair.h"
39 #include "mojo/edk/embedder/scoped_platform_handle.h" 39 #include "mojo/edk/embedder/scoped_platform_handle.h"
40 #include "printing/emf_win.h"
40 #include "sandbox/win/src/sandbox_policy.h" 41 #include "sandbox/win/src/sandbox_policy.h"
41 #include "sandbox/win/src/sandbox_types.h" 42 #include "sandbox/win/src/sandbox_types.h"
42 #include "ui/base/ui_base_switches.h" 43 #include "ui/base/ui_base_switches.h"
43 44
44 namespace { 45 namespace {
45 46
46 using content::ChildProcessHost; 47 using content::ChildProcessHost;
47 48
48 enum ServiceUtilityProcessHostEvent { 49 enum ServiceUtilityProcessHostEvent {
49 SERVICE_UTILITY_STARTED, 50 SERVICE_UTILITY_STARTED,
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 const std::string& printer_name) { 422 const std::string& printer_name) {
422 DCHECK(waiting_for_reply_); 423 DCHECK(waiting_for_reply_);
423 ReportUmaEvent(SERVICE_UTILITY_SEMANTIC_CAPS_FAILED); 424 ReportUmaEvent(SERVICE_UTILITY_SEMANTIC_CAPS_FAILED);
424 waiting_for_reply_ = false; 425 waiting_for_reply_ = false;
425 client_task_runner_->PostTask( 426 client_task_runner_->PostTask(
426 FROM_HERE, base::Bind(&Client::OnGetPrinterSemanticCapsAndDefaults, 427 FROM_HERE, base::Bind(&Client::OnGetPrinterSemanticCapsAndDefaults,
427 client_.get(), false, printer_name, 428 client_.get(), false, printer_name,
428 printing::PrinterSemanticCapsAndDefaults())); 429 printing::PrinterSemanticCapsAndDefaults()));
429 } 430 }
430 431
431 bool ServiceUtilityProcessHost::Client::OnRenderPDFPagesToMetafilePageDone(
432 const std::vector<char>&,
433 float) {
434 return false;
435 }
436
437 bool ServiceUtilityProcessHost::Client::MetafileAvailable(float scale_factor, 432 bool ServiceUtilityProcessHost::Client::MetafileAvailable(float scale_factor,
438 base::File file) { 433 base::File file) {
439 file.Seek(base::File::FROM_BEGIN, 0); 434 file.Seek(base::File::FROM_BEGIN, 0);
440 int64_t size = file.GetLength(); 435 int64_t size = file.GetLength();
441 if (size <= 0) { 436 if (size <= 0) {
442 OnRenderPDFPagesToMetafileDone(false); 437 OnRenderPDFPagesToMetafileDone(false);
443 return false; 438 return false;
444 } 439 }
445 std::vector<char> data(size); 440 std::vector<char> data(size);
446 if (file.ReadAtCurrentPos(data.data(), data.size()) != size) { 441 if (file.ReadAtCurrentPos(data.data(), data.size()) != size) {
447 OnRenderPDFPagesToMetafileDone(false); 442 OnRenderPDFPagesToMetafileDone(false);
448 return false; 443 return false;
449 } 444 }
450 if (!OnRenderPDFPagesToMetafilePageDone(data, scale_factor)) { 445 printing::Emf emf;
446 if (!emf.InitFromData(data.data(), data.size())) {
451 OnRenderPDFPagesToMetafileDone(false); 447 OnRenderPDFPagesToMetafileDone(false);
452 return false; 448 return false;
453 } 449 }
450 OnRenderPDFPagesToMetafilePageDone(scale_factor, emf);
454 return true; 451 return true;
455 } 452 }
OLDNEW
« no previous file with comments | « chrome/service/service_utility_process_host.h ('k') | components/printing/test/mock_printer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698