| 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 #include "chrome/renderer/print_web_view_helper.h" | 5 #include "chrome/renderer/print_web_view_helper.h" |
| 6 | 6 |
| 7 #include "base/file_descriptor_posix.h" | 7 #include "base/file_descriptor_posix.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "chrome/common/render_messages.h" | 9 #include "chrome/common/render_messages.h" |
| 10 #include "printing/native_metafile.h" | 10 #include "printing/native_metafile.h" |
| 11 #include "skia/ext/vector_canvas.h" | 11 #include "skia/ext/vector_canvas.h" |
| 12 #include "webkit/api/public/WebFrame.h" | 12 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" |
| 13 | 13 |
| 14 using WebKit::WebFrame; | 14 using WebKit::WebFrame; |
| 15 | 15 |
| 16 void PrintWebViewHelper::Print(WebFrame* frame, bool script_initiated) { | 16 void PrintWebViewHelper::Print(WebFrame* frame, bool script_initiated) { |
| 17 // If still not finished with earlier print request simply ignore. | 17 // If still not finished with earlier print request simply ignore. |
| 18 if (IsPrinting()) | 18 if (IsPrinting()) |
| 19 return; | 19 return; |
| 20 | 20 |
| 21 // TODO(myhuang): Get printing parameters via IPC. | 21 // TODO(myhuang): Get printing parameters via IPC. |
| 22 // For testing purpose, we hard-coded printing parameters here. | 22 // For testing purpose, we hard-coded printing parameters here. |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 } | 131 } |
| 132 | 132 |
| 133 // TODO(myhuang): We should handle transformation for paper margins. | 133 // TODO(myhuang): We should handle transformation for paper margins. |
| 134 // TODO(myhuang): We should render the header and the footer. | 134 // TODO(myhuang): We should render the header and the footer. |
| 135 | 135 |
| 136 // Done printing. Close the device context to retrieve the compiled metafile. | 136 // Done printing. Close the device context to retrieve the compiled metafile. |
| 137 if (!metafile->FinishPage(shrink)) { | 137 if (!metafile->FinishPage(shrink)) { |
| 138 NOTREACHED() << "metafile failed"; | 138 NOTREACHED() << "metafile failed"; |
| 139 } | 139 } |
| 140 } | 140 } |
| OLD | NEW |