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_RENDERER_PRINTING_PRINT_WEB_VIEW_HELPER_H_ | 5 #ifndef CHROME_RENDERER_PRINTING_PRINT_WEB_VIEW_HELPER_H_ |
6 #define CHROME_RENDERER_PRINTING_PRINT_WEB_VIEW_HELPER_H_ | 6 #define CHROME_RENDERER_PRINTING_PRINT_WEB_VIEW_HELPER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 PREVIEW_ERROR_ZERO_PAGES, | 77 PREVIEW_ERROR_ZERO_PAGES, |
78 PREVIEW_ERROR_MAC_DRAFT_METAFILE_INIT_FAILED, | 78 PREVIEW_ERROR_MAC_DRAFT_METAFILE_INIT_FAILED, |
79 PREVIEW_ERROR_PAGE_RENDERED_WITHOUT_METAFILE, | 79 PREVIEW_ERROR_PAGE_RENDERED_WITHOUT_METAFILE, |
80 PREVIEW_ERROR_UPDATING_PRINT_SETTINGS, | 80 PREVIEW_ERROR_UPDATING_PRINT_SETTINGS, |
81 PREVIEW_ERROR_INVALID_PRINTER_SETTINGS, | 81 PREVIEW_ERROR_INVALID_PRINTER_SETTINGS, |
82 PREVIEW_ERROR_LAST_ENUM // Always last. | 82 PREVIEW_ERROR_LAST_ENUM // Always last. |
83 }; | 83 }; |
84 | 84 |
85 enum PrintPreviewRequestType { | 85 enum PrintPreviewRequestType { |
86 PRINT_PREVIEW_USER_INITIATED_ENTIRE_FRAME, | 86 PRINT_PREVIEW_USER_INITIATED_ENTIRE_FRAME, |
| 87 PRINT_PREVIEW_USER_INITIATED_SELECTION, |
87 PRINT_PREVIEW_USER_INITIATED_CONTEXT_NODE, | 88 PRINT_PREVIEW_USER_INITIATED_CONTEXT_NODE, |
88 PRINT_PREVIEW_SCRIPTED // triggered by window.print(). | 89 PRINT_PREVIEW_SCRIPTED // triggered by window.print(). |
89 }; | 90 }; |
90 | 91 |
91 // RenderViewObserver implementation. | 92 // RenderViewObserver implementation. |
92 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 93 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
93 virtual void PrintPage(WebKit::WebFrame* frame, bool user_initiated) OVERRIDE; | 94 virtual void PrintPage(WebKit::WebFrame* frame, bool user_initiated) OVERRIDE; |
94 | 95 |
95 // Message handlers --------------------------------------------------------- | 96 // Message handlers --------------------------------------------------------- |
96 | 97 |
(...skipping 29 matching lines...) Expand all Loading... |
126 // (2) Source is PDF. This is the first preview request and print scaling | 127 // (2) Source is PDF. This is the first preview request and print scaling |
127 // option is disabled for initiator renderer plugin. | 128 // option is disabled for initiator renderer plugin. |
128 // | 129 // |
129 // In all other cases, we scale the source page to fit the printable area. | 130 // In all other cases, we scale the source page to fit the printable area. |
130 WebKit::WebPrintScalingOption GetPrintScalingOption( | 131 WebKit::WebPrintScalingOption GetPrintScalingOption( |
131 bool source_is_html, | 132 bool source_is_html, |
132 const base::DictionaryValue& job_settings, | 133 const base::DictionaryValue& job_settings, |
133 const PrintMsg_Print_Params& params); | 134 const PrintMsg_Print_Params& params); |
134 | 135 |
135 // Initiate print preview. | 136 // Initiate print preview. |
136 void OnInitiatePrintPreview(); | 137 void OnInitiatePrintPreview(bool selection_only); |
137 | 138 |
138 // Start the process of generating a print preview using |settings|. | 139 // Start the process of generating a print preview using |settings|. |
139 void OnPrintPreview(const base::DictionaryValue& settings); | 140 void OnPrintPreview(const base::DictionaryValue& settings); |
140 | 141 |
141 // Prepare frame for creating preview document. | 142 // Prepare frame for creating preview document. |
142 void PrepareFrameForPreviewDocument(); | 143 void PrepareFrameForPreviewDocument(); |
143 | 144 |
144 // Continue creating preview document. | 145 // Continue creating preview document. |
145 void OnFramePreparedForPreviewDocument(); | 146 void OnFramePreparedForPreviewDocument(); |
146 | 147 |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 }; | 454 }; |
454 | 455 |
455 bool print_node_in_progress_; | 456 bool print_node_in_progress_; |
456 PrintPreviewContext print_preview_context_; | 457 PrintPreviewContext print_preview_context_; |
457 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); | 458 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); |
458 }; | 459 }; |
459 | 460 |
460 } // namespace printing | 461 } // namespace printing |
461 | 462 |
462 #endif // CHROME_RENDERER_PRINTING_PRINT_WEB_VIEW_HELPER_H_ | 463 #endif // CHROME_RENDERER_PRINTING_PRINT_WEB_VIEW_HELPER_H_ |
OLD | NEW |