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

Unified Diff: cloud_print/gcp20/prototype/printer.cc

Issue 23271004: GCP2.0 Device: Adding advanced printing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@local-printing
Patch Set: Created 7 years, 4 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cloud_print/gcp20/prototype/printer.h ('k') | cloud_print/gcp20/prototype/privet_http_server.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cloud_print/gcp20/prototype/printer.cc
diff --git a/cloud_print/gcp20/prototype/printer.cc b/cloud_print/gcp20/prototype/printer.cc
index 197f70d473ff8048caa8ff11447906a52393a2cb..9513979f6d9fa6a17dfee852b3d0391e3afc6d3d 100644
--- a/cloud_print/gcp20/prototype/printer.cc
+++ b/cloud_print/gcp20/prototype/printer.cc
@@ -342,12 +342,15 @@ void Printer::CreateInfo(PrivetHttpServer::DeviceInfo* info) {
// TODO(maksymb): Create enum for available APIs and replace
// this API text names with constants from enum. API text names should be only
// known in PrivetHttpServer.
- if (state_.registration_state == PrinterState::UNREGISTERED) {
+ if (!IsRegistered()) {
info->api.push_back("/privet/register");
} else {
- if (IsLocalPrintingAllowed())
- info->api.push_back("/privet/printer/submitdoc");
info->api.push_back("/privet/capabilities");
+ if (IsLocalPrintingAllowed()) {
+ info->api.push_back("/privet/printer/createjob");
+ info->api.push_back("/privet/printer/submitdoc");
+ info->api.push_back("/privet/printer/jobstate");
+ }
}
info->type.push_back("printer");
@@ -372,22 +375,36 @@ scoped_ptr<base::DictionaryValue> Printer::GetCapabilities() {
return scoped_ptr<base::DictionaryValue>(dictionary_value->DeepCopy());
}
-void Printer::CreateJob(const std::string& ticket) {
- // TODO(maksymb): Implement advanced printing
- NOTIMPLEMENTED();
+LocalPrintJob::CreateResult Printer::CreateJob(const std::string& ticket,
+ std::string* job_id,
+ int* expires_in,
+ int* error_timeout,
+ std::string* error_description) {
+ return print_job_handler_->CreatePrintJob(ticket, job_id, expires_in,
+ error_timeout, error_description);
}
LocalPrintJob::SaveResult Printer::SubmitDoc(const LocalPrintJob& job,
std::string* job_id,
+ int* expires_in,
std::string* error_description,
int* timeout) {
- return print_job_handler_->SaveLocalPrintJob(job, job_id, error_description,
- timeout);
+ return print_job_handler_->SaveLocalPrintJob(job, job_id, expires_in,
+ error_description, timeout);
+}
+
+LocalPrintJob::SaveResult Printer::SubmitDocWithId(
+ const LocalPrintJob& job,
+ const std::string& job_id,
+ int* expires_in,
+ std::string* error_description,
+ int* timeout) {
+ return print_job_handler_->CompleteLocalPrintJob(job, job_id, expires_in,
+ error_description, timeout);
}
-void Printer::GetJobStatus(int job_id) {
- // TODO(maksymb): Implement advanced printing
- NOTIMPLEMENTED();
+bool Printer::GetJobState(const std::string& id, LocalPrintJob::Info* info) {
+ return print_job_handler_->GetJobState(id, info);
}
void Printer::OnRegistrationStartResponseParsed(
« no previous file with comments | « cloud_print/gcp20/prototype/printer.h ('k') | cloud_print/gcp20/prototype/privet_http_server.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698