| OLD | NEW | 
|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // TODO(sgurun) copied from chrome/renderer. Remove after crbug.com/322276 | 5 // TODO(sgurun) copied from chrome/renderer. Remove after crbug.com/322276 | 
| 6 | 6 | 
| 7 #include "android_webview/renderer/print_web_view_helper.h" | 7 #include "android_webview/renderer/print_web_view_helper.h" | 
| 8 | 8 | 
| 9 #include <string> | 9 #include <string> | 
| 10 | 10 | 
| (...skipping 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1406                                                 const blink::WebNode& node, | 1406                                                 const blink::WebNode& node, | 
| 1407                                                 int* number_of_pages) { | 1407                                                 int* number_of_pages) { | 
| 1408   DCHECK(frame); | 1408   DCHECK(frame); | 
| 1409   bool fit_to_paper_size = !(PrintingNodeOrPdfFrame(frame, node)); | 1409   bool fit_to_paper_size = !(PrintingNodeOrPdfFrame(frame, node)); | 
| 1410   if (!InitPrintSettings(fit_to_paper_size)) { | 1410   if (!InitPrintSettings(fit_to_paper_size)) { | 
| 1411     notify_browser_of_print_failure_ = false; | 1411     notify_browser_of_print_failure_ = false; | 
| 1412 #if !defined(OS_ANDROID) | 1412 #if !defined(OS_ANDROID) | 
| 1413     // TODO(sgurun) android_webview hack | 1413     // TODO(sgurun) android_webview hack | 
| 1414     render_view()->RunModalAlertDialog( | 1414     render_view()->RunModalAlertDialog( | 
| 1415         frame, | 1415         frame, | 
| 1416         l10n_util::GetStringUTF16(IDS_PRINT_PREVIEW_INVALID_PRINTER_SETTINGS)); | 1416         l10n_util::GetStringUTF16(IDS_PRINT_INVALID_PRINTER_SETTINGS)); | 
| 1417 #endif  //  !defined(OS_ANDROID) | 1417 #endif  //  !defined(OS_ANDROID) | 
| 1418     return false; | 1418     return false; | 
| 1419   } | 1419   } | 
| 1420 | 1420 | 
| 1421   const PrintMsg_Print_Params& params = print_pages_params_->params; | 1421   const PrintMsg_Print_Params& params = print_pages_params_->params; | 
| 1422   PrepareFrameAndViewForPrint prepare(params, frame, node, ignore_css_margins_); | 1422   PrepareFrameAndViewForPrint prepare(params, frame, node, ignore_css_margins_); | 
| 1423   prepare.StartPrinting(); | 1423   prepare.StartPrinting(); | 
| 1424 | 1424 | 
| 1425   Send(new PrintHostMsg_DidGetDocumentCookie(routing_id(), | 1425   Send(new PrintHostMsg_DidGetDocumentCookie(routing_id(), | 
| 1426                                              params.document_cookie)); | 1426                                              params.document_cookie)); | 
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1474       // TODO(sgurun) android_webview hack | 1474       // TODO(sgurun) android_webview hack | 
| 1475       // PrintForPrintPreview | 1475       // PrintForPrintPreview | 
| 1476       blink::WebFrame* print_frame = NULL; | 1476       blink::WebFrame* print_frame = NULL; | 
| 1477       // This may not be the right frame, but the alert will be modal, | 1477       // This may not be the right frame, but the alert will be modal, | 
| 1478       // therefore it works well enough. | 1478       // therefore it works well enough. | 
| 1479       GetPrintFrame(&print_frame); | 1479       GetPrintFrame(&print_frame); | 
| 1480       if (print_frame) { | 1480       if (print_frame) { | 
| 1481         render_view()->RunModalAlertDialog( | 1481         render_view()->RunModalAlertDialog( | 
| 1482             print_frame, | 1482             print_frame, | 
| 1483             l10n_util::GetStringUTF16( | 1483             l10n_util::GetStringUTF16( | 
| 1484                 IDS_PRINT_PREVIEW_INVALID_PRINTER_SETTINGS)); | 1484                 IDS_PRINT_INVALID_PRINTER_SETTINGS)); | 
| 1485       } | 1485       } | 
| 1486 #endif  // !defined(OS_ANDROID) | 1486 #endif  // !defined(OS_ANDROID) | 
| 1487     } | 1487     } | 
| 1488     return false; | 1488     return false; | 
| 1489   } | 1489   } | 
| 1490 | 1490 | 
| 1491   if (settings.params.dpi < kMinDpi || !settings.params.document_cookie) { | 1491   if (settings.params.dpi < kMinDpi || !settings.params.document_cookie) { | 
| 1492     print_preview_context_.set_error(PREVIEW_ERROR_UPDATING_PRINT_SETTINGS); | 1492     print_preview_context_.set_error(PREVIEW_ERROR_UPDATING_PRINT_SETTINGS); | 
| 1493     return false; | 1493     return false; | 
| 1494   } | 1494   } | 
| (...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1998 } | 1998 } | 
| 1999 | 1999 | 
| 2000 void PrintWebViewHelper::PrintPreviewContext::ClearContext() { | 2000 void PrintWebViewHelper::PrintPreviewContext::ClearContext() { | 
| 2001   prep_frame_view_.reset(); | 2001   prep_frame_view_.reset(); | 
| 2002   metafile_.reset(); | 2002   metafile_.reset(); | 
| 2003   pages_to_render_.clear(); | 2003   pages_to_render_.clear(); | 
| 2004   error_ = PREVIEW_ERROR_NONE; | 2004   error_ = PREVIEW_ERROR_NONE; | 
| 2005 } | 2005 } | 
| 2006 | 2006 | 
| 2007 }  // namespace printing | 2007 }  // namespace printing | 
| OLD | NEW | 
|---|