| 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 #include <vector> |
| 10 | 11 |
| 11 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 12 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 16 #include "base/timer/timer.h" | 17 #include "base/timer/timer.h" |
| 17 #include "chrome/common/features.h" | 18 #include "chrome/common/features.h" |
| 18 #include "components/signin/core/browser/gaia_cookie_manager_service.h" | 19 #include "components/signin/core/browser/gaia_cookie_manager_service.h" |
| 19 #include "content/public/browser/web_ui_message_handler.h" | 20 #include "content/public/browser/web_ui_message_handler.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 int index, | 68 int index, |
| 68 void* params) override; | 69 void* params) override; |
| 69 void FileSelectionCanceled(void* params) override; | 70 void FileSelectionCanceled(void* params) override; |
| 70 | 71 |
| 71 // GaiaCookieManagerService::Observer implementation. | 72 // GaiaCookieManagerService::Observer implementation. |
| 72 void OnAddAccountToCookieCompleted( | 73 void OnAddAccountToCookieCompleted( |
| 73 const std::string& account_id, | 74 const std::string& account_id, |
| 74 const GoogleServiceAuthError& error) override; | 75 const GoogleServiceAuthError& error) override; |
| 75 | 76 |
| 76 // Called when print preview failed. | 77 // Called when print preview failed. |
| 77 void OnPrintPreviewFailed(); | 78 void OnPrintPreviewFailed(int request_id); |
| 79 |
| 80 // Called when printer settings were invalid. |
| 81 void OnInvalidPrinterSettings(int request_id); |
| 82 |
| 83 // Called when print preview is ready. |
| 84 void OnPrintPreviewReady(int preview_uid, int request_id); |
| 78 | 85 |
| 79 #if BUILDFLAG(ENABLE_BASIC_PRINTING) | 86 #if BUILDFLAG(ENABLE_BASIC_PRINTING) |
| 80 // Called when the user press ctrl+shift+p to display the native system | 87 // Called when the user press ctrl+shift+p to display the native system |
| 81 // dialog. | 88 // dialog. |
| 82 void ShowSystemDialog(); | 89 void ShowSystemDialog(); |
| 83 #endif // BUILDFLAG(ENABLE_BASIC_PRINTING) | 90 #endif // BUILDFLAG(ENABLE_BASIC_PRINTING) |
| 84 | 91 |
| 85 #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY) | 92 #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY) |
| 86 // PrivetLocalPrinterLister::Delegate implementation. | 93 // PrivetLocalPrinterLister::Delegate implementation. |
| 87 void LocalPrinterChanged( | 94 void LocalPrinterChanged( |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 #endif | 421 #endif |
| 415 | 422 |
| 416 // Handles requests for extension printers. Created lazily by calling | 423 // Handles requests for extension printers. Created lazily by calling |
| 417 // |EnsureExtensionPrinterHandlerSet|. | 424 // |EnsureExtensionPrinterHandlerSet|. |
| 418 std::unique_ptr<PrinterHandler> extension_printer_handler_; | 425 std::unique_ptr<PrinterHandler> extension_printer_handler_; |
| 419 | 426 |
| 420 // Notifies tests that want to know if the PDF has been saved. This doesn't | 427 // Notifies tests that want to know if the PDF has been saved. This doesn't |
| 421 // notify the test if it was a successful save, only that it was attempted. | 428 // notify the test if it was a successful save, only that it was attempted. |
| 422 base::Closure pdf_file_saved_closure_; | 429 base::Closure pdf_file_saved_closure_; |
| 423 | 430 |
| 431 std::vector<std::string> preview_callbacks_; |
| 432 |
| 424 #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY) | 433 #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY) |
| 425 // Callback ID to be used to notify UI that privet search is finished. | 434 // Callback ID to be used to notify UI that privet search is finished. |
| 426 std::string privet_search_callback_id_; | 435 std::string privet_search_callback_id_; |
| 427 | 436 |
| 428 // Callback ID to be used to notify UI that privet printing is finished. | 437 // Callback ID to be used to notify UI that privet printing is finished. |
| 429 std::string privet_print_callback_id_; | 438 std::string privet_print_callback_id_; |
| 430 #endif | 439 #endif |
| 431 | 440 |
| 432 // Callback ID to be used to notify UI that PDF file selection has finished. | 441 // Callback ID to be used to notify UI that PDF file selection has finished. |
| 433 std::string pdf_callback_id_; | 442 std::string pdf_callback_id_; |
| 434 | 443 |
| 435 // Print settings to use in the local print request to send when | 444 // Print settings to use in the local print request to send when |
| 436 // HandleHidePreview() is called. | 445 // HandleHidePreview() is called. |
| 437 std::unique_ptr<base::DictionaryValue> settings_; | 446 std::unique_ptr<base::DictionaryValue> settings_; |
| 438 | 447 |
| 439 // Proxy for calls to the print backend. Lazily initialized since web_ui() is | 448 // Proxy for calls to the print backend. Lazily initialized since web_ui() is |
| 440 // not available at construction time. | 449 // not available at construction time. |
| 441 std::unique_ptr<printing::PrinterBackendProxy> printer_backend_proxy_; | 450 std::unique_ptr<printing::PrinterBackendProxy> printer_backend_proxy_; |
| 442 | 451 |
| 443 base::WeakPtrFactory<PrintPreviewHandler> weak_factory_; | 452 base::WeakPtrFactory<PrintPreviewHandler> weak_factory_; |
| 444 | 453 |
| 445 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler); | 454 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler); |
| 446 }; | 455 }; |
| 447 | 456 |
| 448 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ | 457 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ |
| OLD | NEW |