OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_HANDLER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "chrome/browser/printing/print_view_manager_observer.h" | |
11 #include "chrome/browser/ui/shell_dialogs.h" | 12 #include "chrome/browser/ui/shell_dialogs.h" |
12 #include "content/browser/webui/web_ui.h" | 13 #include "content/browser/webui/web_ui.h" |
13 | 14 |
14 class FilePath; | 15 class FilePath; |
15 class FundamentalValue; | 16 class FundamentalValue; |
16 class PrintSystemTaskProxy; | 17 class PrintSystemTaskProxy; |
17 class StringValue; | 18 class StringValue; |
18 | 19 |
19 namespace printing { | 20 namespace printing { |
20 class PrintBackend; | 21 class PrintBackend; |
21 } | 22 } |
22 | 23 |
23 // The handler for Javascript messages related to the "print preview" dialog. | 24 // The handler for Javascript messages related to the "print preview" dialog. |
24 class PrintPreviewHandler : public WebUIMessageHandler, | 25 class PrintPreviewHandler : public WebUIMessageHandler, |
25 public base::SupportsWeakPtr<PrintPreviewHandler>, | 26 public base::SupportsWeakPtr<PrintPreviewHandler>, |
26 public SelectFileDialog::Listener { | 27 public SelectFileDialog::Listener, |
28 public printing::PrintViewManagerObserver { | |
27 public: | 29 public: |
28 PrintPreviewHandler(); | 30 PrintPreviewHandler(); |
29 virtual ~PrintPreviewHandler(); | 31 virtual ~PrintPreviewHandler(); |
30 | 32 |
31 // WebUIMessageHandler implementation. | 33 // WebUIMessageHandler implementation. |
32 virtual void RegisterMessages(); | 34 virtual void RegisterMessages(); |
33 | 35 |
34 // SelectFileDialog::Listener implementation. | 36 // SelectFileDialog::Listener implementation. |
35 virtual void FileSelected(const FilePath& path, int index, void* params); | 37 virtual void FileSelected(const FilePath& path, int index, void* params); |
36 virtual void FileSelectionCanceled(void* params); | 38 virtual void FileSelectionCanceled(void* params); |
37 | 39 |
40 // PrintViewManagerObserver implementation. | |
41 virtual void OnPrintDialogShown(); | |
42 | |
38 // Displays a modal dialog, prompting the user to select a file. | 43 // Displays a modal dialog, prompting the user to select a file. |
39 void SelectFile(const FilePath& default_path); | 44 void SelectFile(const FilePath& default_path); |
40 | 45 |
46 // | |
Lei Zhang
2011/06/28 09:15:38
comment?
James Hawkins
2011/06/28 18:15:36
Whoops, done.
| |
47 void OnNavigation(); | |
48 | |
41 private: | 49 private: |
42 friend class PrintSystemTaskProxy; | 50 friend class PrintSystemTaskProxy; |
43 | 51 |
44 TabContents* preview_tab(); | 52 TabContents* preview_tab(); |
45 | 53 |
46 // Get the default printer. |args| is unused. | 54 // Get the default printer. |args| is unused. |
47 void HandleGetDefaultPrinter(const ListValue* args); | 55 void HandleGetDefaultPrinter(const ListValue* args); |
48 | 56 |
49 // Get the list of printers. |args| is unused. | 57 // Get the list of printers. |args| is unused. |
50 void HandleGetPrinters(const ListValue* args); | 58 void HandleGetPrinters(const ListValue* args); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
128 // Whether we have already logged a failed print preview. | 136 // Whether we have already logged a failed print preview. |
129 bool reported_failed_preview_; | 137 bool reported_failed_preview_; |
130 | 138 |
131 // Whether we have already logged the number of printers this session. | 139 // Whether we have already logged the number of printers this session. |
132 bool has_logged_printers_count_; | 140 bool has_logged_printers_count_; |
133 | 141 |
134 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler); | 142 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler); |
135 }; | 143 }; |
136 | 144 |
137 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_HANDLER_H_ | 145 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_HANDLER_H_ |
OLD | NEW |