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_PRINTING_PRINT_VIEW_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_H_ |
6 #define CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_H_ | 6 #define CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_H_ |
7 | 7 |
8 #include "chrome/browser/printing/print_view_manager_base.h" | 8 #include "chrome/browser/printing/print_view_manager_base.h" |
9 #include "content/public/browser/web_contents_user_data.h" | 9 #include "content/public/browser/web_contents_user_data.h" |
10 | 10 |
11 namespace content { | 11 namespace content { |
12 class RenderProcessHost; | 12 class RenderProcessHost; |
13 } | 13 } |
14 | 14 |
15 namespace printing { | 15 namespace printing { |
16 | 16 |
17 class PrintViewManagerObserver; | 17 class PrintViewManagerObserver; |
18 | 18 |
19 // Manages the print commands for a WebContents. | 19 // Manages the print commands for a WebContents. |
20 class PrintViewManager : public PrintViewManagerBase, | 20 class PrintViewManager : public PrintViewManagerBase, |
21 public content::WebContentsUserData<PrintViewManager> { | 21 public content::WebContentsUserData<PrintViewManager> { |
22 public: | 22 public: |
23 virtual ~PrintViewManager(); | 23 ~PrintViewManager() override; |
24 | 24 |
25 #if !defined(DISABLE_BASIC_PRINTING) | 25 #if !defined(DISABLE_BASIC_PRINTING) |
26 // Same as PrintNow(), but for the case where a user prints with the system | 26 // Same as PrintNow(), but for the case where a user prints with the system |
27 // dialog from print preview. | 27 // dialog from print preview. |
28 bool PrintForSystemDialogNow(); | 28 bool PrintForSystemDialogNow(); |
29 | 29 |
30 // Same as PrintNow(), but for the case where a user press "ctrl+shift+p" to | 30 // Same as PrintNow(), but for the case where a user press "ctrl+shift+p" to |
31 // show the native system dialog. This can happen from both initiator and | 31 // show the native system dialog. This can happen from both initiator and |
32 // preview dialog. | 32 // preview dialog. |
33 bool BasicPrint(); | 33 bool BasicPrint(); |
(...skipping 12 matching lines...) Expand all Loading... |
46 // Notify PrintViewManager that print preview has finished. Unfreeze the | 46 // Notify PrintViewManager that print preview has finished. Unfreeze the |
47 // renderer in the case of scripted print preview. | 47 // renderer in the case of scripted print preview. |
48 void PrintPreviewDone(); | 48 void PrintPreviewDone(); |
49 | 49 |
50 // Sets |observer| as the current PrintViewManagerObserver. Pass in NULL to | 50 // Sets |observer| as the current PrintViewManagerObserver. Pass in NULL to |
51 // remove the current observer. |observer| may always be NULL, but |observer_| | 51 // remove the current observer. |observer| may always be NULL, but |observer_| |
52 // must be NULL if |observer| is non-NULL. | 52 // must be NULL if |observer| is non-NULL. |
53 void set_observer(PrintViewManagerObserver* observer); | 53 void set_observer(PrintViewManagerObserver* observer); |
54 | 54 |
55 // content::WebContentsObserver implementation. | 55 // content::WebContentsObserver implementation. |
56 virtual bool OnMessageReceived(const IPC::Message& message) override; | 56 bool OnMessageReceived(const IPC::Message& message) override; |
57 | 57 |
58 // content::WebContentsObserver implementation. | 58 // content::WebContentsObserver implementation. |
59 // Terminates or cancels the print job if one was pending. | 59 // Terminates or cancels the print job if one was pending. |
60 virtual void RenderProcessGone(base::TerminationStatus status) override; | 60 void RenderProcessGone(base::TerminationStatus status) override; |
61 | 61 |
62 private: | 62 private: |
63 explicit PrintViewManager(content::WebContents* web_contents); | 63 explicit PrintViewManager(content::WebContents* web_contents); |
64 friend class content::WebContentsUserData<PrintViewManager>; | 64 friend class content::WebContentsUserData<PrintViewManager>; |
65 | 65 |
66 enum PrintPreviewState { | 66 enum PrintPreviewState { |
67 NOT_PREVIEWING, | 67 NOT_PREVIEWING, |
68 USER_INITIATED_PREVIEW, | 68 USER_INITIATED_PREVIEW, |
69 SCRIPTED_PREVIEW, | 69 SCRIPTED_PREVIEW, |
70 }; | 70 }; |
(...skipping 13 matching lines...) Expand all Loading... |
84 | 84 |
85 // Keeps track of the pending callback during scripted print preview. | 85 // Keeps track of the pending callback during scripted print preview. |
86 content::RenderProcessHost* scripted_print_preview_rph_; | 86 content::RenderProcessHost* scripted_print_preview_rph_; |
87 | 87 |
88 DISALLOW_COPY_AND_ASSIGN(PrintViewManager); | 88 DISALLOW_COPY_AND_ASSIGN(PrintViewManager); |
89 }; | 89 }; |
90 | 90 |
91 } // namespace printing | 91 } // namespace printing |
92 | 92 |
93 #endif // CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_H_ | 93 #endif // CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_H_ |
OLD | NEW |