| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_queue_handler.h" | 5 #include "chrome/service/cloud_print/printer_job_queue_handler.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 return base::Time::Now(); | 21 return base::Time::Now(); |
| 22 } | 22 } |
| 23 | 23 |
| 24 JobDetails::JobDetails() {} | 24 JobDetails::JobDetails() {} |
| 25 | 25 |
| 26 JobDetails::~JobDetails() {} | 26 JobDetails::~JobDetails() {} |
| 27 | 27 |
| 28 void JobDetails::Clear() { | 28 void JobDetails::Clear() { |
| 29 job_id_.clear(); | 29 job_id_.clear(); |
| 30 job_title_.clear(); | 30 job_title_.clear(); |
| 31 job_owner_.clear(); |
| 31 print_ticket_.clear(); | 32 print_ticket_.clear(); |
| 32 print_ticket_mime_type_.clear(); | 33 print_ticket_mime_type_.clear(); |
| 33 print_data_mime_type_.clear(); | 34 print_data_mime_type_.clear(); |
| 34 print_data_file_path_ = base::FilePath(); | 35 print_data_file_path_ = base::FilePath(); |
| 35 print_data_url_.clear(); | 36 print_data_url_.clear(); |
| 36 print_ticket_url_.clear(); | 37 print_ticket_url_.clear(); |
| 37 tags_.clear(); | 38 tags_.clear(); |
| 38 time_remaining_ = base::TimeDelta(); | 39 time_remaining_ = base::TimeDelta(); |
| 39 } | 40 } |
| 40 | 41 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 51 | 52 |
| 52 PrinterJobQueueHandler::~PrinterJobQueueHandler() {} | 53 PrinterJobQueueHandler::~PrinterJobQueueHandler() {} |
| 53 | 54 |
| 54 void PrinterJobQueueHandler::ConstructJobDetailsFromJson( | 55 void PrinterJobQueueHandler::ConstructJobDetailsFromJson( |
| 55 const base::DictionaryValue* job_data, | 56 const base::DictionaryValue* job_data, |
| 56 JobDetails* job_details) { | 57 JobDetails* job_details) { |
| 57 job_details->Clear(); | 58 job_details->Clear(); |
| 58 | 59 |
| 59 job_data->GetString(kIdValue, &job_details->job_id_); | 60 job_data->GetString(kIdValue, &job_details->job_id_); |
| 60 job_data->GetString(kTitleValue, &job_details->job_title_); | 61 job_data->GetString(kTitleValue, &job_details->job_title_); |
| 62 job_data->GetString(kOwnerValue, &job_details->job_owner_); |
| 61 | 63 |
| 62 job_data->GetString(kTicketUrlValue, &job_details->print_ticket_url_); | 64 job_data->GetString(kTicketUrlValue, &job_details->print_ticket_url_); |
| 63 job_data->GetString(kFileUrlValue, &job_details->print_data_url_); | 65 job_data->GetString(kFileUrlValue, &job_details->print_data_url_); |
| 64 | 66 |
| 65 // Get tags for print job. | 67 // Get tags for print job. |
| 66 const base::ListValue* tags = NULL; | 68 const base::ListValue* tags = NULL; |
| 67 if (job_data->GetList(kTagsValue, &tags)) { | 69 if (job_data->GetList(kTagsValue, &tags)) { |
| 68 for (size_t i = 0; i < tags->GetSize(); i++) { | 70 for (size_t i = 0; i < tags->GetSize(); i++) { |
| 69 std::string value; | 71 std::string value; |
| 70 if (tags->GetString(i, &value)) | 72 if (tags->GetString(i, &value)) |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 | 160 |
| 159 job_found.first->second.retries_ += 1; | 161 job_found.first->second.retries_ += 1; |
| 160 job_found.first->second.last_retry_ = time_provider_->GetNow(); | 162 job_found.first->second.last_retry_ = time_provider_->GetNow(); |
| 161 } | 163 } |
| 162 | 164 |
| 163 return true; | 165 return true; |
| 164 } | 166 } |
| 165 | 167 |
| 166 } // namespace cloud_print | 168 } // namespace cloud_print |
| 167 | 169 |
| OLD | NEW |