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

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: Re-comment test 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 <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
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
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 bool printing_started_ = false; 444 bool printing_started_ = false;
436 445
437 // Proxy for calls to the print backend. Lazily initialized since web_ui() is 446 // Proxy for calls to the print backend. Lazily initialized since web_ui() is
438 // not available at construction time. 447 // not available at construction time.
439 std::unique_ptr<printing::PrinterBackendProxy> printer_backend_proxy_; 448 std::unique_ptr<printing::PrinterBackendProxy> printer_backend_proxy_;
440 449
441 base::WeakPtrFactory<PrintPreviewHandler> weak_factory_; 450 base::WeakPtrFactory<PrintPreviewHandler> weak_factory_;
442 451
443 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler); 452 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler);
444 }; 453 };
445 454
446 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ 455 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698