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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 : public content::WebUIMessageHandler, | 42 : public content::WebUIMessageHandler, |
43 #if defined(ENABLE_SERVICE_DISCOVERY) | 43 #if defined(ENABLE_SERVICE_DISCOVERY) |
44 public local_discovery::PrivetLocalPrinterLister::Delegate, | 44 public local_discovery::PrivetLocalPrinterLister::Delegate, |
45 public local_discovery::PrivetLocalPrintOperation::Delegate, | 45 public local_discovery::PrivetLocalPrintOperation::Delegate, |
46 #endif | 46 #endif |
47 public ui::SelectFileDialog::Listener, | 47 public ui::SelectFileDialog::Listener, |
48 public printing::PrintViewManagerObserver, | 48 public printing::PrintViewManagerObserver, |
49 public MergeSessionHelper::Observer { | 49 public MergeSessionHelper::Observer { |
50 public: | 50 public: |
51 PrintPreviewHandler(); | 51 PrintPreviewHandler(); |
52 virtual ~PrintPreviewHandler(); | 52 ~PrintPreviewHandler() override; |
53 | 53 |
54 // WebUIMessageHandler implementation. | 54 // WebUIMessageHandler implementation. |
55 virtual void RegisterMessages() override; | 55 void RegisterMessages() override; |
56 | 56 |
57 // SelectFileDialog::Listener implementation. | 57 // SelectFileDialog::Listener implementation. |
58 virtual void FileSelected(const base::FilePath& path, | 58 void FileSelected(const base::FilePath& path, |
59 int index, | 59 int index, |
60 void* params) override; | 60 void* params) override; |
61 virtual void FileSelectionCanceled(void* params) override; | 61 void FileSelectionCanceled(void* params) override; |
62 | 62 |
63 // PrintViewManagerObserver implementation. | 63 // PrintViewManagerObserver implementation. |
64 virtual void OnPrintDialogShown() override; | 64 void OnPrintDialogShown() override; |
65 | 65 |
66 // MergeSessionHelper::Observer implementation. | 66 // MergeSessionHelper::Observer implementation. |
67 virtual void MergeSessionCompleted( | 67 void MergeSessionCompleted(const std::string& account_id, |
68 const std::string& account_id, | 68 const GoogleServiceAuthError& error) override; |
69 const GoogleServiceAuthError& error) override; | |
70 | 69 |
71 // Displays a modal dialog, prompting the user to select a file. | 70 // Displays a modal dialog, prompting the user to select a file. |
72 void SelectFile(const base::FilePath& default_path); | 71 void SelectFile(const base::FilePath& default_path); |
73 | 72 |
74 // Called when the print preview dialog is destroyed. This is the last time | 73 // Called when the print preview dialog is destroyed. This is the last time |
75 // this object has access to the PrintViewManager in order to disconnect the | 74 // this object has access to the PrintViewManager in order to disconnect the |
76 // observer. | 75 // observer. |
77 void OnPrintPreviewDialogDestroyed(); | 76 void OnPrintPreviewDialogDestroyed(); |
78 | 77 |
79 // Called when print preview failed. | 78 // Called when print preview failed. |
80 void OnPrintPreviewFailed(); | 79 void OnPrintPreviewFailed(); |
81 | 80 |
82 #if !defined(DISABLE_BASIC_PRINTING) | 81 #if !defined(DISABLE_BASIC_PRINTING) |
83 // Called when the user press ctrl+shift+p to display the native system | 82 // Called when the user press ctrl+shift+p to display the native system |
84 // dialog. | 83 // dialog. |
85 void ShowSystemDialog(); | 84 void ShowSystemDialog(); |
86 #endif // !DISABLE_BASIC_PRINTING | 85 #endif // !DISABLE_BASIC_PRINTING |
87 | 86 |
88 #if defined(ENABLE_SERVICE_DISCOVERY) | 87 #if defined(ENABLE_SERVICE_DISCOVERY) |
89 // PrivetLocalPrinterLister::Delegate implementation. | 88 // PrivetLocalPrinterLister::Delegate implementation. |
90 virtual void LocalPrinterChanged( | 89 void LocalPrinterChanged( |
91 bool added, | 90 bool added, |
92 const std::string& name, | 91 const std::string& name, |
93 bool has_local_printing, | 92 bool has_local_printing, |
94 const local_discovery::DeviceDescription& description) override; | 93 const local_discovery::DeviceDescription& description) override; |
95 virtual void LocalPrinterRemoved(const std::string& name) override; | 94 void LocalPrinterRemoved(const std::string& name) override; |
96 virtual void LocalPrinterCacheFlushed() override; | 95 void LocalPrinterCacheFlushed() override; |
97 | 96 |
98 // PrivetLocalPrintOperation::Delegate implementation. | 97 // PrivetLocalPrintOperation::Delegate implementation. |
99 virtual void OnPrivetPrintingDone( | 98 void OnPrivetPrintingDone(const local_discovery::PrivetLocalPrintOperation* |
100 const local_discovery::PrivetLocalPrintOperation* | 99 print_operation) override; |
101 print_operation) override; | 100 void OnPrivetPrintingError( |
102 virtual void OnPrivetPrintingError( | |
103 const local_discovery::PrivetLocalPrintOperation* print_operation, | 101 const local_discovery::PrivetLocalPrintOperation* print_operation, |
104 int http_code) override; | 102 int http_code) override; |
105 #endif // ENABLE_SERVICE_DISCOVERY | 103 #endif // ENABLE_SERVICE_DISCOVERY |
106 int regenerate_preview_request_count() const { | 104 int regenerate_preview_request_count() const { |
107 return regenerate_preview_request_count_; | 105 return regenerate_preview_request_count_; |
108 } | 106 } |
109 | 107 |
110 // Sets |pdf_file_saved_closure_| to |closure|. | 108 // Sets |pdf_file_saved_closure_| to |closure|. |
111 void SetPdfSavedClosureForTesting(const base::Closure& closure); | 109 void SetPdfSavedClosureForTesting(const base::Closure& closure); |
112 | 110 |
113 private: | 111 private: |
114 friend class PrintPreviewPdfGeneratedBrowserTest; | 112 friend class PrintPreviewPdfGeneratedBrowserTest; |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 // Notifies tests that want to know if the PDF has been saved. This doesn't | 340 // Notifies tests that want to know if the PDF has been saved. This doesn't |
343 // notify the test if it was a successful save, only that it was attempted. | 341 // notify the test if it was a successful save, only that it was attempted. |
344 base::Closure pdf_file_saved_closure_; | 342 base::Closure pdf_file_saved_closure_; |
345 | 343 |
346 base::WeakPtrFactory<PrintPreviewHandler> weak_factory_; | 344 base::WeakPtrFactory<PrintPreviewHandler> weak_factory_; |
347 | 345 |
348 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler); | 346 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler); |
349 }; | 347 }; |
350 | 348 |
351 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ | 349 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ |
OLD | NEW |