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 #include "chrome/browser/ui/webui/print_preview/print_preview_handler.h" | 5 #include "chrome/browser/ui/webui/print_preview/print_preview_handler.h" |
6 | 6 |
7 #include <ctype.h> | 7 #include <ctype.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 ReportPageCount(page_count, "PrintToPrinter"); | 465 ReportPageCount(page_count, "PrintToPrinter"); |
466 ReportUserActionHistogram(PRINT_TO_PRINTER); | 466 ReportUserActionHistogram(PRINT_TO_PRINTER); |
467 ReportPrintSettingsStats(*settings); | 467 ReportPrintSettingsStats(*settings); |
468 | 468 |
469 // This tries to activate the initiator tab as well, so do not clear the | 469 // This tries to activate the initiator tab as well, so do not clear the |
470 // association with the initiator tab yet. | 470 // association with the initiator tab yet. |
471 PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>( | 471 PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>( |
472 web_ui()->GetController()); | 472 web_ui()->GetController()); |
473 print_preview_ui->OnHidePreviewDialog(); | 473 print_preview_ui->OnHidePreviewDialog(); |
474 | 474 |
475 // Do this so the initiator tab can open a new print preview dialog. | 475 // Do this so the initiator tab can open a new print preview dialog, while |
| 476 // the current print preview dialog is still handling its print job. |
476 ClearInitiatorTabDetails(); | 477 ClearInitiatorTabDetails(); |
477 | 478 |
478 // The PDF being printed contains only the pages that the user selected, | 479 // The PDF being printed contains only the pages that the user selected, |
479 // so ignore the page range and print all pages. | 480 // so ignore the page range and print all pages. |
480 settings->Remove(printing::kSettingPageRange, NULL); | 481 settings->Remove(printing::kSettingPageRange, NULL); |
481 // Set ID to know whether printing is for preview. | 482 // Set ID to know whether printing is for preview. |
482 settings->SetInteger(printing::kPreviewUIID, | 483 settings->SetInteger(printing::kPreviewUIID, |
483 print_preview_ui->GetIDForPrintPreviewUI()); | 484 print_preview_ui->GetIDForPrintPreviewUI()); |
484 RenderViewHost* rvh = preview_web_contents()->GetRenderViewHost(); | 485 RenderViewHost* rvh = preview_web_contents()->GetRenderViewHost(); |
485 rvh->Send(new PrintMsg_PrintForPrintPreview(rvh->GetRoutingID(), | 486 rvh->Send(new PrintMsg_PrintForPrintPreview(rvh->GetRoutingID(), |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
972 // Nothing to print, no preview available. | 973 // Nothing to print, no preview available. |
973 return false; | 974 return false; |
974 } | 975 } |
975 DCHECK(tmp_data->size() && tmp_data->front()); | 976 DCHECK(tmp_data->size() && tmp_data->front()); |
976 | 977 |
977 *data = tmp_data; | 978 *data = tmp_data; |
978 *title = print_preview_ui->initiator_tab_title(); | 979 *title = print_preview_ui->initiator_tab_title(); |
979 return true; | 980 return true; |
980 } | 981 } |
981 | 982 |
OLD | NEW |