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

Side by Side Diff: chrome/browser/ui/webui/print_preview/print_preview_handler.h

Issue 2931843003: Print Preview: Change getPrinterCapabilities to cr.sendWithPromise (Closed)
Patch Set: Address comments Created 3 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ 6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 const std::string& default_printer); 223 const std::string& default_printer);
224 224
225 // Send OAuth2 access token. 225 // Send OAuth2 access token.
226 void SendAccessToken(const std::string& type, 226 void SendAccessToken(const std::string& type,
227 const std::string& access_token); 227 const std::string& access_token);
228 228
229 // Sends the printer capabilities to the Web UI. |settings_info| contains 229 // Sends the printer capabilities to the Web UI. |settings_info| contains
230 // printer capabilities information. If |settings_info| is empty, sends 230 // printer capabilities information. If |settings_info| is empty, sends
231 // error notification to the Web UI instead. 231 // error notification to the Web UI instead.
232 void SendPrinterCapabilities( 232 void SendPrinterCapabilities(
233 const std::string& callback_id,
233 const std::string& printer_name, 234 const std::string& printer_name,
234 std::unique_ptr<base::DictionaryValue> settings_info); 235 std::unique_ptr<base::DictionaryValue> settings_info);
235 236
236 // Send the result of performing printer setup. |settings_info| contains 237 // Send the result of performing printer setup. |settings_info| contains
237 // printer capabilities. 238 // printer capabilities.
238 void SendPrinterSetup(const std::string& callback_id, 239 void SendPrinterSetup(const std::string& callback_id,
239 const std::string& printer_name, 240 const std::string& printer_name,
240 std::unique_ptr<base::DictionaryValue> settings_info); 241 std::unique_ptr<base::DictionaryValue> settings_info);
241 242
242 // Send the list of printers to the Web UI. 243 // Send the list of printers to the Web UI.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 void SaveCUPSColorSetting(const base::DictionaryValue* settings); 279 void SaveCUPSColorSetting(const base::DictionaryValue* settings);
279 280
280 void ConvertColorSettingToCUPSColorModel( 281 void ConvertColorSettingToCUPSColorModel(
281 base::DictionaryValue* settings) const; 282 base::DictionaryValue* settings) const;
282 #endif 283 #endif
283 284
284 #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY) 285 #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY)
285 void StartPrivetLister(const scoped_refptr< 286 void StartPrivetLister(const scoped_refptr<
286 local_discovery::ServiceDiscoverySharedClient>& client); 287 local_discovery::ServiceDiscoverySharedClient>& client);
287 void StopPrivetLister(); 288 void StopPrivetLister();
288 void OnPrivetCapabilities(const base::DictionaryValue* capabilities); 289 void OnPrivetCapabilities(const std::string& callback_id,
290 const base::DictionaryValue* capabilities);
289 void PrivetCapabilitiesUpdateClient( 291 void PrivetCapabilitiesUpdateClient(
292 const std::string& callback_id,
290 std::unique_ptr<cloud_print::PrivetHTTPClient> http_client); 293 std::unique_ptr<cloud_print::PrivetHTTPClient> http_client);
291 void PrivetLocalPrintUpdateClient( 294 void PrivetLocalPrintUpdateClient(
292 std::string print_ticket, 295 std::string print_ticket,
293 std::string capabilities, 296 std::string capabilities,
294 gfx::Size page_size, 297 gfx::Size page_size,
295 std::unique_ptr<cloud_print::PrivetHTTPClient> http_client); 298 std::unique_ptr<cloud_print::PrivetHTTPClient> http_client);
296 bool PrivetUpdateClient( 299 bool PrivetUpdateClient(
300 const std::string& callback_id,
297 std::unique_ptr<cloud_print::PrivetHTTPClient> http_client); 301 std::unique_ptr<cloud_print::PrivetHTTPClient> http_client);
298 void StartPrivetLocalPrint(const std::string& print_ticket, 302 void StartPrivetLocalPrint(const std::string& print_ticket,
299 const std::string& capabilities, 303 const std::string& capabilities,
300 const gfx::Size& page_size); 304 const gfx::Size& page_size);
301 void SendPrivetCapabilitiesError(const std::string& id); 305 void SendPrivetCapabilitiesError(const std::string& id);
302 void PrintToPrivetPrinter(const std::string& printer_name, 306 void PrintToPrivetPrinter(const std::string& printer_name,
303 const std::string& print_ticket, 307 const std::string& print_ticket,
304 const std::string& capabilities, 308 const std::string& capabilities,
305 const gfx::Size& page_size); 309 const gfx::Size& page_size);
306 bool CreatePrivetHTTP( 310 bool CreatePrivetHTTP(
(...skipping 23 matching lines...) Expand all
330 334
331 // Called when an extension reports information requested for a provisional 335 // Called when an extension reports information requested for a provisional
332 // printer. 336 // printer.
333 // |printer_id|: The provisional printer id. 337 // |printer_id|: The provisional printer id.
334 // |printer_info|: The data reported by the extension. 338 // |printer_info|: The data reported by the extension.
335 void OnGotExtensionPrinterInfo(const std::string& printer_id, 339 void OnGotExtensionPrinterInfo(const std::string& printer_id,
336 const base::DictionaryValue& printer_info); 340 const base::DictionaryValue& printer_info);
337 341
338 // Called when an extension reports the set of print capabilites for a 342 // Called when an extension reports the set of print capabilites for a
339 // printer. 343 // printer.
340 // |printer_id|: The id of the printer whose capabilities are reported. 344 // |callback_id|: The Javascript callback to reject or resolve
341 // |capabilities|: The printer capabilities. 345 // |capabilities|: The printer capabilities.
342 void OnGotExtensionPrinterCapabilities( 346 void OnGotExtensionPrinterCapabilities(
343 const std::string& printer_id, 347 const std::string& callback_id,
344 const base::DictionaryValue& capabilities); 348 const base::DictionaryValue& capabilities);
345 349
346 // Called when an extension print job is completed. 350 // Called when an extension print job is completed.
347 // |success|: Whether the job succeeded. 351 // |success|: Whether the job succeeded.
348 // |status|: The returned print job status. Useful for reporting a specific 352 // |status|: The returned print job status. Useful for reporting a specific
349 // error. 353 // error.
350 void OnExtensionPrintResult(bool success, const std::string& status); 354 void OnExtensionPrintResult(bool success, const std::string& status);
351 355
352 // Register/unregister from notifications of changes done to the GAIA 356 // Register/unregister from notifications of changes done to the GAIA
353 // cookie. 357 // cookie.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 // Proxy for calls to the print backend. Lazily initialized since web_ui() is 412 // Proxy for calls to the print backend. Lazily initialized since web_ui() is
409 // not available at construction time. 413 // not available at construction time.
410 std::unique_ptr<printing::PrinterBackendProxy> printer_backend_proxy_; 414 std::unique_ptr<printing::PrinterBackendProxy> printer_backend_proxy_;
411 415
412 base::WeakPtrFactory<PrintPreviewHandler> weak_factory_; 416 base::WeakPtrFactory<PrintPreviewHandler> weak_factory_;
413 417
414 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler); 418 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler);
415 }; 419 };
416 420
417 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ 421 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698