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 "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/prefs/public/pref_observer.h" |
9 #include "base/string16.h" | 10 #include "base/string16.h" |
10 #include "chrome/browser/api/prefs/pref_member.h" | 11 #include "chrome/browser/api/prefs/pref_member.h" |
11 #include "content/public/browser/notification_observer.h" | 12 #include "content/public/browser/notification_observer.h" |
12 #include "content/public/browser/notification_registrar.h" | 13 #include "content/public/browser/notification_registrar.h" |
13 #include "content/public/browser/web_contents_observer.h" | 14 #include "content/public/browser/web_contents_observer.h" |
14 #include "content/public/browser/web_contents_user_data.h" | 15 #include "content/public/browser/web_contents_user_data.h" |
15 #include "printing/printed_pages_source.h" | 16 #include "printing/printed_pages_source.h" |
16 | 17 |
17 struct PrintHostMsg_DidPrintPage_Params; | 18 struct PrintHostMsg_DidPrintPage_Params; |
18 | 19 |
19 namespace content { | 20 namespace content { |
20 class RenderProcessHost; | 21 class RenderProcessHost; |
21 class RenderViewHost; | 22 class RenderViewHost; |
22 } | 23 } |
23 | 24 |
24 namespace printing { | 25 namespace printing { |
25 | 26 |
26 class JobEventDetails; | 27 class JobEventDetails; |
27 class PrintJob; | 28 class PrintJob; |
28 class PrintJobWorkerOwner; | 29 class PrintJobWorkerOwner; |
29 class PrintViewManagerObserver; | 30 class PrintViewManagerObserver; |
30 | 31 |
31 // Manages the print commands for a WebContents. | 32 // Manages the print commands for a WebContents. |
32 class PrintViewManager : public content::NotificationObserver, | 33 class PrintViewManager : public content::NotificationObserver, |
| 34 public PrefObserver, |
33 public PrintedPagesSource, | 35 public PrintedPagesSource, |
34 public content::WebContentsObserver, | 36 public content::WebContentsObserver, |
35 public content::WebContentsUserData<PrintViewManager> { | 37 public content::WebContentsUserData<PrintViewManager> { |
36 public: | 38 public: |
37 virtual ~PrintViewManager(); | 39 virtual ~PrintViewManager(); |
38 | 40 |
39 // Prints the current document immediately. Since the rendering is | 41 // Prints the current document immediately. Since the rendering is |
40 // asynchronous, the actual printing will not be completed on the return of | 42 // asynchronous, the actual printing will not be completed on the return of |
41 // this function. Returns false if printing is impossible at the moment. | 43 // this function. Returns false if printing is impossible at the moment. |
42 bool PrintNow(); | 44 bool PrintNow(); |
(...skipping 27 matching lines...) Expand all Loading... |
70 void PrintPreviewDone(); | 72 void PrintPreviewDone(); |
71 | 73 |
72 // Whether to block scripted printing for our tab or not. | 74 // Whether to block scripted printing for our tab or not. |
73 void UpdateScriptedPrintingBlocked(); | 75 void UpdateScriptedPrintingBlocked(); |
74 | 76 |
75 // Sets |observer| as the current PrintViewManagerObserver. Pass in NULL to | 77 // Sets |observer| as the current PrintViewManagerObserver. Pass in NULL to |
76 // remove the current observer. |observer| may always be NULL, but |observer_| | 78 // remove the current observer. |observer| may always be NULL, but |observer_| |
77 // must be NULL if |observer| is non-NULL. | 79 // must be NULL if |observer| is non-NULL. |
78 void set_observer(PrintViewManagerObserver* observer); | 80 void set_observer(PrintViewManagerObserver* observer); |
79 | 81 |
| 82 // PrefObserver implementation. |
| 83 virtual void OnPreferenceChanged(PrefServiceBase* service, |
| 84 const std::string& pref_name) OVERRIDE; |
| 85 |
80 // PrintedPagesSource implementation. | 86 // PrintedPagesSource implementation. |
81 virtual string16 RenderSourceName() OVERRIDE; | 87 virtual string16 RenderSourceName() OVERRIDE; |
82 | 88 |
83 // content::NotificationObserver implementation. | 89 // content::NotificationObserver implementation. |
84 virtual void Observe(int type, | 90 virtual void Observe(int type, |
85 const content::NotificationSource& source, | 91 const content::NotificationSource& source, |
86 const content::NotificationDetails& details) OVERRIDE; | 92 const content::NotificationDetails& details) OVERRIDE; |
87 | 93 |
88 // content::WebContentsObserver implementation. | 94 // content::WebContentsObserver implementation. |
89 virtual void DidStartLoading( | 95 virtual void DidStartLoading( |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 | 218 |
213 // Whether our content is in blocked state. | 219 // Whether our content is in blocked state. |
214 bool tab_content_blocked_; | 220 bool tab_content_blocked_; |
215 | 221 |
216 DISALLOW_COPY_AND_ASSIGN(PrintViewManager); | 222 DISALLOW_COPY_AND_ASSIGN(PrintViewManager); |
217 }; | 223 }; |
218 | 224 |
219 } // namespace printing | 225 } // namespace printing |
220 | 226 |
221 #endif // CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_H_ | 227 #endif // CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_H_ |
OLD | NEW |