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

Side by Side Diff: chrome/service/cloud_print/print_system_win.cc

Issue 8553002: base::Bind: Convert chrome/service. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Win fix. Created 9 years, 1 month 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/cloud_print/print_system.h" 5 #include "chrome/service/cloud_print/print_system.h"
6 6
7 #include <objidl.h> 7 #include <objidl.h>
8 #include <winspool.h> 8 #include <winspool.h>
9 #include <xpsprint.h> 9 #include <xpsprint.h>
10 10
11 #include "base/bind.h"
11 #include "base/file_path.h" 12 #include "base/file_path.h"
12 #include "base/file_util.h" 13 #include "base/file_util.h"
13 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
14 #include "base/utf_string_conversions.h" 15 #include "base/utf_string_conversions.h"
15 #include "base/win/object_watcher.h" 16 #include "base/win/object_watcher.h"
16 #include "base/win/scoped_bstr.h" 17 #include "base/win/scoped_bstr.h"
17 #include "base/win/scoped_comptr.h" 18 #include "base/win/scoped_comptr.h"
18 #include "base/win/scoped_hdc.h" 19 #include "base/win/scoped_hdc.h"
19 #include "chrome/service/service_process.h" 20 #include "chrome/service/service_process.h"
20 #include "chrome/service/service_utility_process_host.h" 21 #include "chrome/service/service_utility_process_host.h"
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 range.to = last_page_printed_ + kPageCountPerBatch; 526 range.to = last_page_printed_ + kPageCountPerBatch;
526 std::vector<printing::PageRange> page_ranges; 527 std::vector<printing::PageRange> page_ranges;
527 page_ranges.push_back(range); 528 page_ranges.push_back(range);
528 529
529 int printer_dpi = ::GetDeviceCaps(printer_dc_.Get(), LOGPIXELSX); 530 int printer_dpi = ::GetDeviceCaps(printer_dc_.Get(), LOGPIXELSX);
530 int dc_width = GetDeviceCaps(printer_dc_.Get(), PHYSICALWIDTH); 531 int dc_width = GetDeviceCaps(printer_dc_.Get(), PHYSICALWIDTH);
531 int dc_height = GetDeviceCaps(printer_dc_.Get(), PHYSICALHEIGHT); 532 int dc_height = GetDeviceCaps(printer_dc_.Get(), PHYSICALHEIGHT);
532 gfx::Rect render_area(0, 0, dc_width, dc_height); 533 gfx::Rect render_area(0, 0, dc_width, dc_height);
533 g_service_process->io_thread()->message_loop_proxy()->PostTask( 534 g_service_process->io_thread()->message_loop_proxy()->PostTask(
534 FROM_HERE, 535 FROM_HERE,
535 NewRunnableMethod( 536 base::Bind(&JobSpoolerWin::Core::RenderPDFPagesInSandbox, this,
536 this, 537 print_data_file_path_, render_area, printer_dpi,
537 &JobSpoolerWin::Core::RenderPDFPagesInSandbox, 538 page_ranges, base::MessageLoopProxy::current()));
538 print_data_file_path_,
539 render_area,
540 printer_dpi,
541 page_ranges,
542 base::MessageLoopProxy::current()));
543 } 539 }
544 // Called on the service process IO thread. 540 // Called on the service process IO thread.
545 void RenderPDFPagesInSandbox( 541 void RenderPDFPagesInSandbox(
546 const FilePath& pdf_path, const gfx::Rect& render_area, 542 const FilePath& pdf_path, const gfx::Rect& render_area,
547 int render_dpi, const std::vector<printing::PageRange>& page_ranges, 543 int render_dpi, const std::vector<printing::PageRange>& page_ranges,
548 const scoped_refptr<base::MessageLoopProxy>& 544 const scoped_refptr<base::MessageLoopProxy>&
549 client_message_loop_proxy) { 545 client_message_loop_proxy) {
550 DCHECK(g_service_process->io_thread()->message_loop_proxy()-> 546 DCHECK(g_service_process->io_thread()->message_loop_proxy()->
551 BelongsToCurrentThread()); 547 BelongsToCurrentThread());
552 scoped_ptr<ServiceUtilityProcessHost> utility_host( 548 scoped_ptr<ServiceUtilityProcessHost> utility_host(
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 class PrinterCapsHandler : public ServiceUtilityProcessHost::Client { 648 class PrinterCapsHandler : public ServiceUtilityProcessHost::Client {
653 public: 649 public:
654 PrinterCapsHandler( 650 PrinterCapsHandler(
655 const std::string& printer_name, 651 const std::string& printer_name,
656 PrinterCapsAndDefaultsCallback* callback) 652 PrinterCapsAndDefaultsCallback* callback)
657 : printer_name_(printer_name), callback_(callback) { 653 : printer_name_(printer_name), callback_(callback) {
658 } 654 }
659 virtual void Start() { 655 virtual void Start() {
660 g_service_process->io_thread()->message_loop_proxy()->PostTask( 656 g_service_process->io_thread()->message_loop_proxy()->PostTask(
661 FROM_HERE, 657 FROM_HERE,
662 NewRunnableMethod( 658 base::Bind(&PrinterCapsHandler::GetPrinterCapsAndDefaultsImpl, this,
663 this, 659 base::MessageLoopProxy::current()));
664 &PrinterCapsHandler::GetPrinterCapsAndDefaultsImpl,
665 base::MessageLoopProxy::current()));
666 } 660 }
667 661
668 virtual void OnChildDied() { 662 virtual void OnChildDied() {
669 OnGetPrinterCapsAndDefaultsFailed(printer_name_); 663 OnGetPrinterCapsAndDefaultsFailed(printer_name_);
670 } 664 }
671 virtual void OnGetPrinterCapsAndDefaultsSucceeded( 665 virtual void OnGetPrinterCapsAndDefaultsSucceeded(
672 const std::string& printer_name, 666 const std::string& printer_name,
673 const printing::PrinterCapsAndDefaults& caps_and_defaults) { 667 const printing::PrinterCapsAndDefaults& caps_and_defaults) {
674 callback_->Run(true, printer_name, caps_and_defaults); 668 callback_->Run(true, printer_name, caps_and_defaults);
675 callback_.reset(); 669 callback_.reset();
(...skipping 16 matching lines...) Expand all
692 DCHECK(g_service_process->io_thread()->message_loop_proxy()-> 686 DCHECK(g_service_process->io_thread()->message_loop_proxy()->
693 BelongsToCurrentThread()); 687 BelongsToCurrentThread());
694 scoped_ptr<ServiceUtilityProcessHost> utility_host( 688 scoped_ptr<ServiceUtilityProcessHost> utility_host(
695 new ServiceUtilityProcessHost(this, client_message_loop_proxy)); 689 new ServiceUtilityProcessHost(this, client_message_loop_proxy));
696 if (utility_host->StartGetPrinterCapsAndDefaults(printer_name_)) { 690 if (utility_host->StartGetPrinterCapsAndDefaults(printer_name_)) {
697 // The object will self-destruct when the child process dies. 691 // The object will self-destruct when the child process dies.
698 utility_host.release(); 692 utility_host.release();
699 } else { 693 } else {
700 client_message_loop_proxy->PostTask( 694 client_message_loop_proxy->PostTask(
701 FROM_HERE, 695 FROM_HERE,
702 NewRunnableMethod( 696 base::Bind(&PrinterCapsHandler::OnGetPrinterCapsAndDefaultsFailed,
703 this, 697 this, printer_name_));
704 &PrinterCapsHandler::OnGetPrinterCapsAndDefaultsFailed,
705 printer_name_));
706 } 698 }
707 } 699 }
708 700
709 std::string printer_name_; 701 std::string printer_name_;
710 scoped_ptr<PrinterCapsAndDefaultsCallback> callback_; 702 scoped_ptr<PrinterCapsAndDefaultsCallback> callback_;
711 }; 703 };
712 704
713 705
714 virtual PrintSystem::PrintServerWatcher* CreatePrintServerWatcher(); 706 virtual PrintSystem::PrintServerWatcher* CreatePrintServerWatcher();
715 virtual PrintSystem::PrinterWatcher* CreatePrinterWatcher( 707 virtual PrintSystem::PrinterWatcher* CreatePrinterWatcher(
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 RpcStringFree(reinterpret_cast<RPC_WSTR *>(&proxy_id_as_string)); 868 RpcStringFree(reinterpret_cast<RPC_WSTR *>(&proxy_id_as_string));
877 return ret; 869 return ret;
878 } 870 }
879 871
880 scoped_refptr<PrintSystem> PrintSystem::CreateInstance( 872 scoped_refptr<PrintSystem> PrintSystem::CreateInstance(
881 const base::DictionaryValue* print_system_settings) { 873 const base::DictionaryValue* print_system_settings) {
882 return new PrintSystemWin; 874 return new PrintSystemWin;
883 } 875 }
884 876
885 } // namespace cloud_print 877 } // namespace cloud_print
OLDNEW
« no previous file with comments | « chrome/service/cloud_print/print_system_cups.cc ('k') | chrome/service/cloud_print/printer_job_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698