OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "cloud_print/gcp20/prototype/print_job_handler.h" | 5 #include "cloud_print/gcp20/prototype/print_job_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 bool PrintJobHandler::SavePrintJob(const std::string& content, | 209 bool PrintJobHandler::SavePrintJob(const std::string& content, |
210 const std::string& ticket, | 210 const std::string& ticket, |
211 const base::Time& create_time, | 211 const base::Time& create_time, |
212 const std::string& id, | 212 const std::string& id, |
213 const std::string& title, | 213 const std::string& title, |
214 const std::string& file_extension) { | 214 const std::string& file_extension) { |
215 VLOG(1) << "Printing printjob: \"" + title + "\""; | 215 VLOG(1) << "Printing printjob: \"" + title + "\""; |
216 base::FilePath directory(kJobsPath); | 216 base::FilePath directory(kJobsPath); |
217 | 217 |
218 if (!base::DirectoryExists(directory) && | 218 if (!base::DirectoryExists(directory) && |
219 !file_util::CreateDirectory(directory)) { | 219 !base::CreateDirectory(directory)) { |
220 return false; | 220 return false; |
221 } | 221 } |
222 | 222 |
223 base::Time::Exploded create_time_exploded; | 223 base::Time::Exploded create_time_exploded; |
224 create_time.UTCExplode(&create_time_exploded); | 224 create_time.UTCExplode(&create_time_exploded); |
225 base::FilePath::StringType job_prefix = | 225 base::FilePath::StringType job_prefix = |
226 StringPrintf(FILE_PATH_LITERAL("%.4d%.2d%.2d-%.2d%.2d%.2d_"), | 226 StringPrintf(FILE_PATH_LITERAL("%.4d%.2d%.2d-%.2d%.2d%.2d_"), |
227 create_time_exploded.year, | 227 create_time_exploded.year, |
228 create_time_exploded.month, | 228 create_time_exploded.month, |
229 create_time_exploded.day_of_month, | 229 create_time_exploded.day_of_month, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 return expiration - base::Time::Now(); | 299 return expiration - base::Time::Now(); |
300 } | 300 } |
301 | 301 |
302 void PrintJobHandler::ForgetDraft(const std::string& id) { | 302 void PrintJobHandler::ForgetDraft(const std::string& id) { |
303 drafts.erase(id); | 303 drafts.erase(id); |
304 } | 304 } |
305 | 305 |
306 void PrintJobHandler::ForgetLocalJob(const std::string& id) { | 306 void PrintJobHandler::ForgetLocalJob(const std::string& id) { |
307 jobs.erase(id); | 307 jobs.erase(id); |
308 } | 308 } |
OLD | NEW |