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

Side by Side Diff: chrome/browser/local_discovery/privet_http.h

Issue 73503002: Move PDF to PWG conversion into PrivetLocalPrintOperationImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
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 #ifndef CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_H_ 5 #ifndef CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_H_
6 #define CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_H_ 6 #define CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/memory/ref_counted_memory.h"
11 #include "chrome/browser/local_discovery/privet_url_fetcher.h" 13 #include "chrome/browser/local_discovery/privet_url_fetcher.h"
14 #include "chrome/browser/local_discovery/pwg_raster_converter.h"
12 #include "net/base/host_port_pair.h" 15 #include "net/base/host_port_pair.h"
13 16
14 namespace local_discovery { 17 namespace local_discovery {
15 18
16 class PrivetHTTPClient; 19 class PrivetHTTPClient;
17 20
18 // Represents a request to /privet/info. Will store a cached response and token 21 // Represents a request to /privet/info. Will store a cached response and token
19 // in the PrivetHTTPClient that created. 22 // in the PrivetHTTPClient that created.
20 class PrivetInfoOperation { 23 class PrivetInfoOperation {
21 public: 24 public:
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 virtual void Start() = 0; 112 virtual void Start() = 0;
110 113
111 virtual PrivetHTTPClient* GetHTTPClient() = 0; 114 virtual PrivetHTTPClient* GetHTTPClient() = 0;
112 }; 115 };
113 116
114 class PrivetLocalPrintOperation { 117 class PrivetLocalPrintOperation {
115 public: 118 public:
116 class Delegate { 119 class Delegate {
117 public: 120 public:
118 virtual ~Delegate() {} 121 virtual ~Delegate() {}
119 virtual void OnPrivetPrintingRequestPDF(
120 const PrivetLocalPrintOperation* print_operation) = 0;
121 virtual void OnPrivetPrintingRequestPWGRaster(
122 const PrivetLocalPrintOperation* print_operation) = 0;
123 virtual void OnPrivetPrintingDone( 122 virtual void OnPrivetPrintingDone(
124 const PrivetLocalPrintOperation* print_operation) = 0; 123 const PrivetLocalPrintOperation* print_operation) = 0;
125 virtual void OnPrivetPrintingError( 124 virtual void OnPrivetPrintingError(
126 const PrivetLocalPrintOperation* print_operation, int http_code) = 0; 125 const PrivetLocalPrintOperation* print_operation, int http_code) = 0;
127 }; 126 };
128 127
129 virtual ~PrivetLocalPrintOperation() {} 128 virtual ~PrivetLocalPrintOperation() {}
130 129
131 virtual void Start() = 0; 130 virtual void Start() = 0;
132 131
133 // One of thsese should be called ONLY after |OnPrivetPrintingRequestPDF| or 132
134 // |OnPrivetPrintingRequestPWGRaster| are called on the delegate. Data should 133 // Required print data. MUST be called before calling |Start()|.
135 // be in PDF or PWG format depending on what is requested by the local print 134 virtual void SetData(scoped_refptr<base::RefCountedBytes> data) = 0;
Vitaly Buka (NO REVIEWS) 2013/11/15 06:48:38 just base::RefCountedBytes*
Noam Samuel 2013/11/15 19:13:46 Done.
136 // operation.
137 virtual void SendData(const std::string& data) = 0;
138 virtual void SendDataFile(const base::FilePath& data) = 0;
139 135
140 // Optional attributes for /submitdoc. Call before calling |Start()| 136 // Optional attributes for /submitdoc. Call before calling |Start()|
141 // |ticket| should be in CJT format. 137 // |ticket| should be in CJT format.
142 virtual void SetTicket(const std::string& ticket) = 0; 138 virtual void SetTicket(const std::string& ticket) = 0;
143 // Username and jobname are for display only. 139 // Username and jobname are for display only.
144 virtual void SetUsername(const std::string& username) = 0; 140 virtual void SetUsername(const std::string& username) = 0;
145 virtual void SetJobname(const std::string& jobname) = 0; 141 virtual void SetJobname(const std::string& jobname) = 0;
146 // If |offline| is true, we will indicate to the printer not to post the job 142 // If |offline| is true, we will indicate to the printer not to post the job
147 // to Google Cloud Print. 143 // to Google Cloud Print.
148 virtual void SetOffline(bool offline) = 0; 144 virtual void SetOffline(bool offline) = 0;
149 145
146 // For testing, inject an alternative PWG raster converter.
147 virtual void SetPWGRasterConverterForTesting(
148 scoped_ptr<PWGRasterConverter> pwg_raster_converter) = 0;
149
Vitaly Buka (NO REVIEWS) 2013/11/15 06:48:38 same
Noam Samuel 2013/11/15 19:13:46 Using a scoped_ptr denotes the transfer of ownersh
150 virtual PrivetHTTPClient* GetHTTPClient() = 0; 150 virtual PrivetHTTPClient* GetHTTPClient() = 0;
151 }; 151 };
152 152
153 // Privet HTTP client. Must not outlive the operations it creates. 153 // Privet HTTP client. Must not outlive the operations it creates.
154 class PrivetHTTPClient { 154 class PrivetHTTPClient {
155 public: 155 public:
156 virtual ~PrivetHTTPClient() {} 156 virtual ~PrivetHTTPClient() {}
157 virtual const base::DictionaryValue* GetCachedInfo() const = 0; 157 virtual const base::DictionaryValue* GetCachedInfo() const = 0;
158 158
159 virtual scoped_ptr<PrivetRegisterOperation> CreateRegisterOperation( 159 virtual scoped_ptr<PrivetRegisterOperation> CreateRegisterOperation(
160 const std::string& user, 160 const std::string& user,
161 PrivetRegisterOperation::Delegate* delegate) = 0; 161 PrivetRegisterOperation::Delegate* delegate) = 0;
162 virtual scoped_ptr<PrivetInfoOperation> CreateInfoOperation( 162 virtual scoped_ptr<PrivetInfoOperation> CreateInfoOperation(
163 PrivetInfoOperation::Delegate* delegate) = 0; 163 PrivetInfoOperation::Delegate* delegate) = 0;
164 virtual scoped_ptr<PrivetCapabilitiesOperation> CreateCapabilitiesOperation( 164 virtual scoped_ptr<PrivetCapabilitiesOperation> CreateCapabilitiesOperation(
165 PrivetCapabilitiesOperation::Delegate* delegate) = 0; 165 PrivetCapabilitiesOperation::Delegate* delegate) = 0;
166 virtual scoped_ptr<PrivetLocalPrintOperation> CreateLocalPrintOperation( 166 virtual scoped_ptr<PrivetLocalPrintOperation> CreateLocalPrintOperation(
167 PrivetLocalPrintOperation::Delegate* delegate) = 0; 167 PrivetLocalPrintOperation::Delegate* delegate) = 0;
168 168
169 // A name for the HTTP client, e.g. the device name for the privet device. 169 // A name for the HTTP client, e.g. the device name for the privet device.
170 virtual const std::string& GetName() = 0; 170 virtual const std::string& GetName() = 0;
171 }; 171 };
172 172
173 } // namespace local_discovery 173 } // namespace local_discovery
174 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_H_ 174 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698