Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: chrome/browser/ui/webui/print_preview/print_preview_handler.cc

Issue 473683005: Get print preview intitiator before ClearInitiatorDetails(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@patches
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 ReportPrintSettingsStats(*settings); 827 ReportPrintSettingsStats(*settings);
828 828
829 // This tries to activate the initiator as well, so do not clear the 829 // This tries to activate the initiator as well, so do not clear the
830 // association with the initiator yet. 830 // association with the initiator yet.
831 PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>( 831 PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(
832 web_ui()->GetController()); 832 web_ui()->GetController());
833 print_preview_ui->OnHidePreviewDialog(); 833 print_preview_ui->OnHidePreviewDialog();
834 834
835 // Do this so the initiator can open a new print preview dialog, while the 835 // Do this so the initiator can open a new print preview dialog, while the
836 // current print preview dialog is still handling its print job. 836 // current print preview dialog is still handling its print job.
837 WebContents* initiator = GetInitiator();
837 ClearInitiatorDetails(); 838 ClearInitiatorDetails();
838 839
839 // The PDF being printed contains only the pages that the user selected, 840 // The PDF being printed contains only the pages that the user selected,
840 // so ignore the page range and print all pages. 841 // so ignore the page range and print all pages.
841 settings->Remove(printing::kSettingPageRange, NULL); 842 settings->Remove(printing::kSettingPageRange, NULL);
842 // Reset selection only flag for the same reason. 843 // Reset selection only flag for the same reason.
843 settings->SetBoolean(printing::kSettingShouldPrintSelectionOnly, false); 844 settings->SetBoolean(printing::kSettingShouldPrintSelectionOnly, false);
844 845
845 // Set ID to know whether printing is for preview. 846 // Set ID to know whether printing is for preview.
846 settings->SetInteger(printing::kPreviewUIID, 847 settings->SetInteger(printing::kPreviewUIID,
847 print_preview_ui->GetIDForPrintPreviewUI()); 848 print_preview_ui->GetIDForPrintPreviewUI());
848 RenderViewHost* rvh = preview_web_contents()->GetRenderViewHost(); 849 RenderViewHost* rvh = preview_web_contents()->GetRenderViewHost();
849 rvh->Send(new PrintMsg_PrintForPrintPreview(rvh->GetRoutingID(), 850 rvh->Send(new PrintMsg_PrintForPrintPreview(rvh->GetRoutingID(),
850 *settings)); 851 *settings));
851 852
852 // For all other cases above, the preview dialog will stay open until the 853 // For all other cases above, the preview dialog will stay open until the
853 // printing has finished. Then the dialog closes and PrintPreviewDone() gets 854 // printing has finished. Then the dialog closes and PrintPreviewDone() gets
854 // called. In the case below, since the preview dialog will be hidden and 855 // called. In the case below, since the preview dialog will be hidden and
855 // not closed, we need to make this call. 856 // not closed, we need to make this call.
856 WebContents* initiator = GetInitiator();
857 if (initiator) { 857 if (initiator) {
858 printing::PrintViewManager* print_view_manager = 858 printing::PrintViewManager* print_view_manager =
859 printing::PrintViewManager::FromWebContents(initiator); 859 printing::PrintViewManager::FromWebContents(initiator);
860 print_view_manager->PrintPreviewDone(); 860 print_view_manager->PrintPreviewDone();
861 } 861 }
862 } 862 }
863 } 863 }
864 864
865 void PrintPreviewHandler::PrintToPdf() { 865 void PrintPreviewHandler::PrintToPdf() {
866 if (!print_to_pdf_path_.empty()) { 866 if (!print_to_pdf_path_.empty()) {
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after
1556 1556
1557 void PrintPreviewHandler::UnregisterForMergeSession() { 1557 void PrintPreviewHandler::UnregisterForMergeSession() {
1558 if (reconcilor_) 1558 if (reconcilor_)
1559 reconcilor_->RemoveMergeSessionObserver(this); 1559 reconcilor_->RemoveMergeSessionObserver(this);
1560 } 1560 }
1561 1561
1562 void PrintPreviewHandler::SetPdfSavedClosureForTesting( 1562 void PrintPreviewHandler::SetPdfSavedClosureForTesting(
1563 const base::Closure& closure) { 1563 const base::Closure& closure) {
1564 pdf_file_saved_closure_ = closure; 1564 pdf_file_saved_closure_ = closure;
1565 } 1565 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698