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_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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/string16.h" | 10 #include "base/string16.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 62 |
63 // Sets |observer| as the current PrintViewManagerObserver. Pass in NULL to | 63 // Sets |observer| as the current PrintViewManagerObserver. Pass in NULL to |
64 // remove the current observer. |observer| may always be NULL, but |observer_| | 64 // remove the current observer. |observer| may always be NULL, but |observer_| |
65 // must be NULL if |observer| is non-NULL. | 65 // must be NULL if |observer| is non-NULL. |
66 void set_observer(PrintViewManagerObserver* observer); | 66 void set_observer(PrintViewManagerObserver* observer); |
67 | 67 |
68 // Reset |is_title_overridden_| to false. | 68 // Reset |is_title_overridden_| to false. |
69 void ResetTitleOverride(); | 69 void ResetTitleOverride(); |
70 | 70 |
71 // PrintedPagesSource implementation. | 71 // PrintedPagesSource implementation. |
72 virtual string16 RenderSourceName(); | 72 virtual string16 RenderSourceName() OVERRIDE; |
73 virtual GURL RenderSourceUrl(); | |
74 | 73 |
75 // NotificationObserver implementation. | 74 // NotificationObserver implementation. |
76 virtual void Observe(int type, | 75 virtual void Observe(int type, |
77 const NotificationSource& source, | 76 const NotificationSource& source, |
78 const NotificationDetails& details); | 77 const NotificationDetails& details) OVERRIDE; |
79 | 78 |
80 // TabContentsObserver implementation. | 79 // TabContentsObserver implementation. |
81 virtual bool OnMessageReceived(const IPC::Message& message); | 80 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
82 | 81 |
83 // Terminates or cancels the print job if one was pending. | 82 // Terminates or cancels the print job if one was pending. |
84 virtual void RenderViewGone(); | 83 virtual void RenderViewGone(); |
85 | 84 |
86 // Cancels the print job. | 85 // Cancels the print job. |
87 virtual void StopNavigation(); | 86 virtual void StopNavigation(); |
88 | 87 |
89 private: | 88 private: |
90 // IPC Message handlers. | 89 // IPC Message handlers. |
91 void OnDidGetPrintedPagesCount(int cookie, int number_pages); | 90 void OnDidGetPrintedPagesCount(int cookie, int number_pages); |
92 void OnDidGetDocumentCookie(int cookie); | 91 void OnDidGetDocumentCookie(int cookie); |
93 void OnDidShowPrintDialog(); | 92 void OnDidShowPrintDialog(); |
94 void OnDidPrintPage(const PrintHostMsg_DidPrintPage_Params& params); | 93 void OnDidPrintPage(const PrintHostMsg_DidPrintPage_Params& params); |
95 void OnPrintingFailed(int cookie); | 94 void OnPrintingFailed(int cookie); |
96 | 95 |
97 // Processes a NOTIFY_PRINT_JOB_EVENT notification. | 96 // Processes a NOTIFY_PRINT_JOB_EVENT notification. |
98 void OnNotifyPrintJobEvent(const JobEventDetails& event_details); | 97 void OnNotifyPrintJobEvent(const JobEventDetails& event_details); |
99 | 98 |
100 // Requests the RenderView to render all the missing pages for the print job. | 99 // Requests the RenderView to render all the missing pages for the print job. |
101 // No-op if no print job is pending. Returns true if at least one page has bee
n | 100 // No-op if no print job is pending. Returns true if at least one page has |
102 // requested to the renderer. | 101 // been requested to the renderer. |
103 bool RenderAllMissingPagesNow(); | 102 bool RenderAllMissingPagesNow(); |
104 | 103 |
105 // Quits the current message loop if these conditions hold true: a document is | 104 // Quits the current message loop if these conditions hold true: a document is |
106 // loaded and is complete and waiting_for_pages_to_be_rendered_ is true. This | 105 // loaded and is complete and waiting_for_pages_to_be_rendered_ is true. This |
107 // function is called in DidPrintPage() or on ALL_PAGES_REQUESTED | 106 // function is called in DidPrintPage() or on ALL_PAGES_REQUESTED |
108 // notification. The inner message loop is created was created by | 107 // notification. The inner message loop is created was created by |
109 // RenderAllMissingPagesNow(). | 108 // RenderAllMissingPagesNow(). |
110 void ShouldQuitFromInnerMessageLoop(); | 109 void ShouldQuitFromInnerMessageLoop(); |
111 | 110 |
112 // Creates a new empty print job. It has no settings loaded. If there is | 111 // Creates a new empty print job. It has no settings loaded. If there is |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 | 178 |
180 // The document cookie of the current PrinterQuery. | 179 // The document cookie of the current PrinterQuery. |
181 int cookie_; | 180 int cookie_; |
182 | 181 |
183 DISALLOW_COPY_AND_ASSIGN(PrintViewManager); | 182 DISALLOW_COPY_AND_ASSIGN(PrintViewManager); |
184 }; | 183 }; |
185 | 184 |
186 } // namespace printing | 185 } // namespace printing |
187 | 186 |
188 #endif // CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_H_ | 187 #endif // CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_H_ |
OLD | NEW |