OLD | NEW |
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/cloud_print/cloud_print_connector.h" | 5 #include "chrome/service/cloud_print/cloud_print_connector.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/md5.h" | 9 #include "base/md5.h" |
10 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
11 #include "base/string_number_conversions.h" | 11 #include "base/string_number_conversions.h" |
12 #include "base/string_split.h" | 12 #include "base/string_split.h" |
13 #include "base/stringprintf.h" | 13 #include "base/stringprintf.h" |
14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
15 #include "base/values.h" | 15 #include "base/values.h" |
| 16 #include "chrome/common/cloud_print/cloud_print_constants.h" |
16 #include "chrome/common/cloud_print/cloud_print_helpers.h" | 17 #include "chrome/common/cloud_print/cloud_print_helpers.h" |
17 #include "chrome/service/cloud_print/cloud_print_consts.h" | |
18 #include "chrome/service/cloud_print/cloud_print_helpers.h" | 18 #include "chrome/service/cloud_print/cloud_print_helpers.h" |
19 #include "grit/generated_resources.h" | 19 #include "grit/generated_resources.h" |
20 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
21 | 21 |
| 22 namespace cloud_print { |
| 23 |
22 CloudPrintConnector::CloudPrintConnector(Client* client, | 24 CloudPrintConnector::CloudPrintConnector(Client* client, |
23 const ConnectorSettings& settings) | 25 const ConnectorSettings& settings) |
24 : client_(client), | 26 : client_(client), |
25 next_response_handler_(NULL) { | 27 next_response_handler_(NULL) { |
26 settings_.CopyFrom(settings); | 28 settings_.CopyFrom(settings); |
27 } | 29 } |
28 | 30 |
29 bool CloudPrintConnector::InitPrintSystem() { | 31 bool CloudPrintConnector::InitPrintSystem() { |
30 if (print_system_.get()) | 32 if (print_system_.get()) |
31 return true; | 33 return true; |
32 print_system_ = cloud_print::PrintSystem::CreateInstance( | 34 print_system_ = PrintSystem::CreateInstance( |
33 settings_.print_system_settings()); | 35 settings_.print_system_settings()); |
34 if (!print_system_.get()) { | 36 if (!print_system_.get()) { |
35 NOTREACHED(); | 37 NOTREACHED(); |
36 return false; // No memory. | 38 return false; // No memory. |
37 } | 39 } |
38 cloud_print::PrintSystem::PrintSystemResult result = print_system_->Init(); | 40 PrintSystem::PrintSystemResult result = print_system_->Init(); |
39 if (!result.succeeded()) { | 41 if (!result.succeeded()) { |
40 print_system_ = NULL; | 42 print_system_ = NULL; |
41 // We could not initialize the print system. We need to notify the server. | 43 // We could not initialize the print system. We need to notify the server. |
42 ReportUserMessage(kPrintSystemFailedMessageId, result.message()); | 44 ReportUserMessage(kPrintSystemFailedMessageId, result.message()); |
43 return false; | 45 return false; |
44 } | 46 } |
45 return true; | 47 return true; |
46 } | 48 } |
47 | 49 |
48 bool CloudPrintConnector::Start() { | 50 bool CloudPrintConnector::Start() { |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 DCHECK(next_response_handler_); | 159 DCHECK(next_response_handler_); |
158 return (this->*next_response_handler_)(source, url, json_data, succeeded); | 160 return (this->*next_response_handler_)(source, url, json_data, succeeded); |
159 } | 161 } |
160 | 162 |
161 CloudPrintURLFetcher::ResponseAction CloudPrintConnector::OnRequestAuthError() { | 163 CloudPrintURLFetcher::ResponseAction CloudPrintConnector::OnRequestAuthError() { |
162 OnAuthError(); | 164 OnAuthError(); |
163 return CloudPrintURLFetcher::STOP_PROCESSING; | 165 return CloudPrintURLFetcher::STOP_PROCESSING; |
164 } | 166 } |
165 | 167 |
166 std::string CloudPrintConnector::GetAuthHeader() { | 168 std::string CloudPrintConnector::GetAuthHeader() { |
167 return CloudPrintHelpers::GetCloudPrintAuthHeaderFromStore(); | 169 return GetCloudPrintAuthHeaderFromStore(); |
168 } | 170 } |
169 | 171 |
170 CloudPrintConnector::~CloudPrintConnector() {} | 172 CloudPrintConnector::~CloudPrintConnector() {} |
171 | 173 |
172 CloudPrintURLFetcher::ResponseAction | 174 CloudPrintURLFetcher::ResponseAction |
173 CloudPrintConnector::HandlePrinterListResponse( | 175 CloudPrintConnector::HandlePrinterListResponse( |
174 const net::URLFetcher* source, | 176 const net::URLFetcher* source, |
175 const GURL& url, | 177 const GURL& url, |
176 DictionaryValue* json_data, | 178 DictionaryValue* json_data, |
177 bool succeeded) { | 179 bool succeeded) { |
178 DCHECK(succeeded); | 180 DCHECK(succeeded); |
179 if (!succeeded) | 181 if (!succeeded) |
180 return CloudPrintURLFetcher::RETRY_REQUEST; | 182 return CloudPrintURLFetcher::RETRY_REQUEST; |
181 | 183 |
182 // Now we need to get the list of printers from the print system | 184 // Now we need to get the list of printers from the print system |
183 // and split printers into 3 categories: | 185 // and split printers into 3 categories: |
184 // - existing and registered printers | 186 // - existing and registered printers |
185 // - new printers | 187 // - new printers |
186 // - deleted printers | 188 // - deleted printers |
187 | 189 |
188 // Get list of the printers from the print system. | 190 // Get list of the printers from the print system. |
189 printing::PrinterList local_printers; | 191 printing::PrinterList local_printers; |
190 cloud_print::PrintSystem::PrintSystemResult result = | 192 PrintSystem::PrintSystemResult result = |
191 print_system_->EnumeratePrinters(&local_printers); | 193 print_system_->EnumeratePrinters(&local_printers); |
192 bool full_list = result.succeeded(); | 194 bool full_list = result.succeeded(); |
193 if (!full_list) { | 195 if (!full_list) { |
194 std::string message = result.message(); | 196 std::string message = result.message(); |
195 if (message.empty()) | 197 if (message.empty()) |
196 message = l10n_util::GetStringFUTF8(IDS_CLOUD_PRINT_ENUM_FAILED, | 198 message = l10n_util::GetStringFUTF8(IDS_CLOUD_PRINT_ENUM_FAILED, |
197 l10n_util::GetStringUTF16(IDS_GOOGLE_CLOUD_PRINT)); | 199 l10n_util::GetStringUTF16(IDS_GOOGLE_CLOUD_PRINT)); |
198 // There was a failure enumerating printers. Send a message to the server. | 200 // There was a failure enumerating printers. Send a message to the server. |
199 ReportUserMessage(kEnumPrintersFailedMessageId, message); | 201 ReportUserMessage(kEnumPrintersFailedMessageId, message); |
200 } | 202 } |
201 | 203 |
202 // Go through the list of the cloud printers and init print job handlers. | 204 // Go through the list of the cloud printers and init print job handlers. |
203 ListValue* printer_list = NULL; | 205 ListValue* printer_list = NULL; |
204 // There may be no "printers" value in the JSON | 206 // There may be no "printers" value in the JSON |
205 if (json_data->GetList(cloud_print::kPrinterListValue, &printer_list) | 207 if (json_data->GetList(kPrinterListValue, &printer_list) && printer_list) { |
206 && printer_list) { | |
207 for (size_t index = 0; index < printer_list->GetSize(); index++) { | 208 for (size_t index = 0; index < printer_list->GetSize(); index++) { |
208 DictionaryValue* printer_data = NULL; | 209 DictionaryValue* printer_data = NULL; |
209 if (printer_list->GetDictionary(index, &printer_data)) { | 210 if (printer_list->GetDictionary(index, &printer_data)) { |
210 std::string printer_name; | 211 std::string printer_name; |
211 printer_data->GetString(kNameValue, &printer_name); | 212 printer_data->GetString(kNameValue, &printer_name); |
212 std::string printer_id; | 213 std::string printer_id; |
213 printer_data->GetString(kIdValue, &printer_id); | 214 printer_data->GetString(kIdValue, &printer_id); |
214 if (settings_.IsPrinterBlacklisted(printer_name)) { | 215 if (settings_.IsPrinterBlacklisted(printer_name)) { |
215 VLOG(1) << "CP_CONNECTOR: Deleting " << printer_name << | 216 VLOG(1) << "CP_CONNECTOR: Deleting " << printer_name << |
216 " id: " << printer_id << " as blacklisted"; | 217 " id: " << printer_id << " as blacklisted"; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 const net::URLFetcher* source, | 267 const net::URLFetcher* source, |
267 const GURL& url, | 268 const GURL& url, |
268 DictionaryValue* json_data, | 269 DictionaryValue* json_data, |
269 bool succeeded) { | 270 bool succeeded) { |
270 VLOG(1) << "CP_CONNECTOR: Handler printer register response" | 271 VLOG(1) << "CP_CONNECTOR: Handler printer register response" |
271 << ", succeeded: " << succeeded | 272 << ", succeeded: " << succeeded |
272 << ", url: " << url; | 273 << ", url: " << url; |
273 if (succeeded) { | 274 if (succeeded) { |
274 ListValue* printer_list = NULL; | 275 ListValue* printer_list = NULL; |
275 // There should be a "printers" value in the JSON | 276 // There should be a "printers" value in the JSON |
276 if (json_data->GetList(cloud_print::kPrinterListValue, &printer_list)) { | 277 if (json_data->GetList(kPrinterListValue, &printer_list)) { |
277 DictionaryValue* printer_data = NULL; | 278 DictionaryValue* printer_data = NULL; |
278 if (printer_list->GetDictionary(0, &printer_data)) | 279 if (printer_list->GetDictionary(0, &printer_data)) |
279 InitJobHandlerForPrinter(printer_data); | 280 InitJobHandlerForPrinter(printer_data); |
280 } | 281 } |
281 } | 282 } |
282 ContinuePendingTaskProcessing(); // Continue processing background tasks. | 283 ContinuePendingTaskProcessing(); // Continue processing background tasks. |
283 return CloudPrintURLFetcher::STOP_PROCESSING; | 284 return CloudPrintURLFetcher::STOP_PROCESSING; |
284 } | 285 } |
285 | 286 |
286 | 287 |
(...skipping 14 matching lines...) Expand all Loading... |
301 request_ = new CloudPrintURLFetcher; | 302 request_ = new CloudPrintURLFetcher; |
302 request_->StartPostRequest( | 303 request_->StartPostRequest( |
303 url, this, max_retries, mime_type, post_data, std::string()); | 304 url, this, max_retries, mime_type, post_data, std::string()); |
304 } | 305 } |
305 | 306 |
306 void CloudPrintConnector::ReportUserMessage(const std::string& message_id, | 307 void CloudPrintConnector::ReportUserMessage(const std::string& message_id, |
307 const std::string& failure_msg) { | 308 const std::string& failure_msg) { |
308 // This is a fire and forget type of function. | 309 // This is a fire and forget type of function. |
309 // Result of this request will be ignored. | 310 // Result of this request will be ignored. |
310 std::string mime_boundary; | 311 std::string mime_boundary; |
311 cloud_print::CreateMimeBoundaryForUpload(&mime_boundary); | 312 CreateMimeBoundaryForUpload(&mime_boundary); |
312 GURL url = CloudPrintHelpers::GetUrlForUserMessage(settings_.server_url(), | 313 GURL url = GetUrlForUserMessage(settings_.server_url(), message_id); |
313 message_id); | |
314 std::string post_data; | 314 std::string post_data; |
315 cloud_print::AddMultipartValueForUpload(kMessageTextValue, failure_msg, | 315 AddMultipartValueForUpload(kMessageTextValue, failure_msg, mime_boundary, |
316 mime_boundary, std::string(), &post_data); | 316 std::string(), &post_data); |
317 // Terminate the request body | 317 // Terminate the request body |
318 post_data.append("--" + mime_boundary + "--\r\n"); | 318 post_data.append("--" + mime_boundary + "--\r\n"); |
319 std::string mime_type("multipart/form-data; boundary="); | 319 std::string mime_type("multipart/form-data; boundary="); |
320 mime_type += mime_boundary; | 320 mime_type += mime_boundary; |
321 user_message_request_ = new CloudPrintURLFetcher; | 321 user_message_request_ = new CloudPrintURLFetcher; |
322 user_message_request_->StartPostRequest(url, this, 1, mime_type, post_data, | 322 user_message_request_->StartPostRequest(url, this, 1, mime_type, post_data, |
323 std::string()); | 323 std::string()); |
324 } | 324 } |
325 | 325 |
326 bool CloudPrintConnector::RemovePrinterFromList( | 326 bool CloudPrintConnector::RemovePrinterFromList( |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 if (printer_data->GetString(kPrinterStatusValue, &printer_status)) { | 359 if (printer_data->GetString(kPrinterStatusValue, &printer_status)) { |
360 base::StringToInt(printer_status, &printer_info.printer_status); | 360 base::StringToInt(printer_status, &printer_info.printer_status); |
361 } | 361 } |
362 printer_data->GetString(kPrinterCapsHashValue, | 362 printer_data->GetString(kPrinterCapsHashValue, |
363 &printer_info_cloud.caps_hash); | 363 &printer_info_cloud.caps_hash); |
364 ListValue* tags_list = NULL; | 364 ListValue* tags_list = NULL; |
365 if (printer_data->GetList(kTagsValue, &tags_list) && tags_list) { | 365 if (printer_data->GetList(kTagsValue, &tags_list) && tags_list) { |
366 for (size_t index = 0; index < tags_list->GetSize(); index++) { | 366 for (size_t index = 0; index < tags_list->GetSize(); index++) { |
367 std::string tag; | 367 std::string tag; |
368 if (tags_list->GetString(index, &tag) && | 368 if (tags_list->GetString(index, &tag) && |
369 StartsWithASCII(tag, kTagsHashTagName, false)) { | 369 StartsWithASCII(tag, kCloudPrintServiceTagsHashTagName, false)) { |
370 std::vector<std::string> tag_parts; | 370 std::vector<std::string> tag_parts; |
371 base::SplitStringDontTrim(tag, '=', &tag_parts); | 371 base::SplitStringDontTrim(tag, '=', &tag_parts); |
372 DCHECK_EQ(tag_parts.size(), 2U); | 372 DCHECK_EQ(tag_parts.size(), 2U); |
373 if (tag_parts.size() == 2) | 373 if (tag_parts.size() == 2) |
374 printer_info_cloud.tags_hash = tag_parts[1]; | 374 printer_info_cloud.tags_hash = tag_parts[1]; |
375 } | 375 } |
376 } | 376 } |
377 } | 377 } |
378 scoped_refptr<PrinterJobHandler> job_handler; | 378 scoped_refptr<PrinterJobHandler> job_handler; |
379 job_handler = new PrinterJobHandler(printer_info, | 379 job_handler = new PrinterJobHandler(printer_info, |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 | 444 |
445 // Delete current task and repost if we have more task available. | 445 // Delete current task and repost if we have more task available. |
446 pending_tasks_.pop_front(); | 446 pending_tasks_.pop_front(); |
447 if (pending_tasks_.size() != 0) { | 447 if (pending_tasks_.size() != 0) { |
448 MessageLoop::current()->PostTask( | 448 MessageLoop::current()->PostTask( |
449 FROM_HERE, base::Bind(&CloudPrintConnector::ProcessPendingTask, this)); | 449 FROM_HERE, base::Bind(&CloudPrintConnector::ProcessPendingTask, this)); |
450 } | 450 } |
451 } | 451 } |
452 | 452 |
453 void CloudPrintConnector::OnPrintersAvailable() { | 453 void CloudPrintConnector::OnPrintersAvailable() { |
454 GURL printer_list_url = CloudPrintHelpers::GetUrlForPrinterList( | 454 GURL printer_list_url = GetUrlForPrinterList( |
455 settings_.server_url(), settings_.proxy_id()); | 455 settings_.server_url(), settings_.proxy_id()); |
456 StartGetRequest(printer_list_url, | 456 StartGetRequest(printer_list_url, |
457 kCloudPrintRegisterMaxRetryCount, | 457 kCloudPrintRegisterMaxRetryCount, |
458 &CloudPrintConnector::HandlePrinterListResponse); | 458 &CloudPrintConnector::HandlePrinterListResponse); |
459 } | 459 } |
460 | 460 |
461 void CloudPrintConnector::OnPrinterRegister( | 461 void CloudPrintConnector::OnPrinterRegister( |
462 const printing::PrinterBasicInfo& info) { | 462 const printing::PrinterBasicInfo& info) { |
463 for (JobHandlerMap::iterator it = job_handler_map_.begin(); | 463 for (JobHandlerMap::iterator it = job_handler_map_.begin(); |
464 it != job_handler_map_.end(); ++it) { | 464 it != job_handler_map_.end(); ++it) { |
(...skipping 16 matching lines...) Expand all Loading... |
481 // Remove corresponding printer job handler. | 481 // Remove corresponding printer job handler. |
482 JobHandlerMap::iterator it = job_handler_map_.find(printer_id); | 482 JobHandlerMap::iterator it = job_handler_map_.find(printer_id); |
483 if (it != job_handler_map_.end()) { | 483 if (it != job_handler_map_.end()) { |
484 it->second->Shutdown(); | 484 it->second->Shutdown(); |
485 job_handler_map_.erase(it); | 485 job_handler_map_.erase(it); |
486 } | 486 } |
487 | 487 |
488 // TODO(gene): We probably should not try indefinitely here. Just once or | 488 // TODO(gene): We probably should not try indefinitely here. Just once or |
489 // twice should be enough. | 489 // twice should be enough. |
490 // Bug: http://code.google.com/p/chromium/issues/detail?id=101850 | 490 // Bug: http://code.google.com/p/chromium/issues/detail?id=101850 |
491 GURL url = CloudPrintHelpers::GetUrlForPrinterDelete( | 491 GURL url = GetUrlForPrinterDelete( |
492 settings_.server_url(), printer_id, "printer_deleted"); | 492 settings_.server_url(), printer_id, "printer_deleted"); |
493 StartGetRequest(url, | 493 StartGetRequest(url, |
494 kCloudPrintAPIMaxRetryCount, | 494 kCloudPrintAPIMaxRetryCount, |
495 &CloudPrintConnector::HandlePrinterDeleteResponse); | 495 &CloudPrintConnector::HandlePrinterDeleteResponse); |
496 } | 496 } |
497 | 497 |
498 void CloudPrintConnector::OnReceivePrinterCaps( | 498 void CloudPrintConnector::OnReceivePrinterCaps( |
499 bool succeeded, | 499 bool succeeded, |
500 const std::string& printer_name, | 500 const std::string& printer_name, |
501 const printing::PrinterCapsAndDefaults& caps_and_defaults) { | 501 const printing::PrinterCapsAndDefaults& caps_and_defaults) { |
(...skipping 14 matching lines...) Expand all Loading... |
516 ReportUserMessage(kGetPrinterCapsFailedMessageId, status_message); | 516 ReportUserMessage(kGetPrinterCapsFailedMessageId, status_message); |
517 | 517 |
518 ContinuePendingTaskProcessing(); // Skip this printer registration. | 518 ContinuePendingTaskProcessing(); // Skip this printer registration. |
519 return; | 519 return; |
520 } | 520 } |
521 | 521 |
522 const printing::PrinterBasicInfo& info = pending_tasks_.front().printer_info; | 522 const printing::PrinterBasicInfo& info = pending_tasks_.front().printer_info; |
523 DCHECK(IsSamePrinter(info.printer_name, printer_name)); | 523 DCHECK(IsSamePrinter(info.printer_name, printer_name)); |
524 | 524 |
525 std::string mime_boundary; | 525 std::string mime_boundary; |
526 cloud_print::CreateMimeBoundaryForUpload(&mime_boundary); | 526 CreateMimeBoundaryForUpload(&mime_boundary); |
527 std::string post_data; | 527 std::string post_data; |
528 | 528 |
529 cloud_print::AddMultipartValueForUpload(kProxyIdValue, settings_.proxy_id(), | 529 AddMultipartValueForUpload(kProxyIdValue, |
530 mime_boundary, std::string(), &post_data); | 530 settings_.proxy_id(), mime_boundary, std::string(), &post_data); |
531 cloud_print::AddMultipartValueForUpload(kPrinterNameValue, info.printer_name, | 531 AddMultipartValueForUpload(kPrinterNameValue, |
532 mime_boundary, std::string(), &post_data); | 532 info.printer_name, mime_boundary, std::string(), &post_data); |
533 cloud_print::AddMultipartValueForUpload(kPrinterDescValue, | 533 AddMultipartValueForUpload(kPrinterDescValue, |
534 info.printer_description, mime_boundary, std::string() , &post_data); | 534 info.printer_description, mime_boundary, std::string(), &post_data); |
535 cloud_print::AddMultipartValueForUpload(kPrinterStatusValue, | 535 AddMultipartValueForUpload(kPrinterStatusValue, |
536 base::StringPrintf("%d", info.printer_status), | 536 base::StringPrintf("%d", info.printer_status), |
537 mime_boundary, std::string(), &post_data); | 537 mime_boundary, std::string(), &post_data); |
538 post_data += CloudPrintHelpers::GetPostDataForPrinterTags(info, | 538 post_data += GetPostDataForPrinterInfo(info, mime_boundary); |
539 mime_boundary); | 539 AddMultipartValueForUpload(kPrinterCapsValue, |
540 cloud_print::AddMultipartValueForUpload(kPrinterCapsValue, | |
541 caps_and_defaults.printer_capabilities, mime_boundary, | 540 caps_and_defaults.printer_capabilities, mime_boundary, |
542 caps_and_defaults.caps_mime_type, &post_data); | 541 caps_and_defaults.caps_mime_type, &post_data); |
543 cloud_print::AddMultipartValueForUpload(kPrinterDefaultsValue, | 542 AddMultipartValueForUpload(kPrinterDefaultsValue, |
544 caps_and_defaults.printer_defaults, mime_boundary, | 543 caps_and_defaults.printer_defaults, mime_boundary, |
545 caps_and_defaults.defaults_mime_type, &post_data); | 544 caps_and_defaults.defaults_mime_type, &post_data); |
546 // Send a hash of the printer capabilities to the server. We will use this | 545 // Send a hash of the printer capabilities to the server. We will use this |
547 // later to check if the capabilities have changed | 546 // later to check if the capabilities have changed |
548 cloud_print::AddMultipartValueForUpload(kPrinterCapsHashValue, | 547 AddMultipartValueForUpload(kPrinterCapsHashValue, |
549 base::MD5String(caps_and_defaults.printer_capabilities), | 548 base::MD5String(caps_and_defaults.printer_capabilities), |
550 mime_boundary, std::string(), &post_data); | 549 mime_boundary, std::string(), &post_data); |
551 | 550 |
552 // Terminate the request body | 551 // Terminate the request body |
553 post_data.append("--" + mime_boundary + "--\r\n"); | 552 post_data.append("--" + mime_boundary + "--\r\n"); |
554 std::string mime_type("multipart/form-data; boundary="); | 553 std::string mime_type("multipart/form-data; boundary="); |
555 mime_type += mime_boundary; | 554 mime_type += mime_boundary; |
556 | 555 |
557 GURL post_url = CloudPrintHelpers::GetUrlForPrinterRegistration( | 556 GURL post_url = GetUrlForPrinterRegistration(settings_.server_url()); |
558 settings_.server_url()); | |
559 StartPostRequest(post_url, | 557 StartPostRequest(post_url, |
560 kCloudPrintAPIMaxRetryCount, | 558 kCloudPrintAPIMaxRetryCount, |
561 mime_type, | 559 mime_type, |
562 post_data, | 560 post_data, |
563 &CloudPrintConnector::HandleRegisterPrinterResponse); | 561 &CloudPrintConnector::HandleRegisterPrinterResponse); |
564 } | 562 } |
565 | 563 |
566 bool CloudPrintConnector::IsSamePrinter(const std::string& name1, | 564 bool CloudPrintConnector::IsSamePrinter(const std::string& name1, |
567 const std::string& name2) const { | 565 const std::string& name2) const { |
568 return (0 == base::strcasecmp(name1.c_str(), name2.c_str())); | 566 return (0 == base::strcasecmp(name1.c_str(), name2.c_str())); |
569 } | 567 } |
| 568 |
| 569 } // namespace cloud_print |
OLD | NEW |