OLD | NEW |
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/rand_util.h" | 9 #include "base/rand_util.h" |
| 10 #include "base/string_split.h" |
10 #include "base/string_util.h" | 11 #include "base/string_util.h" |
11 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
12 #include "base/values.h" | 13 #include "base/values.h" |
13 #include "chrome/common/net/http_return.h" | 14 #include "chrome/common/net/http_return.h" |
14 #include "chrome/service/cloud_print/cloud_print_consts.h" | 15 #include "chrome/service/cloud_print/cloud_print_consts.h" |
15 #include "chrome/service/cloud_print/cloud_print_helpers.h" | 16 #include "chrome/service/cloud_print/cloud_print_helpers.h" |
16 #include "chrome/service/cloud_print/printer_job_handler.h" | 17 #include "chrome/service/cloud_print/printer_job_handler.h" |
17 #include "chrome/service/gaia/service_gaia_authenticator.h" | 18 #include "chrome/service/gaia/service_gaia_authenticator.h" |
18 #include "chrome/service/service_process.h" | 19 #include "chrome/service/service_process.h" |
19 #include "jingle/notifier/base/notifier_options.h" | 20 #include "jingle/notifier/base/notifier_options.h" |
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 printer_data->GetString(kPrinterCapsHashValue, | 624 printer_data->GetString(kPrinterCapsHashValue, |
624 &printer_info_cloud.caps_hash); | 625 &printer_info_cloud.caps_hash); |
625 ListValue* tags_list = NULL; | 626 ListValue* tags_list = NULL; |
626 printer_data->GetList(kPrinterTagsValue, &tags_list); | 627 printer_data->GetList(kPrinterTagsValue, &tags_list); |
627 if (tags_list) { | 628 if (tags_list) { |
628 for (size_t index = 0; index < tags_list->GetSize(); index++) { | 629 for (size_t index = 0; index < tags_list->GetSize(); index++) { |
629 std::string tag; | 630 std::string tag; |
630 tags_list->GetString(index, &tag); | 631 tags_list->GetString(index, &tag); |
631 if (StartsWithASCII(tag, kTagsHashTagName, false)) { | 632 if (StartsWithASCII(tag, kTagsHashTagName, false)) { |
632 std::vector<std::string> tag_parts; | 633 std::vector<std::string> tag_parts; |
633 SplitStringDontTrim(tag, '=', &tag_parts); | 634 base::SplitStringDontTrim(tag, '=', &tag_parts); |
634 DCHECK(tag_parts.size() == 2); | 635 DCHECK(tag_parts.size() == 2); |
635 if (tag_parts.size() == 2) { | 636 if (tag_parts.size() == 2) { |
636 printer_info_cloud.tags_hash = tag_parts[1]; | 637 printer_info_cloud.tags_hash = tag_parts[1]; |
637 } | 638 } |
638 } | 639 } |
639 } | 640 } |
640 } | 641 } |
641 scoped_refptr<PrinterJobHandler> job_handler; | 642 scoped_refptr<PrinterJobHandler> job_handler; |
642 job_handler = new PrinterJobHandler(printer_info, printer_info_cloud, | 643 job_handler = new PrinterJobHandler(printer_info, printer_info_cloud, |
643 auth_token_, cloud_print_server_url_, | 644 auth_token_, cloud_print_server_url_, |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 job_handler_map_.erase(printer_id); | 755 job_handler_map_.erase(printer_id); |
755 } | 756 } |
756 | 757 |
757 void CloudPrintProxyBackend::Core::OnAuthError() { | 758 void CloudPrintProxyBackend::Core::OnAuthError() { |
758 DCHECK(MessageLoop::current() == backend_->core_thread_.message_loop()); | 759 DCHECK(MessageLoop::current() == backend_->core_thread_.message_loop()); |
759 LOG(INFO) << "CP_PROXY: Auth Error"; | 760 LOG(INFO) << "CP_PROXY: Auth Error"; |
760 backend_->frontend_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, | 761 backend_->frontend_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, |
761 &Core::NotifyAuthenticationFailed)); | 762 &Core::NotifyAuthenticationFailed)); |
762 } | 763 } |
763 | 764 |
OLD | NEW |