| 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/callback.h" | 10 #include "base/callback.h" |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 162 |
| 163 // Finalize the print ready preview document. | 163 // Finalize the print ready preview document. |
| 164 bool FinalizePrintReadyDocument(); | 164 bool FinalizePrintReadyDocument(); |
| 165 | 165 |
| 166 // Enable/Disable window.print calls. If |blocked| is true window.print | 166 // Enable/Disable window.print calls. If |blocked| is true window.print |
| 167 // calls will silently fail. Call with |blocked| set to false to reenable. | 167 // calls will silently fail. Call with |blocked| set to false to reenable. |
| 168 void SetScriptedPrintBlocked(bool blocked); | 168 void SetScriptedPrintBlocked(bool blocked); |
| 169 | 169 |
| 170 // Main printing code ------------------------------------------------------- | 170 // Main printing code ------------------------------------------------------- |
| 171 | 171 |
| 172 void Print(blink::WebLocalFrame* frame, const blink::WebNode& node); | 172 // |is_scripted| should be true when the call is coming from window.print() |
| 173 void Print(blink::WebLocalFrame* frame, |
| 174 const blink::WebNode& node, |
| 175 bool is_scripted); |
| 173 | 176 |
| 174 // Notification when printing is done - signal tear-down/free resources. | 177 // Notification when printing is done - signal tear-down/free resources. |
| 175 void DidFinishPrinting(PrintingResult result); | 178 void DidFinishPrinting(PrintingResult result); |
| 176 | 179 |
| 177 // Print Settings ----------------------------------------------------------- | 180 // Print Settings ----------------------------------------------------------- |
| 178 | 181 |
| 179 // Initialize print page settings with default settings. | 182 // Initialize print page settings with default settings. |
| 180 // Used only for native printing workflow. | 183 // Used only for native printing workflow. |
| 181 bool InitPrintSettings(bool fit_to_paper_size); | 184 bool InitPrintSettings(bool fit_to_paper_size); |
| 182 | 185 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 193 // |passed_job_settings| dictionary contains print job details such as printer | 196 // |passed_job_settings| dictionary contains print job details such as printer |
| 194 // name, number of copies, page range, etc. | 197 // name, number of copies, page range, etc. |
| 195 bool UpdatePrintSettings(blink::WebLocalFrame* frame, | 198 bool UpdatePrintSettings(blink::WebLocalFrame* frame, |
| 196 const blink::WebNode& node, | 199 const blink::WebNode& node, |
| 197 const base::DictionaryValue& passed_job_settings); | 200 const base::DictionaryValue& passed_job_settings); |
| 198 | 201 |
| 199 // Get final print settings from the user. | 202 // Get final print settings from the user. |
| 200 // Return false if the user cancels or on error. | 203 // Return false if the user cancels or on error. |
| 201 bool GetPrintSettingsFromUser(blink::WebFrame* frame, | 204 bool GetPrintSettingsFromUser(blink::WebFrame* frame, |
| 202 const blink::WebNode& node, | 205 const blink::WebNode& node, |
| 203 int expected_pages_count); | 206 int expected_pages_count, |
| 207 bool is_scripted); |
| 204 | 208 |
| 205 // Page Printing / Rendering ------------------------------------------------ | 209 // Page Printing / Rendering ------------------------------------------------ |
| 206 | 210 |
| 207 void OnFramePreparedForPrintPages(); | 211 void OnFramePreparedForPrintPages(); |
| 208 void PrintPages(); | 212 void PrintPages(); |
| 209 bool PrintPagesNative(blink::WebFrame* frame, int page_count); | 213 bool PrintPagesNative(blink::WebFrame* frame, int page_count); |
| 210 void FinishFramePrinting(); | 214 void FinishFramePrinting(); |
| 211 | 215 |
| 212 // Prints the page listed in |params|. | 216 // Prints the page listed in |params|. |
| 213 #if defined(OS_LINUX) || defined(OS_ANDROID) | 217 #if defined(OS_LINUX) || defined(OS_ANDROID) |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 base::Closure on_stop_loading_closure_; | 466 base::Closure on_stop_loading_closure_; |
| 463 | 467 |
| 464 base::WeakPtrFactory<PrintWebViewHelper> weak_ptr_factory_; | 468 base::WeakPtrFactory<PrintWebViewHelper> weak_ptr_factory_; |
| 465 | 469 |
| 466 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); | 470 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); |
| 467 }; | 471 }; |
| 468 | 472 |
| 469 } // namespace printing | 473 } // namespace printing |
| 470 | 474 |
| 471 #endif // CHROME_RENDERER_PRINTING_PRINT_WEB_VIEW_HELPER_H_ | 475 #endif // CHROME_RENDERER_PRINTING_PRINT_WEB_VIEW_HELPER_H_ |
| OLD | NEW |