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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 // TabContentsObserver implementation. | 44 // TabContentsObserver implementation. |
45 virtual bool OnMessageReceived(const IPC::Message& message); | 45 virtual bool OnMessageReceived(const IPC::Message& message); |
46 | 46 |
47 // Terminates or cancels the print job if one was pending. | 47 // Terminates or cancels the print job if one was pending. |
48 virtual void RenderViewGone(); | 48 virtual void RenderViewGone(); |
49 | 49 |
50 // Cancels the print job. | 50 // Cancels the print job. |
51 virtual void StopNavigation(); | 51 virtual void StopNavigation(); |
52 | 52 |
53 private: | 53 private: |
54 void OnDidGetPrintedPagesCount(int cookie, int number_pages); | 54 void OnDidGetBasicPrintJobInfo(int cookie, |
| 55 int number_pages, |
| 56 const string16& job_title); |
55 void OnDidPrintPage(const PrintHostMsg_DidPrintPage_Params& params); | 57 void OnDidPrintPage(const PrintHostMsg_DidPrintPage_Params& params); |
56 | 58 |
57 // Processes a NOTIFY_PRINT_JOB_EVENT notification. | 59 // Processes a NOTIFY_PRINT_JOB_EVENT notification. |
58 void OnNotifyPrintJobEvent(const JobEventDetails& event_details); | 60 void OnNotifyPrintJobEvent(const JobEventDetails& event_details); |
59 | 61 |
60 // Requests the RenderView to render all the missing pages for the print job. | 62 // Requests the RenderView to render all the missing pages for the print job. |
61 // Noop if no print job is pending. Returns true if at least one page has been | 63 // Noop if no print job is pending. Returns true if at least one page has been |
62 // requested to the renderer. | 64 // requested to the renderer. |
63 bool RenderAllMissingPagesNow(); | 65 bool RenderAllMissingPagesNow(); |
64 | 66 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 // Running an inner message loop inside RenderAllMissingPagesNow(). This means | 123 // Running an inner message loop inside RenderAllMissingPagesNow(). This means |
122 // we are _blocking_ until all the necessary pages have been rendered or the | 124 // we are _blocking_ until all the necessary pages have been rendered or the |
123 // print settings are being loaded. | 125 // print settings are being loaded. |
124 bool inside_inner_message_loop_; | 126 bool inside_inner_message_loop_; |
125 | 127 |
126 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 128 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
127 // Set to true when OnDidPrintPage() should be expecting the first page. | 129 // Set to true when OnDidPrintPage() should be expecting the first page. |
128 bool expecting_first_page_; | 130 bool expecting_first_page_; |
129 #endif | 131 #endif |
130 | 132 |
| 133 // Current print job title. |
| 134 // For preview printing, |job_title_| is set to initiator tab title in |
| 135 // PrintHostMsg_DidGetBasicPrintJobInfo message handler. |
| 136 // For normal printing, |job_title_| is empty. Print view manager will use |
| 137 // the current tab title as print job title. If the current tab title is |
| 138 // empty, use the default job title. |
| 139 string16 job_title_; |
| 140 |
131 DISALLOW_COPY_AND_ASSIGN(PrintViewManager); | 141 DISALLOW_COPY_AND_ASSIGN(PrintViewManager); |
132 }; | 142 }; |
133 | 143 |
134 } // namespace printing | 144 } // namespace printing |
135 | 145 |
136 #endif // CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_H_ | 146 #endif // CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_H_ |
OLD | NEW |