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 #ifndef GCP20_PROTOTYPE_PRINTER_H_ | 5 #ifndef GCP20_PROTOTYPE_PRINTER_H_ |
6 #define GCP20_PROTOTYPE_PRINTER_H_ | 6 #define GCP20_PROTOTYPE_PRINTER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "cloud_print/gcp20/prototype/cloud_print_requester.h" | 13 #include "cloud_print/gcp20/prototype/cloud_print_requester.h" |
14 #include "cloud_print/gcp20/prototype/cloud_print_xmpp_listener.h" | 14 #include "cloud_print/gcp20/prototype/cloud_print_xmpp_listener.h" |
15 #include "cloud_print/gcp20/prototype/dns_sd_server.h" | 15 #include "cloud_print/gcp20/prototype/dns_sd_server.h" |
16 #include "cloud_print/gcp20/prototype/print_job_handler.h" | 16 #include "cloud_print/gcp20/prototype/print_job_handler.h" |
17 #include "cloud_print/gcp20/prototype/printer_state.h" | 17 #include "cloud_print/gcp20/prototype/printer_state.h" |
18 #include "cloud_print/gcp20/prototype/privet_http_server.h" | 18 #include "cloud_print/gcp20/prototype/privet_http_server.h" |
19 #include "cloud_print/gcp20/prototype/x_privet_token.h" | 19 #include "cloud_print/gcp20/prototype/x_privet_token.h" |
20 | 20 |
21 extern const base::FilePath::CharType kPrinterStatePath[]; | 21 extern const base::FilePath::CharType kPrinterStatePath[]; |
22 | 22 |
23 struct LocalPrintJob; | |
24 | |
25 // This class maintains work of DNS-SD server, HTTP server and others. | 23 // This class maintains work of DNS-SD server, HTTP server and others. |
26 class Printer : public base::SupportsWeakPtr<Printer>, | 24 class Printer : public base::SupportsWeakPtr<Printer>, |
27 public PrivetHttpServer::Delegate, | 25 public PrivetHttpServer::Delegate, |
28 public CloudPrintRequester::Delegate, | 26 public CloudPrintRequester::Delegate, |
29 public CloudPrintXmppListener::Delegate { | 27 public CloudPrintXmppListener::Delegate { |
30 public: | 28 public: |
31 // Constructs uninitialized object. | 29 // Constructs uninitialized object. |
32 Printer(); | 30 Printer(); |
33 | 31 |
34 // Destroys the object. | 32 // Destroys the object. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 const std::string& user, | 65 const std::string& user, |
68 std::string* device_id) OVERRIDE; | 66 std::string* device_id) OVERRIDE; |
69 virtual PrivetHttpServer::RegistrationErrorStatus RegistrationCancel( | 67 virtual PrivetHttpServer::RegistrationErrorStatus RegistrationCancel( |
70 const std::string& user) OVERRIDE; | 68 const std::string& user) OVERRIDE; |
71 virtual void GetRegistrationServerError(std::string* description) OVERRIDE; | 69 virtual void GetRegistrationServerError(std::string* description) OVERRIDE; |
72 virtual void CreateInfo(PrivetHttpServer::DeviceInfo* info) OVERRIDE; | 70 virtual void CreateInfo(PrivetHttpServer::DeviceInfo* info) OVERRIDE; |
73 virtual bool IsRegistered() const OVERRIDE; | 71 virtual bool IsRegistered() const OVERRIDE; |
74 virtual bool IsLocalPrintingAllowed() const OVERRIDE; | 72 virtual bool IsLocalPrintingAllowed() const OVERRIDE; |
75 virtual bool CheckXPrivetTokenHeader(const std::string& token) const OVERRIDE; | 73 virtual bool CheckXPrivetTokenHeader(const std::string& token) const OVERRIDE; |
76 virtual scoped_ptr<base::DictionaryValue> GetCapabilities() OVERRIDE; | 74 virtual scoped_ptr<base::DictionaryValue> GetCapabilities() OVERRIDE; |
77 virtual void CreateJob(const std::string& ticket) OVERRIDE; | 75 virtual LocalPrintJob::CreateResult CreateJob( |
| 76 const std::string& ticket, |
| 77 std::string* job_id, |
| 78 int* expires_in, |
| 79 int* error_timeout, |
| 80 std::string* error_description) OVERRIDE; |
78 virtual LocalPrintJob::SaveResult SubmitDoc( | 81 virtual LocalPrintJob::SaveResult SubmitDoc( |
79 const LocalPrintJob& job, | 82 const LocalPrintJob& job, |
80 std::string* job_id, | 83 std::string* job_id, |
| 84 int* expires_in, |
81 std::string* error_description, | 85 std::string* error_description, |
82 int* timeout) OVERRIDE; | 86 int* timeout) OVERRIDE; |
83 virtual void GetJobStatus(int job_id) OVERRIDE; | 87 virtual LocalPrintJob::SaveResult SubmitDocWithId( |
| 88 const LocalPrintJob& job, |
| 89 const std::string& job_id, |
| 90 int* expires_in, |
| 91 std::string* error_description, |
| 92 int* timeout) OVERRIDE; |
| 93 virtual bool GetJobState(const std::string& id, |
| 94 LocalPrintJob::Info* info) OVERRIDE; |
84 | 95 |
85 // CloudRequester::Delegate methods: | 96 // CloudRequester::Delegate methods: |
86 virtual void OnRegistrationStartResponseParsed( | 97 virtual void OnRegistrationStartResponseParsed( |
87 const std::string& registration_token, | 98 const std::string& registration_token, |
88 const std::string& complete_invite_url, | 99 const std::string& complete_invite_url, |
89 const std::string& device_id) OVERRIDE; | 100 const std::string& device_id) OVERRIDE; |
90 virtual void OnRegistrationFinished( | 101 virtual void OnRegistrationFinished( |
91 const std::string& refresh_token, | 102 const std::string& refresh_token, |
92 const std::string& access_token, | 103 const std::string& access_token, |
93 int access_token_expires_in_seconds) OVERRIDE; | 104 int access_token_expires_in_seconds) OVERRIDE; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 bool pending_print_jobs_check_; | 249 bool pending_print_jobs_check_; |
239 | 250 |
240 // Contains |true| if Printer has to be deleted. | 251 // Contains |true| if Printer has to be deleted. |
241 bool pending_deletion_; | 252 bool pending_deletion_; |
242 | 253 |
243 DISALLOW_COPY_AND_ASSIGN(Printer); | 254 DISALLOW_COPY_AND_ASSIGN(Printer); |
244 }; | 255 }; |
245 | 256 |
246 #endif // GCP20_PROTOTYPE_PRINTER_H_ | 257 #endif // GCP20_PROTOTYPE_PRINTER_H_ |
247 | 258 |
OLD | NEW |