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" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/shared_memory.h" | 12 #include "base/memory/shared_memory.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "content/public/renderer/render_view_observer.h" | 15 #include "content/public/renderer/render_view_observer.h" |
16 #include "content/public/renderer/render_view_observer_tracker.h" | 16 #include "content/public/renderer/render_view_observer_tracker.h" |
17 #include "printing/metafile_impl.h" | 17 #include "printing/metafile_impl.h" |
18 #include "third_party/WebKit/public/platform/WebCanvas.h" | 18 #include "third_party/WebKit/public/platform/WebCanvas.h" |
19 #include "third_party/WebKit/public/web/WebNode.h" | 19 #include "third_party/WebKit/public/web/WebNode.h" |
20 #include "third_party/WebKit/public/web/WebPrintParams.h" | 20 #include "third_party/WebKit/public/web/WebPrintParams.h" |
21 #include "ui/gfx/size.h" | 21 #include "ui/gfx/size.h" |
22 | 22 |
23 struct PrintMsg_Print_Params; | 23 struct PrintMsg_Print_Params; |
24 struct PrintMsg_PrintPage_Params; | 24 struct PrintMsg_PrintPage_Params; |
25 struct PrintMsg_PrintPages_Params; | 25 struct PrintMsg_PrintPages_Params; |
| 26 struct PrintHostMsg_SetOptionsFromDocument_Params; |
26 | 27 |
27 namespace base { | 28 namespace base { |
28 class DictionaryValue; | 29 class DictionaryValue; |
29 } | 30 } |
30 | 31 |
31 namespace blink { | 32 namespace blink { |
32 class WebFrame; | 33 class WebFrame; |
33 class WebView; | 34 class WebView; |
34 } | 35 } |
35 | 36 |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 | 172 |
172 // Initialize print page settings with default settings. | 173 // Initialize print page settings with default settings. |
173 // Used only for native printing workflow. | 174 // Used only for native printing workflow. |
174 bool InitPrintSettings(bool fit_to_paper_size); | 175 bool InitPrintSettings(bool fit_to_paper_size); |
175 | 176 |
176 // Calculate number of pages in source document. | 177 // Calculate number of pages in source document. |
177 bool CalculateNumberOfPages(blink::WebLocalFrame* frame, | 178 bool CalculateNumberOfPages(blink::WebLocalFrame* frame, |
178 const blink::WebNode& node, | 179 const blink::WebNode& node, |
179 int* number_of_pages); | 180 int* number_of_pages); |
180 | 181 |
| 182 // Set options for print preset from source PDF document. |
| 183 void SetOptionsFromDocument( |
| 184 PrintHostMsg_SetOptionsFromDocument_Params& params); |
| 185 |
181 // Update the current print settings with new |passed_job_settings|. | 186 // Update the current print settings with new |passed_job_settings|. |
182 // |passed_job_settings| dictionary contains print job details such as printer | 187 // |passed_job_settings| dictionary contains print job details such as printer |
183 // name, number of copies, page range, etc. | 188 // name, number of copies, page range, etc. |
184 bool UpdatePrintSettings(blink::WebLocalFrame* frame, | 189 bool UpdatePrintSettings(blink::WebLocalFrame* frame, |
185 const blink::WebNode& node, | 190 const blink::WebNode& node, |
186 const base::DictionaryValue& passed_job_settings); | 191 const base::DictionaryValue& passed_job_settings); |
187 | 192 |
188 // Get final print settings from the user. | 193 // Get final print settings from the user. |
189 // Return false if the user cancels or on error. | 194 // Return false if the user cancels or on error. |
190 bool GetPrintSettingsFromUser(blink::WebFrame* frame, | 195 bool GetPrintSettingsFromUser(blink::WebFrame* frame, |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 PrintPreviewContext print_preview_context_; | 460 PrintPreviewContext print_preview_context_; |
456 bool is_loading_; | 461 bool is_loading_; |
457 bool is_scripted_preview_delayed_; | 462 bool is_scripted_preview_delayed_; |
458 base::WeakPtrFactory<PrintWebViewHelper> weak_ptr_factory_; | 463 base::WeakPtrFactory<PrintWebViewHelper> weak_ptr_factory_; |
459 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); | 464 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); |
460 }; | 465 }; |
461 | 466 |
462 } // namespace printing | 467 } // namespace printing |
463 | 468 |
464 #endif // CHROME_RENDERER_PRINTING_PRINT_WEB_VIEW_HELPER_H_ | 469 #endif // CHROME_RENDERER_PRINTING_PRINT_WEB_VIEW_HELPER_H_ |
OLD | NEW |