| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_PRINT_WEB_VIEW_DELEGATE_H_ | 5 #ifndef CHROME_RENDERER_PRINT_WEB_VIEW_DELEGATE_H_ |
| 6 #define CHROME_RENDERER_PRINT_WEB_VIEW_DELEGATE_H_ | 6 #define CHROME_RENDERER_PRINT_WEB_VIEW_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/gfx/size.h" | 10 #include "base/gfx/size.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 void Print(WebKit::WebFrame* frame, bool script_initiated); | 68 void Print(WebKit::WebFrame* frame, bool script_initiated); |
| 69 | 69 |
| 70 // Is there a background print in progress? | 70 // Is there a background print in progress? |
| 71 bool IsPrinting() { | 71 bool IsPrinting() { |
| 72 return print_web_view_.get() != NULL; | 72 return print_web_view_.get() != NULL; |
| 73 } | 73 } |
| 74 | 74 |
| 75 // Notification when printing is done - signal teardown | 75 // Notification when printing is done - signal teardown |
| 76 void DidFinishPrinting(bool success); | 76 void DidFinishPrinting(bool success); |
| 77 | 77 |
| 78 // Prints the page listed in |params| as a JPEG image. The width and height of |
| 79 // the image will scale propotionally given the |zoom_factor| multiplier. The |
| 80 // encoded JPEG data will be written into the supplied vector |image_data|. |
| 81 void PrintPageAsJPEG(const ViewMsg_PrintPage_Params& params, |
| 82 WebKit::WebFrame* frame, |
| 83 float zoom_factor, |
| 84 std::vector<unsigned char>* image_data); |
| 85 |
| 78 protected: | 86 protected: |
| 79 bool CopyAndPrint(const ViewMsg_PrintPages_Params& params, | 87 bool CopyAndPrint(const ViewMsg_PrintPages_Params& params, |
| 80 WebKit::WebFrame* web_frame); | 88 WebKit::WebFrame* web_frame); |
| 81 | 89 |
| 82 // Prints the page listed in |params|. | 90 // Prints the page listed in |params|. |
| 83 void PrintPage(const ViewMsg_PrintPage_Params& params, | 91 void PrintPage(const ViewMsg_PrintPage_Params& params, |
| 84 const gfx::Size& canvas_size, | 92 const gfx::Size& canvas_size, |
| 85 WebKit::WebFrame* frame); | 93 WebKit::WebFrame* frame); |
| 86 | 94 |
| 87 // Prints all the pages listed in |params|. | 95 // Prints all the pages listed in |params|. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 115 scoped_ptr<WebView> print_web_view_; | 123 scoped_ptr<WebView> print_web_view_; |
| 116 scoped_ptr<ViewMsg_PrintPages_Params> print_pages_params_; | 124 scoped_ptr<ViewMsg_PrintPages_Params> print_pages_params_; |
| 117 base::Time last_cancelled_script_print_; | 125 base::Time last_cancelled_script_print_; |
| 118 int user_cancelled_scripted_print_count_; | 126 int user_cancelled_scripted_print_count_; |
| 119 | 127 |
| 120 private: | 128 private: |
| 121 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); | 129 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); |
| 122 }; | 130 }; |
| 123 | 131 |
| 124 #endif // CHROME_RENDERER_PRINT_WEB_VIEW_DELEGATE_H_ | 132 #endif // CHROME_RENDERER_PRINT_WEB_VIEW_DELEGATE_H_ |
| OLD | NEW |