OLD | NEW |
---|---|
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 |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "base/timer/timer.h" | |
16 #include "chrome/common/features.h" | 17 #include "chrome/common/features.h" |
17 #include "components/signin/core/browser/gaia_cookie_manager_service.h" | 18 #include "components/signin/core/browser/gaia_cookie_manager_service.h" |
18 #include "content/public/browser/web_ui_message_handler.h" | 19 #include "content/public/browser/web_ui_message_handler.h" |
19 #include "printing/backend/print_backend.h" | 20 #include "printing/backend/print_backend.h" |
20 #include "printing/features/features.h" | 21 #include "printing/features/features.h" |
21 #include "ui/shell_dialogs/select_file_dialog.h" | 22 #include "ui/shell_dialogs/select_file_dialog.h" |
22 | 23 |
23 #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY) | 24 #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY) |
24 #include "chrome/browser/local_discovery/service_discovery_shared_client.h" | 25 #include "chrome/browser/local_discovery/service_discovery_shared_client.h" |
25 #include "chrome/browser/printing/cloud_print/privet_local_printer_lister.h" | 26 #include "chrome/browser/printing/cloud_print/privet_local_printer_lister.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
136 void HandleGetPrivetPrinters(const base::ListValue* args); | 137 void HandleGetPrivetPrinters(const base::ListValue* args); |
137 | 138 |
138 // Starts getting all local extension managed printers. |args| is unused. | 139 // Starts getting all local extension managed printers. |args| is unused. |
139 void HandleGetExtensionPrinters(const base::ListValue* args); | 140 void HandleGetExtensionPrinters(const base::ListValue* args); |
140 | 141 |
141 // Grants an extension access to a provisional printer. First element of | 142 // Grants an extension access to a provisional printer. First element of |
142 // |args| is the provisional printer ID. | 143 // |args| is the provisional printer ID. |
143 void HandleGrantExtensionPrinterAccess(const base::ListValue* args); | 144 void HandleGrantExtensionPrinterAccess(const base::ListValue* args); |
144 | 145 |
145 // Stops getting all local privet printers. |arg| is unused. | 146 // Stops getting all local privet printers. |arg| is unused. |
146 void HandleStopGetPrivetPrinters(const base::ListValue* args); | 147 void HandleStopGetPrivetPrinters(const base::ListValue* args); |
dpapad
2017/06/07 20:58:41
Is this still used?
rbpotter
2017/06/07 21:30:19
Done. Not used.
| |
147 | 148 |
148 // Asks the initiator renderer to generate a preview. First element of |args| | 149 // Asks the initiator renderer to generate a preview. First element of |args| |
149 // is a job settings JSON string. | 150 // is a job settings JSON string. |
150 void HandleGetPreview(const base::ListValue* args); | 151 void HandleGetPreview(const base::ListValue* args); |
151 | 152 |
152 // Gets the job settings from Web UI and initiate printing. First element of | 153 // Gets the job settings from Web UI and initiate printing. First element of |
153 // |args| is a job settings JSON string. | 154 // |args| is a job settings JSON string. |
154 void HandlePrint(const base::ListValue* args); | 155 void HandlePrint(const base::ListValue* args); |
155 | 156 |
156 // Handles the request to hide the preview dialog for printing. | 157 // Handles the request to hide the preview dialog for printing. |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
279 #if defined(USE_CUPS) | 280 #if defined(USE_CUPS) |
280 void SaveCUPSColorSetting(const base::DictionaryValue* settings); | 281 void SaveCUPSColorSetting(const base::DictionaryValue* settings); |
281 | 282 |
282 void ConvertColorSettingToCUPSColorModel( | 283 void ConvertColorSettingToCUPSColorModel( |
283 base::DictionaryValue* settings) const; | 284 base::DictionaryValue* settings) const; |
284 #endif | 285 #endif |
285 | 286 |
286 #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY) | 287 #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY) |
287 void StartPrivetLister(const scoped_refptr< | 288 void StartPrivetLister(const scoped_refptr< |
288 local_discovery::ServiceDiscoverySharedClient>& client); | 289 local_discovery::ServiceDiscoverySharedClient>& client); |
290 void StopPrivetLister(); | |
289 void OnPrivetCapabilities(const base::DictionaryValue* capabilities); | 291 void OnPrivetCapabilities(const base::DictionaryValue* capabilities); |
290 void PrivetCapabilitiesUpdateClient( | 292 void PrivetCapabilitiesUpdateClient( |
291 std::unique_ptr<cloud_print::PrivetHTTPClient> http_client); | 293 std::unique_ptr<cloud_print::PrivetHTTPClient> http_client); |
292 void PrivetLocalPrintUpdateClient( | 294 void PrivetLocalPrintUpdateClient( |
293 std::string print_ticket, | 295 std::string print_ticket, |
294 std::string capabilities, | 296 std::string capabilities, |
295 gfx::Size page_size, | 297 gfx::Size page_size, |
296 std::unique_ptr<cloud_print::PrivetHTTPClient> http_client); | 298 std::unique_ptr<cloud_print::PrivetHTTPClient> http_client); |
297 bool PrivetUpdateClient( | 299 bool PrivetUpdateClient( |
298 std::unique_ptr<cloud_print::PrivetHTTPClient> http_client); | 300 std::unique_ptr<cloud_print::PrivetHTTPClient> http_client); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
377 std::unique_ptr<AccessTokenService> token_service_; | 379 std::unique_ptr<AccessTokenService> token_service_; |
378 | 380 |
379 // Pointer to cookie manager service so that print preview can listen for GAIA | 381 // Pointer to cookie manager service so that print preview can listen for GAIA |
380 // cookie changes. | 382 // cookie changes. |
381 GaiaCookieManagerService* gaia_cookie_manager_service_; | 383 GaiaCookieManagerService* gaia_cookie_manager_service_; |
382 | 384 |
383 #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY) | 385 #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY) |
384 scoped_refptr<local_discovery::ServiceDiscoverySharedClient> | 386 scoped_refptr<local_discovery::ServiceDiscoverySharedClient> |
385 service_discovery_client_; | 387 service_discovery_client_; |
386 std::unique_ptr<cloud_print::PrivetLocalPrinterLister> printer_lister_; | 388 std::unique_ptr<cloud_print::PrivetLocalPrinterLister> printer_lister_; |
387 | 389 std::unique_ptr<base::OneShotTimer> privet_lister_timer_; |
388 std::unique_ptr<cloud_print::PrivetHTTPAsynchronousFactory> | 390 std::unique_ptr<cloud_print::PrivetHTTPAsynchronousFactory> |
389 privet_http_factory_; | 391 privet_http_factory_; |
390 std::unique_ptr<cloud_print::PrivetHTTPResolution> privet_http_resolution_; | 392 std::unique_ptr<cloud_print::PrivetHTTPResolution> privet_http_resolution_; |
391 std::unique_ptr<cloud_print::PrivetV1HTTPClient> privet_http_client_; | 393 std::unique_ptr<cloud_print::PrivetV1HTTPClient> privet_http_client_; |
392 std::unique_ptr<cloud_print::PrivetJSONOperation> | 394 std::unique_ptr<cloud_print::PrivetJSONOperation> |
393 privet_capabilities_operation_; | 395 privet_capabilities_operation_; |
394 std::unique_ptr<cloud_print::PrivetLocalPrintOperation> | 396 std::unique_ptr<cloud_print::PrivetLocalPrintOperation> |
395 privet_local_print_operation_; | 397 privet_local_print_operation_; |
396 #endif | 398 #endif |
397 | 399 |
398 // Handles requests for extension printers. Created lazily by calling | 400 // Handles requests for extension printers. Created lazily by calling |
399 // |EnsureExtensionPrinterHandlerSet|. | 401 // |EnsureExtensionPrinterHandlerSet|. |
400 std::unique_ptr<PrinterHandler> extension_printer_handler_; | 402 std::unique_ptr<PrinterHandler> extension_printer_handler_; |
401 | 403 |
402 // Notifies tests that want to know if the PDF has been saved. This doesn't | 404 // Notifies tests that want to know if the PDF has been saved. This doesn't |
403 // notify the test if it was a successful save, only that it was attempted. | 405 // notify the test if it was a successful save, only that it was attempted. |
404 base::Closure pdf_file_saved_closure_; | 406 base::Closure pdf_file_saved_closure_; |
405 | 407 |
408 // Callback ID to be used to notify UI that privet search is finished. | |
409 std::string privet_callback_id_ = ""; | |
410 | |
406 // Proxy for calls to the print backend. Lazily initialized since web_ui() is | 411 // Proxy for calls to the print backend. Lazily initialized since web_ui() is |
407 // not available at construction time. | 412 // not available at construction time. |
408 std::unique_ptr<printing::PrinterBackendProxy> printer_backend_proxy_; | 413 std::unique_ptr<printing::PrinterBackendProxy> printer_backend_proxy_; |
409 | 414 |
410 base::WeakPtrFactory<PrintPreviewHandler> weak_factory_; | 415 base::WeakPtrFactory<PrintPreviewHandler> weak_factory_; |
411 | 416 |
412 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler); | 417 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler); |
413 }; | 418 }; |
414 | 419 |
415 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ | 420 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ |
OLD | NEW |