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

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

Issue 2962983002: Print Preview: change getPreview to cr.sendWithPromise (Closed)
Patch Set: Fix check Created 3 years, 5 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 <queue>
9 #include <string> 10 #include <string>
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"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
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();
78 79
80 // Called when print preview is cancelled due to a new request.
81 void OnPrintPreviewCancelled();
82
83 // Called when printer settings were invalid.
84 void OnInvalidPrinterSettings();
85
86 // Called when print preview is ready.
87 void OnPrintPreviewReady(int preview_uid, int request_id);
88
79 #if BUILDFLAG(ENABLE_BASIC_PRINTING) 89 #if BUILDFLAG(ENABLE_BASIC_PRINTING)
80 // Called when the user press ctrl+shift+p to display the native system 90 // Called when the user press ctrl+shift+p to display the native system
81 // dialog. 91 // dialog.
82 void ShowSystemDialog(); 92 void ShowSystemDialog();
83 #endif // BUILDFLAG(ENABLE_BASIC_PRINTING) 93 #endif // BUILDFLAG(ENABLE_BASIC_PRINTING)
84 94
85 #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY) 95 #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY)
86 // PrivetLocalPrinterLister::Delegate implementation. 96 // PrivetLocalPrinterLister::Delegate implementation.
87 void LocalPrinterChanged( 97 void LocalPrinterChanged(
88 const std::string& name, 98 const std::string& name,
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 #endif 424 #endif
415 425
416 // Handles requests for extension printers. Created lazily by calling 426 // Handles requests for extension printers. Created lazily by calling
417 // |EnsureExtensionPrinterHandlerSet|. 427 // |EnsureExtensionPrinterHandlerSet|.
418 std::unique_ptr<PrinterHandler> extension_printer_handler_; 428 std::unique_ptr<PrinterHandler> extension_printer_handler_;
419 429
420 // Notifies tests that want to know if the PDF has been saved. This doesn't 430 // 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. 431 // notify the test if it was a successful save, only that it was attempted.
422 base::Closure pdf_file_saved_closure_; 432 base::Closure pdf_file_saved_closure_;
423 433
434 std::queue<std::string> preview_callbacks_;
435
424 #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY) 436 #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY)
425 // Callback ID to be used to notify UI that privet search is finished. 437 // Callback ID to be used to notify UI that privet search is finished.
426 std::string privet_search_callback_id_; 438 std::string privet_search_callback_id_;
427 439
428 // Callback ID to be used to notify UI that privet printing is finished. 440 // Callback ID to be used to notify UI that privet printing is finished.
429 std::string privet_print_callback_id_; 441 std::string privet_print_callback_id_;
430 #endif 442 #endif
431 443
432 // Callback ID to be used to notify UI that PDF file selection has finished. 444 // Callback ID to be used to notify UI that PDF file selection has finished.
433 std::string pdf_callback_id_; 445 std::string pdf_callback_id_;
434 446
435 // Print settings to use in the local print request to send when 447 // Print settings to use in the local print request to send when
436 // HandleHidePreview() is called. 448 // HandleHidePreview() is called.
437 std::unique_ptr<base::DictionaryValue> settings_; 449 std::unique_ptr<base::DictionaryValue> settings_;
438 450
439 // Proxy for calls to the print backend. Lazily initialized since web_ui() is 451 // Proxy for calls to the print backend. Lazily initialized since web_ui() is
440 // not available at construction time. 452 // not available at construction time.
441 std::unique_ptr<printing::PrinterBackendProxy> printer_backend_proxy_; 453 std::unique_ptr<printing::PrinterBackendProxy> printer_backend_proxy_;
442 454
443 base::WeakPtrFactory<PrintPreviewHandler> weak_factory_; 455 base::WeakPtrFactory<PrintPreviewHandler> weak_factory_;
444 456
445 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler); 457 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler);
446 }; 458 };
447 459
448 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ 460 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698