Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: cloud_print/gcp20/prototype/print_job_handler.cc

Issue 735053002: Prefix CommandLine usage with base namespace (Part 7: cloud_print/) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cloud_print/gcp20/prototype/gcp20_device.cc ('k') | cloud_print/gcp20/prototype/printer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/format_macros.h" 10 #include "base/format_macros.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 std::string* job_id_out, 78 std::string* job_id_out,
79 // TODO(maksymb): Use base::TimeDelta for timeout values 79 // TODO(maksymb): Use base::TimeDelta for timeout values
80 int* expires_in_out, 80 int* expires_in_out,
81 // TODO(maksymb): Use base::TimeDelta for timeout values 81 // TODO(maksymb): Use base::TimeDelta for timeout values
82 int* error_timeout_out, 82 int* error_timeout_out,
83 std::string* error_description) { 83 std::string* error_description) {
84 if (!ValidateTicket(ticket)) 84 if (!ValidateTicket(ticket))
85 return LocalPrintJob::CREATE_INVALID_TICKET; 85 return LocalPrintJob::CREATE_INVALID_TICKET;
86 86
87 // Let's simulate at least some errors just for testing. 87 // Let's simulate at least some errors just for testing.
88 if (CommandLine::ForCurrentProcess()->HasSwitch( 88 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
89 switches::kSimulatePrintingErrors)) { 89 switches::kSimulatePrintingErrors)) {
90 if (base::RandDouble() <= kPaperJamProbability) { 90 if (base::RandDouble() <= kPaperJamProbability) {
91 *error_description = "Paper jam, try again"; 91 *error_description = "Paper jam, try again";
92 return LocalPrintJob::CREATE_PRINTER_ERROR; 92 return LocalPrintJob::CREATE_PRINTER_ERROR;
93 } 93 }
94 94
95 if (drafts.size() > kMaxDrafts) { // Another simulation of error: business 95 if (drafts.size() > kMaxDrafts) { // Another simulation of error: business
96 *error_timeout_out = kTooManyDraftsTimeout; 96 *error_timeout_out = kTooManyDraftsTimeout;
97 return LocalPrintJob::CREATE_PRINTER_BUSY; 97 return LocalPrintJob::CREATE_PRINTER_BUSY;
98 } 98 }
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 return expiration - base::Time::Now(); 301 return expiration - base::Time::Now();
302 } 302 }
303 303
304 void PrintJobHandler::ForgetDraft(const std::string& id) { 304 void PrintJobHandler::ForgetDraft(const std::string& id) {
305 drafts.erase(id); 305 drafts.erase(id);
306 } 306 }
307 307
308 void PrintJobHandler::ForgetLocalJob(const std::string& id) { 308 void PrintJobHandler::ForgetLocalJob(const std::string& id) {
309 jobs.erase(id); 309 jobs.erase(id);
310 } 310 }
OLDNEW
« no previous file with comments | « cloud_print/gcp20/prototype/gcp20_device.cc ('k') | cloud_print/gcp20/prototype/printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698