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

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: Build 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"
csilv 2011/11/19 01:33:57 add bind/bind_helpers.h
James Hawkins 2011/11/19 01:49:35 Done.
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/md5.h" 10 #include "base/md5.h"
11 #include "base/stringprintf.h" 11 #include "base/stringprintf.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "chrome/common/net/http_return.h" 14 #include "chrome/common/net/http_return.h"
15 #include "chrome/service/cloud_print/cloud_print_consts.h" 15 #include "chrome/service/cloud_print/cloud_print_consts.h"
16 #include "chrome/service/cloud_print/cloud_print_helpers.h" 16 #include "chrome/service/cloud_print/cloud_print_helpers.h"
17 #include "chrome/service/cloud_print/job_status_updater.h" 17 #include "chrome/service/cloud_print/job_status_updater.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 return false; 154 return false;
155 } 155 }
156 156
157 VLOG(1) << "CP_CONNECTOR: Update printer info, id: " 157 VLOG(1) << "CP_CONNECTOR: Update printer info, id: "
158 << printer_info_cloud_.printer_id; 158 << printer_info_cloud_.printer_id;
159 // We need to update the parts of the printer info that have changed 159 // We need to update the parts of the printer info that have changed
160 // (could be printer name, description, status or capabilities). 160 // (could be printer name, description, status or capabilities).
161 // First asynchronously fetch the capabilities. 161 // First asynchronously fetch the capabilities.
162 printing::PrinterBasicInfo printer_info; 162 printing::PrinterBasicInfo printer_info;
163 printer_watcher_->GetCurrentPrinterInfo(&printer_info); 163 printer_watcher_->GetCurrentPrinterInfo(&printer_info);
164 cloud_print::PrintSystem::PrinterCapsAndDefaultsCallback* callback = 164
165 NewCallback(this, 165 // 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. 166 // continue in OnReceivePrinterCaps.
169 print_system_->GetPrinterCapsAndDefaults( 167 print_system_->GetPrinterCapsAndDefaults(
170 printer_info.printer_name.c_str(), callback); 168 printer_info.printer_name.c_str(),
169 base::Bind(&PrinterJobHandler::OnReceivePrinterCaps,
170 base::Unretained(this)));
171
171 // While we are waiting for the data, pretend we have work to do and return 172 // While we are waiting for the data, pretend we have work to do and return
172 // true. 173 // true.
173 return true; 174 return true;
174 } 175 }
175 176
176 void PrinterJobHandler::OnReceivePrinterCaps( 177 void PrinterJobHandler::OnReceivePrinterCaps(
177 bool succeeded, 178 bool succeeded,
178 const std::string& printer_name, 179 const std::string& printer_name,
179 const printing::PrinterCapsAndDefaults& caps_and_defaults) { 180 const printing::PrinterCapsAndDefaults& caps_and_defaults) {
180 printing::PrinterBasicInfo printer_info; 181 printing::PrinterBasicInfo printer_info;
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 job_handler_message_loop_proxy_->PostTask( 641 job_handler_message_loop_proxy_->PostTask(
641 FROM_HERE, base::Bind(&PrinterJobHandler::JobSpooled, this, job_id)); 642 FROM_HERE, base::Bind(&PrinterJobHandler::JobSpooled, this, job_id));
642 } 643 }
643 644
644 void PrinterJobHandler::OnJobSpoolFailed() { 645 void PrinterJobHandler::OnJobSpoolFailed() {
645 DCHECK(MessageLoop::current() == print_thread_.message_loop()); 646 DCHECK(MessageLoop::current() == print_thread_.message_loop());
646 job_spooler_ = NULL; 647 job_spooler_ = NULL;
647 job_handler_message_loop_proxy_->PostTask( 648 job_handler_message_loop_proxy_->PostTask(
648 FROM_HERE, base::Bind(&PrinterJobHandler::JobFailed, this, PRINT_FAILED)); 649 FROM_HERE, base::Bind(&PrinterJobHandler::JobFailed, this, PRINT_FAILED));
649 } 650 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698