OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_BASE_H_ | 5 #ifndef CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_BASE_H_ |
6 #define CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_BASE_H_ | 6 #define CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_BASE_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/prefs/pref_member.h" | 9 #include "base/prefs/pref_member.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 class MetafilePlayer; | 26 class MetafilePlayer; |
27 class PrintJob; | 27 class PrintJob; |
28 class PrintJobWorkerOwner; | 28 class PrintJobWorkerOwner; |
29 class PrintQueriesQueue; | 29 class PrintQueriesQueue; |
30 | 30 |
31 // Base class for managing the print commands for a WebContents. | 31 // Base class for managing the print commands for a WebContents. |
32 class PrintViewManagerBase : public content::NotificationObserver, | 32 class PrintViewManagerBase : public content::NotificationObserver, |
33 public PrintedPagesSource, | 33 public PrintedPagesSource, |
34 public content::WebContentsObserver { | 34 public content::WebContentsObserver { |
35 public: | 35 public: |
36 virtual ~PrintViewManagerBase(); | 36 ~PrintViewManagerBase() override; |
37 | 37 |
38 #if !defined(DISABLE_BASIC_PRINTING) | 38 #if !defined(DISABLE_BASIC_PRINTING) |
39 // Prints the current document immediately. Since the rendering is | 39 // Prints the current document immediately. Since the rendering is |
40 // asynchronous, the actual printing will not be completed on the return of | 40 // asynchronous, the actual printing will not be completed on the return of |
41 // this function. Returns false if printing is impossible at the moment. | 41 // this function. Returns false if printing is impossible at the moment. |
42 virtual bool PrintNow(); | 42 virtual bool PrintNow(); |
43 #endif // !DISABLE_BASIC_PRINTING | 43 #endif // !DISABLE_BASIC_PRINTING |
44 | 44 |
45 // Whether to block scripted printing for our tab or not. | 45 // Whether to block scripted printing for our tab or not. |
46 void UpdateScriptedPrintingBlocked(); | 46 void UpdateScriptedPrintingBlocked(); |
47 | 47 |
48 // PrintedPagesSource implementation. | 48 // PrintedPagesSource implementation. |
49 virtual base::string16 RenderSourceName() override; | 49 base::string16 RenderSourceName() override; |
50 | 50 |
51 protected: | 51 protected: |
52 explicit PrintViewManagerBase(content::WebContents* web_contents); | 52 explicit PrintViewManagerBase(content::WebContents* web_contents); |
53 | 53 |
54 // Helper method for Print*Now(). | 54 // Helper method for Print*Now(). |
55 bool PrintNowInternal(IPC::Message* message); | 55 bool PrintNowInternal(IPC::Message* message); |
56 | 56 |
57 // Terminates or cancels the print job if one was pending. | 57 // Terminates or cancels the print job if one was pending. |
58 virtual void RenderProcessGone(base::TerminationStatus status) override; | 58 void RenderProcessGone(base::TerminationStatus status) override; |
59 | 59 |
60 // content::WebContentsObserver implementation. | 60 // content::WebContentsObserver implementation. |
61 virtual bool OnMessageReceived(const IPC::Message& message) override; | 61 bool OnMessageReceived(const IPC::Message& message) override; |
62 | 62 |
63 // IPC Message handlers. | 63 // IPC Message handlers. |
64 virtual void OnPrintingFailed(int cookie); | 64 virtual void OnPrintingFailed(int cookie); |
65 | 65 |
66 private: | 66 private: |
67 // content::NotificationObserver implementation. | 67 // content::NotificationObserver implementation. |
68 virtual void Observe(int type, | 68 void Observe(int type, |
69 const content::NotificationSource& source, | 69 const content::NotificationSource& source, |
70 const content::NotificationDetails& details) override; | 70 const content::NotificationDetails& details) override; |
71 | 71 |
72 // content::WebContentsObserver implementation. | 72 // content::WebContentsObserver implementation. |
73 virtual void DidStartLoading( | 73 void DidStartLoading(content::RenderViewHost* render_view_host) override; |
74 content::RenderViewHost* render_view_host) override; | |
75 | 74 |
76 // Cancels the print job. | 75 // Cancels the print job. |
77 virtual void NavigationStopped() override; | 76 void NavigationStopped() override; |
78 | 77 |
79 // IPC Message handlers. | 78 // IPC Message handlers. |
80 void OnDidGetPrintedPagesCount(int cookie, int number_pages); | 79 void OnDidGetPrintedPagesCount(int cookie, int number_pages); |
81 void OnDidGetDocumentCookie(int cookie); | 80 void OnDidGetDocumentCookie(int cookie); |
82 void OnDidPrintPage(const PrintHostMsg_DidPrintPage_Params& params); | 81 void OnDidPrintPage(const PrintHostMsg_DidPrintPage_Params& params); |
83 void OnShowInvalidPrinterSettingsError(); | 82 void OnShowInvalidPrinterSettingsError(); |
84 | 83 |
85 // Processes a NOTIFY_PRINT_JOB_EVENT notification. | 84 // Processes a NOTIFY_PRINT_JOB_EVENT notification. |
86 void OnNotifyPrintJobEvent(const JobEventDetails& event_details); | 85 void OnNotifyPrintJobEvent(const JobEventDetails& event_details); |
87 | 86 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 BooleanPrefMember printing_enabled_; | 160 BooleanPrefMember printing_enabled_; |
162 | 161 |
163 scoped_refptr<printing::PrintQueriesQueue> queue_; | 162 scoped_refptr<printing::PrintQueriesQueue> queue_; |
164 | 163 |
165 DISALLOW_COPY_AND_ASSIGN(PrintViewManagerBase); | 164 DISALLOW_COPY_AND_ASSIGN(PrintViewManagerBase); |
166 }; | 165 }; |
167 | 166 |
168 } // namespace printing | 167 } // namespace printing |
169 | 168 |
170 #endif // CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_BASE_H_ | 169 #endif // CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_BASE_H_ |
OLD | NEW |