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

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

Issue 2519002: Redesign cloud printing subsystem layer. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 10 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/cloud_print_proxy_backend.h" 5 #include "chrome/service/cloud_print/cloud_print_proxy_backend.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/md5.h" 8 #include "base/md5.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "chrome/service/cloud_print/cloud_print_consts.h" 12 #include "chrome/service/cloud_print/cloud_print_consts.h"
13 #include "chrome/service/cloud_print/cloud_print_helpers.h" 13 #include "chrome/service/cloud_print/cloud_print_helpers.h"
14 #include "chrome/service/cloud_print/printer_job_handler.h" 14 #include "chrome/service/cloud_print/printer_job_handler.h"
15 #include "chrome/common/net/notifier/listener/talk_mediator_impl.h" 15 #include "chrome/common/net/notifier/listener/talk_mediator_impl.h"
16 #include "chrome/service/gaia/service_gaia_authenticator.h" 16 #include "chrome/service/gaia/service_gaia_authenticator.h"
17 #include "chrome/service/net/service_network_change_notifier_thread.h" 17 #include "chrome/service/net/service_network_change_notifier_thread.h"
18 #include "chrome/service/service_process.h" 18 #include "chrome/service/service_process.h"
19 19
20 #include "googleurl/src/gurl.h" 20 #include "googleurl/src/gurl.h"
21 #include "net/url_request/url_request_status.h" 21 #include "net/url_request/url_request_status.h"
22 22
23 // The real guts of SyncBackendHost, to keep the public client API clean. 23 // The real guts of SyncBackendHost, to keep the public client API clean.
24 class CloudPrintProxyBackend::Core 24 class CloudPrintProxyBackend::Core
25 : public base::RefCountedThreadSafe<CloudPrintProxyBackend::Core>, 25 : public base::RefCountedThreadSafe<CloudPrintProxyBackend::Core>,
26 public URLFetcherDelegate, 26 public URLFetcherDelegate,
27 public cloud_print::PrinterChangeNotifierDelegate, 27 public cloud_print::PrintServerWatcherDelegate,
28 public PrinterJobHandlerDelegate, 28 public PrinterJobHandlerDelegate,
29 public notifier::TalkMediator::Delegate { 29 public notifier::TalkMediator::Delegate {
30 public: 30 public:
31 explicit Core(CloudPrintProxyBackend* backend, 31 explicit Core(CloudPrintProxyBackend* backend,
32 const GURL& cloud_print_server_url); 32 const GURL& cloud_print_server_url);
33
33 // Note: 34 // Note:
34 // 35 //
35 // The Do* methods are the various entry points from CloudPrintProxyBackend 36 // The Do* methods are the various entry points from CloudPrintProxyBackend
36 // It calls us on a dedicated thread to actually perform synchronous 37 // It calls us on a dedicated thread to actually perform synchronous
37 // (and potentially blocking) syncapi operations. 38 // (and potentially blocking) syncapi operations.
38 // 39 //
39 // Called on the CloudPrintProxyBackend core_thread_ to perform 40 // Called on the CloudPrintProxyBackend core_thread_ to perform
40 // initialization. When we are passed in an LSID we authenticate using that 41 // initialization. When we are passed in an LSID we authenticate using that
41 // and retrieve new auth tokens. 42 // and retrieve new auth tokens.
42 void DoInitializeWithLsid(const std::string& lsid, 43 void DoInitializeWithLsid(const std::string& lsid,
43 const std::string& proxy_id); 44 const std::string& proxy_id);
44 void DoInitializeWithToken(const std::string cloud_print_token, 45 void DoInitializeWithToken(const std::string cloud_print_token,
45 const std::string cloud_print_xmpp_token, 46 const std::string cloud_print_xmpp_token,
46 const std::string email, 47 const std::string email,
47 const std::string& proxy_id); 48 const std::string& proxy_id);
48 49
49 // Called on the CloudPrintProxyBackend core_thread_ to perform 50 // Called on the CloudPrintProxyBackend core_thread_ to perform
50 // shutdown. 51 // shutdown.
51 void DoShutdown(); 52 void DoShutdown();
52 void DoRegisterSelectedPrinters( 53 void DoRegisterSelectedPrinters(
53 const cloud_print::PrinterList& printer_list); 54 const cloud_print::PrinterList& printer_list);
54 void DoHandlePrinterNotification(const std::string& printer_id); 55 void DoHandlePrinterNotification(const std::string& printer_id);
55 56
56 // URLFetcher::Delegate implementation. 57 // URLFetcher::Delegate implementation.
57 virtual void OnURLFetchComplete(const URLFetcher* source, const GURL& url, 58 virtual void OnURLFetchComplete(const URLFetcher* source, const GURL& url,
58 const URLRequestStatus& status, 59 const URLRequestStatus& status,
59 int response_code, 60 int response_code,
60 const ResponseCookies& cookies, 61 const ResponseCookies& cookies,
61 const std::string& data); 62 const std::string& data);
62 // cloud_print::PrinterChangeNotifier::Delegate implementation 63 // cloud_print::PrintServerWatcherDelegate implementation
63 virtual void OnPrinterAdded(); 64 virtual void OnPrinterAdded();
64 virtual void OnPrinterDeleted() {
65 }
66 virtual void OnPrinterChanged() {
67 }
68 virtual void OnJobChanged() {
69 }
70 // PrinterJobHandler::Delegate implementation 65 // PrinterJobHandler::Delegate implementation
71 void OnPrinterJobHandlerShutdown(PrinterJobHandler* job_handler, 66 void OnPrinterJobHandlerShutdown(PrinterJobHandler* job_handler,
72 const std::string& printer_id); 67 const std::string& printer_id);
73 68
74 // notifier::TalkMediator::Delegate implementation. 69 // notifier::TalkMediator::Delegate implementation.
75 virtual void OnNotificationStateChange( 70 virtual void OnNotificationStateChange(
76 bool notifications_enabled); 71 bool notifications_enabled);
77 72
78 virtual void OnIncomingNotification( 73 virtual void OnIncomingNotification(
79 const IncomingNotificationData& notification_data); 74 const IncomingNotificationData& notification_data);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 bool RemovePrinterFromList(const std::string& printer_name); 119 bool RemovePrinterFromList(const std::string& printer_name);
125 // Initializes a job handler object for the specified printer. The job 120 // Initializes a job handler object for the specified printer. The job
126 // handler is responsible for checking for pending print jobs for this 121 // handler is responsible for checking for pending print jobs for this
127 // printer and print them. 122 // printer and print them.
128 void InitJobHandlerForPrinter(DictionaryValue* printer_data); 123 void InitJobHandlerForPrinter(DictionaryValue* printer_data);
129 124
130 // Our parent CloudPrintProxyBackend 125 // Our parent CloudPrintProxyBackend
131 CloudPrintProxyBackend* backend_; 126 CloudPrintProxyBackend* backend_;
132 127
133 GURL cloud_print_server_url_; 128 GURL cloud_print_server_url_;
129 // Pointer to current print system.
130 scoped_refptr<cloud_print::PrintSystem> print_system_;
134 // The list of printers to be registered with the cloud print server. 131 // The list of printers to be registered with the cloud print server.
135 // To begin with,this list is initialized with the list of local and network 132 // To begin with,this list is initialized with the list of local and network
136 // printers available. Then we query the server for the list of printers 133 // printers available. Then we query the server for the list of printers
137 // already registered. We trim this list to remove the printers already 134 // already registered. We trim this list to remove the printers already
138 // registered. We then pass a copy of this list to the frontend to give the 135 // registered. We then pass a copy of this list to the frontend to give the
139 // user a chance to further trim the list. When the frontend gives us the 136 // user a chance to further trim the list. When the frontend gives us the
140 // final list we make a copy into this so that we can start registering. 137 // final list we make a copy into this so that we can start registering.
141 cloud_print::PrinterList printer_list_; 138 cloud_print::PrinterList printer_list_;
142 // The URLFetcher instance for the current request 139 // The URLFetcher instance for the current request
143 scoped_ptr<URLFetcher> request_; 140 scoped_ptr<URLFetcher> request_;
144 // The index of the nex printer to be uploaded. 141 // The index of the nex printer to be uploaded.
145 size_t next_upload_index_; 142 size_t next_upload_index_;
146 // The unique id for this proxy 143 // The unique id for this proxy
147 std::string proxy_id_; 144 std::string proxy_id_;
148 // The GAIA auth token 145 // The GAIA auth token
149 std::string auth_token_; 146 std::string auth_token_;
150 // The number of consecutive times that connecting to the server failed. 147 // The number of consecutive times that connecting to the server failed.
151 int server_error_count_; 148 int server_error_count_;
152 // Cached info about the last printer that we tried to upload. We cache this 149 // Cached info about the last printer that we tried to upload. We cache this
153 // so we won't have to requery the printer if the upload fails and we need 150 // so we won't have to requery the printer if the upload fails and we need
154 // to retry. 151 // to retry.
155 std::string last_uploaded_printer_name_; 152 std::string last_uploaded_printer_name_;
156 cloud_print::PrinterCapsAndDefaults last_uploaded_printer_info_; 153 cloud_print::PrinterCapsAndDefaults last_uploaded_printer_info_;
157 // A map of printer id to job handler. 154 // A map of printer id to job handler.
158 typedef std::map<std::string, scoped_refptr<PrinterJobHandler> > 155 typedef std::map<std::string, scoped_refptr<PrinterJobHandler> >
159 JobHandlerMap; 156 JobHandlerMap;
160 JobHandlerMap job_handler_map_; 157 JobHandlerMap job_handler_map_;
161 ResponseHandler next_response_handler_; 158 ResponseHandler next_response_handler_;
162 cloud_print::PrinterChangeNotifier printer_change_notifier_; 159 scoped_refptr<cloud_print::PrintSystem::PrintServerWatcher>
160 print_server_watcher_;
163 bool new_printers_available_; 161 bool new_printers_available_;
164 // Notification (xmpp) handler. 162 // Notification (xmpp) handler.
165 scoped_ptr<notifier::TalkMediator> talk_mediator_; 163 scoped_ptr<notifier::TalkMediator> talk_mediator_;
166 164
167 DISALLOW_COPY_AND_ASSIGN(Core); 165 DISALLOW_COPY_AND_ASSIGN(Core);
168 }; 166 };
169 167
170 CloudPrintProxyBackend::CloudPrintProxyBackend( 168 CloudPrintProxyBackend::CloudPrintProxyBackend(
171 CloudPrintProxyFrontend* frontend, const GURL& cloud_print_server_url) 169 CloudPrintProxyFrontend* frontend, const GURL& cloud_print_server_url)
172 : core_thread_("Chrome_CloudPrintProxyCoreThread"), 170 : core_thread_("Chrome_CloudPrintProxyCoreThread"),
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 NewRunnableMethod( 226 NewRunnableMethod(
229 core_.get(), 227 core_.get(),
230 &CloudPrintProxyBackend::Core::DoHandlePrinterNotification, 228 &CloudPrintProxyBackend::Core::DoHandlePrinterNotification,
231 printer_id)); 229 printer_id));
232 } 230 }
233 231
234 CloudPrintProxyBackend::Core::Core(CloudPrintProxyBackend* backend, 232 CloudPrintProxyBackend::Core::Core(CloudPrintProxyBackend* backend,
235 const GURL& cloud_print_server_url) 233 const GURL& cloud_print_server_url)
236 : backend_(backend), cloud_print_server_url_(cloud_print_server_url), 234 : backend_(backend), cloud_print_server_url_(cloud_print_server_url),
237 next_upload_index_(0), server_error_count_(0), 235 next_upload_index_(0), server_error_count_(0),
238 next_response_handler_(NULL), new_printers_available_(false) { 236 next_response_handler_(NULL), new_printers_available_(false) {
239 } 237 }
240 238
241 void CloudPrintProxyBackend::Core::DoInitializeWithLsid( 239 void CloudPrintProxyBackend::Core::DoInitializeWithLsid(
242 const std::string& lsid, const std::string& proxy_id) { 240 const std::string& lsid, const std::string& proxy_id) {
243 DCHECK(MessageLoop::current() == backend_->core_thread_.message_loop()); 241 DCHECK(MessageLoop::current() == backend_->core_thread_.message_loop());
244 // Since Talk does not accept a Cloud Print token, for now, we make 2 auth 242 // Since Talk does not accept a Cloud Print token, for now, we make 2 auth
245 // requests, one for the chromiumsync service and another for print. This is 243 // requests, one for the chromiumsync service and another for print. This is
246 // temporary and should be removed once Talk supports our token. 244 // temporary and should be removed once Talk supports our token.
247 // Note: The GAIA login is synchronous but that should be OK because we are in 245 // Note: The GAIA login is synchronous but that should be OK because we are in
248 // the CloudPrintProxyCoreThread and we cannot really do anything else until 246 // the CloudPrintProxyCoreThread and we cannot really do anything else until
(...skipping 23 matching lines...) Expand all
272 proxy_id); 270 proxy_id);
273 } 271 }
274 } 272 }
275 } 273 }
276 274
277 void CloudPrintProxyBackend::Core::DoInitializeWithToken( 275 void CloudPrintProxyBackend::Core::DoInitializeWithToken(
278 const std::string cloud_print_token, 276 const std::string cloud_print_token,
279 const std::string cloud_print_xmpp_token, 277 const std::string cloud_print_xmpp_token,
280 const std::string email, const std::string& proxy_id) { 278 const std::string email, const std::string& proxy_id) {
281 DCHECK(MessageLoop::current() == backend_->core_thread_.message_loop()); 279 DCHECK(MessageLoop::current() == backend_->core_thread_.message_loop());
280
281 print_system_ = cloud_print::PrintSystem::CreateInstance();
282 if (!print_system_.get()) {
283 NOTREACHED();
284 return; // No print system available, fail initalization.
285 }
286
282 // TODO(sanjeevr): Validate the tokens. 287 // TODO(sanjeevr): Validate the tokens.
283 auth_token_ = cloud_print_token; 288 auth_token_ = cloud_print_token;
284 talk_mediator_.reset(new notifier::TalkMediatorImpl( 289 talk_mediator_.reset(new notifier::TalkMediatorImpl(
285 g_service_process->network_change_notifier_thread(), false)); 290 g_service_process->network_change_notifier_thread(), false));
286 talk_mediator_->AddSubscribedServiceUrl(kCloudPrintTalkServiceUrl); 291 talk_mediator_->AddSubscribedServiceUrl(kCloudPrintTalkServiceUrl);
287 talk_mediator_->SetDelegate(this); 292 talk_mediator_->SetDelegate(this);
288 talk_mediator_->SetAuthToken(email, cloud_print_xmpp_token, 293 talk_mediator_->SetAuthToken(email, cloud_print_xmpp_token,
289 kSyncGaiaServiceId); 294 kSyncGaiaServiceId);
290 talk_mediator_->Login(); 295 talk_mediator_->Login();
291 printer_change_notifier_.StartWatching(std::string(), this); 296
297 print_server_watcher_ = print_system_->CreatePrintServerWatcher();
298 print_server_watcher_->StartWatching(this);
299
292 proxy_id_ = proxy_id; 300 proxy_id_ = proxy_id;
293 StartRegistration(); 301 StartRegistration();
294 } 302 }
295 303
296 void CloudPrintProxyBackend::Core::StartRegistration() { 304 void CloudPrintProxyBackend::Core::StartRegistration() {
297 printer_list_.clear(); 305 printer_list_.clear();
298 cloud_print::EnumeratePrinters(&printer_list_); 306 print_system_->EnumeratePrinters(&printer_list_);
299 server_error_count_ = 0; 307 server_error_count_ = 0;
300 // Now we need to ask the server about printers that were registered on the 308 // Now we need to ask the server about printers that were registered on the
301 // server so that we can trim this list. 309 // server so that we can trim this list.
302 GetRegisteredPrinters(); 310 GetRegisteredPrinters();
303 } 311 }
304 312
305 void CloudPrintProxyBackend::Core::EndRegistration() { 313 void CloudPrintProxyBackend::Core::EndRegistration() {
306 request_.reset(); 314 request_.reset();
307 if (new_printers_available_) { 315 if (new_printers_available_) {
308 new_printers_available_ = false; 316 new_printers_available_ = false;
309 StartRegistration(); 317 StartRegistration();
310 } 318 }
311 } 319 }
312 320
313 void CloudPrintProxyBackend::Core::DoShutdown() { 321 void CloudPrintProxyBackend::Core::DoShutdown() {
322 if (print_server_watcher_ != NULL)
323 print_server_watcher_->StopWatching();
324
314 // Need to kill all running jobs. 325 // Need to kill all running jobs.
315 while (!job_handler_map_.empty()) { 326 while (!job_handler_map_.empty()) {
316 JobHandlerMap::iterator index = job_handler_map_.begin(); 327 JobHandlerMap::iterator index = job_handler_map_.begin();
317 // Shutdown will call our OnPrinterJobHandlerShutdown method which will 328 // Shutdown will call our OnPrinterJobHandlerShutdown method which will
318 // remove this from the map. 329 // remove this from the map.
319 index->second->Shutdown(); 330 index->second->Shutdown();
320 } 331 }
321 } 332 }
322 333
323 void CloudPrintProxyBackend::Core::DoRegisterSelectedPrinters( 334 void CloudPrintProxyBackend::Core::DoRegisterSelectedPrinters(
324 const cloud_print::PrinterList& printer_list) { 335 const cloud_print::PrinterList& printer_list) {
336 if (!print_system_.get())
337 return; // No print system available.
325 server_error_count_ = 0; 338 server_error_count_ = 0;
326 printer_list_.assign(printer_list.begin(), printer_list.end()); 339 printer_list_.assign(printer_list.begin(), printer_list.end());
327 DCHECK(MessageLoop::current() == backend_->core_thread_.message_loop()); 340 DCHECK(MessageLoop::current() == backend_->core_thread_.message_loop());
328 next_upload_index_ = 0; 341 next_upload_index_ = 0;
329 RegisterNextPrinter(); 342 RegisterNextPrinter();
330 } 343 }
331 344
332 void CloudPrintProxyBackend::Core::DoHandlePrinterNotification( 345 void CloudPrintProxyBackend::Core::DoHandlePrinterNotification(
333 const std::string& printer_id) { 346 const std::string& printer_id) {
334 JobHandlerMap::iterator index = job_handler_map_.find(printer_id); 347 JobHandlerMap::iterator index = job_handler_map_.find(printer_id);
(...skipping 16 matching lines...) Expand all
351 void CloudPrintProxyBackend::Core::RegisterNextPrinter() { 364 void CloudPrintProxyBackend::Core::RegisterNextPrinter() {
352 // For the next printer to be uploaded, create a multi-part post request to 365 // For the next printer to be uploaded, create a multi-part post request to
353 // upload the printer capabilities and the printer defaults. 366 // upload the printer capabilities and the printer defaults.
354 if (next_upload_index_ < printer_list_.size()) { 367 if (next_upload_index_ < printer_list_.size()) {
355 const cloud_print::PrinterBasicInfo& info = 368 const cloud_print::PrinterBasicInfo& info =
356 printer_list_.at(next_upload_index_); 369 printer_list_.at(next_upload_index_);
357 bool have_printer_info = true; 370 bool have_printer_info = true;
358 // If we are retrying a previous upload, we don't need to fetch the caps 371 // If we are retrying a previous upload, we don't need to fetch the caps
359 // and defaults again. 372 // and defaults again.
360 if (info.printer_name != last_uploaded_printer_name_) { 373 if (info.printer_name != last_uploaded_printer_name_) {
361 have_printer_info = cloud_print::GetPrinterCapsAndDefaults( 374 have_printer_info = print_system_->GetPrinterCapsAndDefaults(
362 info.printer_name.c_str(), &last_uploaded_printer_info_); 375 info.printer_name.c_str(), &last_uploaded_printer_info_);
363 } 376 }
364 if (have_printer_info) { 377 if (have_printer_info) {
365 last_uploaded_printer_name_ = info.printer_name; 378 last_uploaded_printer_name_ = info.printer_name;
366 std::string mime_boundary; 379 std::string mime_boundary;
367 CloudPrintHelpers::CreateMimeBoundaryForUpload(&mime_boundary); 380 CloudPrintHelpers::CreateMimeBoundaryForUpload(&mime_boundary);
368 std::string post_data; 381 std::string post_data;
369 CloudPrintHelpers::AddMultipartValueForUpload(kProxyIdValue, proxy_id_, 382 CloudPrintHelpers::AddMultipartValueForUpload(kProxyIdValue, proxy_id_,
370 mime_boundary, 383 mime_boundary,
371 std::string(), &post_data); 384 std::string(), &post_data);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 new URLFetcher( 429 new URLFetcher(
417 CloudPrintHelpers::GetUrlForPrinterRegistration( 430 CloudPrintHelpers::GetUrlForPrinterRegistration(
418 cloud_print_server_url_), 431 cloud_print_server_url_),
419 URLFetcher::POST, this)); 432 URLFetcher::POST, this));
420 CloudPrintHelpers::PrepCloudPrintRequest(request_.get(), auth_token_); 433 CloudPrintHelpers::PrepCloudPrintRequest(request_.get(), auth_token_);
421 request_->set_upload_data(mime_type, post_data); 434 request_->set_upload_data(mime_type, post_data);
422 next_response_handler_ = 435 next_response_handler_ =
423 &CloudPrintProxyBackend::Core::HandleRegisterPrinterResponse; 436 &CloudPrintProxyBackend::Core::HandleRegisterPrinterResponse;
424 request_->Start(); 437 request_->Start();
425 } else { 438 } else {
426 NOTREACHED(); 439 LOG(ERROR) << "CP: Failed to get printer info for: " << info.printer_name;
440 next_upload_index_++;
441 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod(this,
442 &CloudPrintProxyBackend::Core::RegisterNextPrinter));
427 } 443 }
428 } else { 444 } else {
429 EndRegistration(); 445 EndRegistration();
430 } 446 }
431 } 447 }
432 448
433 // URLFetcher::Delegate implementation. 449 // URLFetcher::Delegate implementation.
434 void CloudPrintProxyBackend::Core::OnURLFetchComplete( 450 void CloudPrintProxyBackend::Core::OnURLFetchComplete(
435 const URLFetcher* source, const GURL& url, const URLRequestStatus& status, 451 const URLFetcher* source, const GURL& url, const URLRequestStatus& status,
436 int response_code, const ResponseCookies& cookies, 452 int response_code, const ResponseCookies& cookies,
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 DCHECK(!printer_info.printer_name.empty()); 534 DCHECK(!printer_info.printer_name.empty());
519 printer_data->GetString(UTF8ToWide(kPrinterDescValue), 535 printer_data->GetString(UTF8ToWide(kPrinterDescValue),
520 &printer_info.printer_description); 536 &printer_info.printer_description);
521 printer_data->GetInteger(UTF8ToWide(kPrinterStatusValue), 537 printer_data->GetInteger(UTF8ToWide(kPrinterStatusValue),
522 &printer_info.printer_status); 538 &printer_info.printer_status);
523 std::string caps_hash; 539 std::string caps_hash;
524 printer_data->GetString(kPrinterCapsHashValue, &caps_hash); 540 printer_data->GetString(kPrinterCapsHashValue, &caps_hash);
525 scoped_refptr<PrinterJobHandler> job_handler; 541 scoped_refptr<PrinterJobHandler> job_handler;
526 job_handler = new PrinterJobHandler(printer_info, printer_id, caps_hash, 542 job_handler = new PrinterJobHandler(printer_info, printer_id, caps_hash,
527 auth_token_, cloud_print_server_url_, 543 auth_token_, cloud_print_server_url_,
528 this); 544 print_system_.get(), this);
529 job_handler_map_[printer_id] = job_handler; 545 job_handler_map_[printer_id] = job_handler;
530 job_handler->Initialize(); 546 job_handler->Initialize();
531 } 547 }
532 } 548 }
533 549
534 void CloudPrintProxyBackend::Core::HandleRegisterPrinterResponse( 550 void CloudPrintProxyBackend::Core::HandleRegisterPrinterResponse(
535 const URLFetcher* source, const GURL& url, const URLRequestStatus& status, 551 const URLFetcher* source, const GURL& url, const URLRequestStatus& status,
536 int response_code, const ResponseCookies& cookies, 552 int response_code, const ResponseCookies& cookies,
537 const std::string& data) { 553 const std::string& data) {
538 Task* next_task = 554 Task* next_task =
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 StartRegistration(); 625 StartRegistration();
610 } 626 }
611 } 627 }
612 628
613 // PrinterJobHandler::Delegate implementation 629 // PrinterJobHandler::Delegate implementation
614 void CloudPrintProxyBackend::Core::OnPrinterJobHandlerShutdown( 630 void CloudPrintProxyBackend::Core::OnPrinterJobHandlerShutdown(
615 PrinterJobHandler* job_handler, const std::string& printer_id) { 631 PrinterJobHandler* job_handler, const std::string& printer_id) {
616 job_handler_map_.erase(printer_id); 632 job_handler_map_.erase(printer_id);
617 } 633 }
618 634
OLDNEW
« no previous file with comments | « chrome/service/cloud_print/cloud_print_proxy_backend.h ('k') | chrome/service/cloud_print/job_status_updater.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698