| 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 COMPONENTS_PRINTING_RENDERER_PRINT_WEB_VIEW_HELPER_H_ | 5 #ifndef COMPONENTS_PRINTING_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
| 6 #define COMPONENTS_PRINTING_RENDERER_PRINT_WEB_VIEW_HELPER_H_ | 6 #define COMPONENTS_PRINTING_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 PRINT_PREVIEW_USER_INITIATED_CONTEXT_NODE, | 168 PRINT_PREVIEW_USER_INITIATED_CONTEXT_NODE, |
| 169 PRINT_PREVIEW_SCRIPTED // triggered by window.print(). | 169 PRINT_PREVIEW_SCRIPTED // triggered by window.print(). |
| 170 }; | 170 }; |
| 171 | 171 |
| 172 // RenderFrameObserver implementation. | 172 // RenderFrameObserver implementation. |
| 173 void OnDestruct() override; | 173 void OnDestruct() override; |
| 174 void DidStartProvisionalLoad(blink::WebDataSource* data_source) override; | 174 void DidStartProvisionalLoad(blink::WebDataSource* data_source) override; |
| 175 void DidFailProvisionalLoad(const blink::WebURLError& error) override; | 175 void DidFailProvisionalLoad(const blink::WebURLError& error) override; |
| 176 void DidFinishLoad() override; | 176 void DidFinishLoad() override; |
| 177 void ScriptedPrint(bool user_initiated) override; | 177 void ScriptedPrint(bool user_initiated) override; |
| 178 void PrintFrame(const gfx::Rect& rect, int src_id) override; |
| 178 bool OnMessageReceived(const IPC::Message& message) override; | 179 bool OnMessageReceived(const IPC::Message& message) override; |
| 179 | 180 |
| 180 // Message handlers --------------------------------------------------------- | 181 // Message handlers --------------------------------------------------------- |
| 181 #if BUILDFLAG(ENABLE_BASIC_PRINTING) | 182 #if BUILDFLAG(ENABLE_BASIC_PRINTING) |
| 182 void OnPrintPages(); | 183 void OnPrintPages(); |
| 184 void OnPrintPagesWithSettings(const gfx::Rect& rect); |
| 183 void OnPrintForSystemDialog(); | 185 void OnPrintForSystemDialog(); |
| 184 void OnPrintForPrintPreview(const base::DictionaryValue& job_settings); | 186 void OnPrintForPrintPreview(const base::DictionaryValue& job_settings); |
| 185 #endif // BUILDFLAG(ENABLE_BASIC_PRINTING) | 187 #endif // BUILDFLAG(ENABLE_BASIC_PRINTING) |
| 186 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) | 188 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) |
| 187 void OnInitiatePrintPreview(bool has_selection); | 189 void OnInitiatePrintPreview(bool has_selection); |
| 188 void OnPrintPreview(const base::DictionaryValue& settings); | 190 void OnPrintPreview(const base::DictionaryValue& settings); |
| 189 #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) | 191 #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) |
| 190 void OnPrintingDone(bool success); | 192 void OnPrintingDone(bool success); |
| 191 | 193 |
| 192 // Get |page_size| and |content_area| information from | 194 // Get |page_size| and |content_area| information from |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 static float RenderPageContent(blink::WebFrame* frame, | 314 static float RenderPageContent(blink::WebFrame* frame, |
| 313 int page_number, | 315 int page_number, |
| 314 const gfx::Rect& canvas_area, | 316 const gfx::Rect& canvas_area, |
| 315 const gfx::Rect& content_area, | 317 const gfx::Rect& content_area, |
| 316 double scale_factor, | 318 double scale_factor, |
| 317 blink::WebCanvas* canvas); | 319 blink::WebCanvas* canvas); |
| 318 | 320 |
| 319 // Helper methods ----------------------------------------------------------- | 321 // Helper methods ----------------------------------------------------------- |
| 320 | 322 |
| 321 bool CopyMetafileDataToSharedMem(const PdfMetafileSkia& metafile, | 323 bool CopyMetafileDataToSharedMem(const PdfMetafileSkia& metafile, |
| 322 base::SharedMemoryHandle* shared_mem_handle); | 324 base::SharedMemoryHandle* shared_mem_handle, |
| 325 uint32_t* size); |
| 323 | 326 |
| 324 // Helper method to get page layout in points and fit to page if needed. | 327 // Helper method to get page layout in points and fit to page if needed. |
| 325 static void ComputePageLayoutInPointsForCss( | 328 static void ComputePageLayoutInPointsForCss( |
| 326 blink::WebLocalFrame* frame, | 329 blink::WebLocalFrame* frame, |
| 327 int page_index, | 330 int page_index, |
| 328 const PrintMsg_Print_Params& default_params, | 331 const PrintMsg_Print_Params& default_params, |
| 329 bool ignore_css_margins, | 332 bool ignore_css_margins, |
| 330 double* scale_factor, | 333 double* scale_factor, |
| 331 PageSizeMargins* page_layout_in_points); | 334 PageSizeMargins* page_layout_in_points); |
| 332 | 335 |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 base::Closure on_stop_loading_closure_; | 542 base::Closure on_stop_loading_closure_; |
| 540 | 543 |
| 541 base::WeakPtrFactory<PrintWebViewHelper> weak_ptr_factory_; | 544 base::WeakPtrFactory<PrintWebViewHelper> weak_ptr_factory_; |
| 542 | 545 |
| 543 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); | 546 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); |
| 544 }; | 547 }; |
| 545 | 548 |
| 546 } // namespace printing | 549 } // namespace printing |
| 547 | 550 |
| 548 #endif // COMPONENTS_PRINTING_RENDERER_PRINT_WEB_VIEW_HELPER_H_ | 551 #endif // COMPONENTS_PRINTING_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
| OLD | NEW |