| 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/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/bind_helpers.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| (...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 | 713 |
| 714 std::string tags_hash = GetHashOfPrinterInfo(printer_info); | 714 std::string tags_hash = GetHashOfPrinterInfo(printer_info); |
| 715 if (tags_hash != printer_info_cloud_.tags_hash) { | 715 if (tags_hash != printer_info_cloud_.tags_hash) { |
| 716 printer_info_cloud_.tags_hash = tags_hash; | 716 printer_info_cloud_.tags_hash = tags_hash; |
| 717 post_data += GetPostDataForPrinterInfo(printer_info, mime_boundary); | 717 post_data += GetPostDataForPrinterInfo(printer_info, mime_boundary); |
| 718 // Remove all the existing proxy tags. | 718 // Remove all the existing proxy tags. |
| 719 std::string cp_tag_wildcard(kCloudPrintServiceProxyTagPrefix); | 719 std::string cp_tag_wildcard(kCloudPrintServiceProxyTagPrefix); |
| 720 cp_tag_wildcard += ".*"; | 720 cp_tag_wildcard += ".*"; |
| 721 net::AddMultipartValueForUpload(kPrinterRemoveTagValue, | 721 net::AddMultipartValueForUpload(kPrinterRemoveTagValue, |
| 722 cp_tag_wildcard, mime_boundary, std::string(), &post_data); | 722 cp_tag_wildcard, mime_boundary, std::string(), &post_data); |
| 723 | |
| 724 if (!last_caps_update_time_.is_null()) { | |
| 725 UMA_HISTOGRAM_CUSTOM_TIMES( | |
| 726 "CloudPrint.CapsUpdateInterval", | |
| 727 base::Time::Now() - last_caps_update_time_, | |
| 728 base::TimeDelta::FromMilliseconds(1), | |
| 729 base::TimeDelta::FromDays(7), 50); | |
| 730 } | |
| 731 last_caps_update_time_ = base::Time::Now(); | |
| 732 } | 723 } |
| 733 | 724 |
| 734 if (printer_info.printer_name != printer_info_.printer_name) { | 725 if (printer_info.printer_name != printer_info_.printer_name) { |
| 735 net::AddMultipartValueForUpload(kPrinterNameValue, | 726 net::AddMultipartValueForUpload(kPrinterNameValue, |
| 736 printer_info.printer_name, mime_boundary, std::string(), &post_data); | 727 printer_info.printer_name, mime_boundary, std::string(), &post_data); |
| 737 } | 728 } |
| 738 if (printer_info.printer_description != printer_info_.printer_description) { | 729 if (printer_info.printer_description != printer_info_.printer_description) { |
| 739 net::AddMultipartValueForUpload(kPrinterDescValue, | 730 net::AddMultipartValueForUpload(kPrinterDescValue, |
| 740 printer_info.printer_description, mime_boundary, | 731 printer_info.printer_description, mime_boundary, |
| 741 std::string(), &post_data); | 732 std::string(), &post_data); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 this)) { | 800 this)) { |
| 810 OnJobSpoolFailed(); | 801 OnJobSpoolFailed(); |
| 811 } | 802 } |
| 812 } | 803 } |
| 813 | 804 |
| 814 bool PrinterJobHandler::CurrentlyOnPrintThread() const { | 805 bool PrinterJobHandler::CurrentlyOnPrintThread() const { |
| 815 return print_thread_.task_runner()->BelongsToCurrentThread(); | 806 return print_thread_.task_runner()->BelongsToCurrentThread(); |
| 816 } | 807 } |
| 817 | 808 |
| 818 } // namespace cloud_print | 809 } // namespace cloud_print |
| OLD | NEW |