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

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

Issue 8600007: base::Bind: Convert chrome/service/cloud_print. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase and review fixes. 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/printer_job_handler.h" 5 #include "chrome/service/cloud_print/printer_job_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h"
8 #include "base/file_util.h" 9 #include "base/file_util.h"
9 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
10 #include "base/md5.h" 11 #include "base/md5.h"
11 #include "base/stringprintf.h" 12 #include "base/stringprintf.h"
12 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
13 #include "base/values.h" 14 #include "base/values.h"
14 #include "chrome/common/net/http_return.h" 15 #include "chrome/common/net/http_return.h"
15 #include "chrome/service/cloud_print/cloud_print_consts.h" 16 #include "chrome/service/cloud_print/cloud_print_consts.h"
16 #include "chrome/service/cloud_print/cloud_print_helpers.h" 17 #include "chrome/service/cloud_print/cloud_print_helpers.h"
17 #include "chrome/service/cloud_print/job_status_updater.h" 18 #include "chrome/service/cloud_print/job_status_updater.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 return false; 155 return false;
155 } 156 }
156 157
157 VLOG(1) << "CP_CONNECTOR: Update printer info, id: " 158 VLOG(1) << "CP_CONNECTOR: Update printer info, id: "
158 << printer_info_cloud_.printer_id; 159 << printer_info_cloud_.printer_id;
159 // We need to update the parts of the printer info that have changed 160 // We need to update the parts of the printer info that have changed
160 // (could be printer name, description, status or capabilities). 161 // (could be printer name, description, status or capabilities).
161 // First asynchronously fetch the capabilities. 162 // First asynchronously fetch the capabilities.
162 printing::PrinterBasicInfo printer_info; 163 printing::PrinterBasicInfo printer_info;
163 printer_watcher_->GetCurrentPrinterInfo(&printer_info); 164 printer_watcher_->GetCurrentPrinterInfo(&printer_info);
164 cloud_print::PrintSystem::PrinterCapsAndDefaultsCallback* callback = 165
165 NewCallback(this, 166 // Asynchronously fetch the printer caps and defaults. The story will
166 &PrinterJobHandler::OnReceivePrinterCaps);
167 // Asnchronously fetch the printer caps and defaults. The story will
168 // continue in OnReceivePrinterCaps. 167 // continue in OnReceivePrinterCaps.
169 print_system_->GetPrinterCapsAndDefaults( 168 print_system_->GetPrinterCapsAndDefaults(
170 printer_info.printer_name.c_str(), callback); 169 printer_info.printer_name.c_str(),
170 base::Bind(&PrinterJobHandler::OnReceivePrinterCaps,
171 base::Unretained(this)));
172
171 // While we are waiting for the data, pretend we have work to do and return 173 // While we are waiting for the data, pretend we have work to do and return
172 // true. 174 // true.
173 return true; 175 return true;
174 } 176 }
175 177
176 void PrinterJobHandler::OnReceivePrinterCaps( 178 void PrinterJobHandler::OnReceivePrinterCaps(
177 bool succeeded, 179 bool succeeded,
178 const std::string& printer_name, 180 const std::string& printer_name,
179 const printing::PrinterCapsAndDefaults& caps_and_defaults) { 181 const printing::PrinterCapsAndDefaults& caps_and_defaults) {
180 printing::PrinterBasicInfo printer_info; 182 printing::PrinterBasicInfo printer_info;
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 job_handler_message_loop_proxy_->PostTask( 642 job_handler_message_loop_proxy_->PostTask(
641 FROM_HERE, base::Bind(&PrinterJobHandler::JobSpooled, this, job_id)); 643 FROM_HERE, base::Bind(&PrinterJobHandler::JobSpooled, this, job_id));
642 } 644 }
643 645
644 void PrinterJobHandler::OnJobSpoolFailed() { 646 void PrinterJobHandler::OnJobSpoolFailed() {
645 DCHECK(MessageLoop::current() == print_thread_.message_loop()); 647 DCHECK(MessageLoop::current() == print_thread_.message_loop());
646 job_spooler_ = NULL; 648 job_spooler_ = NULL;
647 job_handler_message_loop_proxy_->PostTask( 649 job_handler_message_loop_proxy_->PostTask(
648 FROM_HERE, base::Bind(&PrinterJobHandler::JobFailed, this, PRINT_FAILED)); 650 FROM_HERE, base::Bind(&PrinterJobHandler::JobFailed, this, PRINT_FAILED));
649 } 651 }
OLDNEW
« no previous file with comments | « chrome/service/cloud_print/print_system_win.cc ('k') | chrome/service/service_utility_process_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698