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

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

Issue 7761014: Print Preview: Fix activating the initiator tab when printing. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 | Annotate | Revision Log
« 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_handler.h" 5 #include "chrome/browser/ui/webui/print_preview_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #if !defined(OS_CHROMEOS) 10 #if !defined(OS_CHROMEOS)
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 FilePath::StringType print_job_title = UTF16ToUTF8(print_job_title_utf16); 572 FilePath::StringType print_job_title = UTF16ToUTF8(print_job_title_utf16);
573 #endif 573 #endif
574 574
575 file_util::ReplaceIllegalCharactersInPath(&print_job_title, '_'); 575 file_util::ReplaceIllegalCharactersInPath(&print_job_title, '_');
576 FilePath default_filename(print_job_title); 576 FilePath default_filename(print_job_title);
577 default_filename = 577 default_filename =
578 default_filename.ReplaceExtension(FILE_PATH_LITERAL("pdf")); 578 default_filename.ReplaceExtension(FILE_PATH_LITERAL("pdf"));
579 579
580 SelectFile(default_filename); 580 SelectFile(default_filename);
581 } else { 581 } else {
582 ClearInitiatorTabDetails();
583 ReportPrintSettingsStats(*settings); 582 ReportPrintSettingsStats(*settings);
584 ReportUserActionHistogram(PRINT_TO_PRINTER); 583 ReportUserActionHistogram(PRINT_TO_PRINTER);
585 UMA_HISTOGRAM_COUNTS("PrintPreview.PageCount.PrintToPrinter", 584 UMA_HISTOGRAM_COUNTS("PrintPreview.PageCount.PrintToPrinter",
586 GetPageCountFromSettingsDictionary(*settings)); 585 GetPageCountFromSettingsDictionary(*settings));
587 586
587 // This tries to activate the initiator tab as well, so do not clear the
588 // association with the initiator tab yet.
588 HidePreviewTab(); 589 HidePreviewTab();
589 590
591 // Do this so the initiator tab can open a new print preview tab.
592 ClearInitiatorTabDetails();
593
590 // The PDF being printed contains only the pages that the user selected, 594 // The PDF being printed contains only the pages that the user selected,
591 // so ignore the page range and print all pages. 595 // so ignore the page range and print all pages.
592 settings->Remove(printing::kSettingPageRange, NULL); 596 settings->Remove(printing::kSettingPageRange, NULL);
593 RenderViewHost* rvh = web_ui_->tab_contents()->render_view_host(); 597 RenderViewHost* rvh = web_ui_->tab_contents()->render_view_host();
594 rvh->Send(new PrintMsg_PrintForPrintPreview(rvh->routing_id(), *settings)); 598 rvh->Send(new PrintMsg_PrintForPrintPreview(rvh->routing_id(), *settings));
595 } 599 }
596 } 600 }
597 601
598 void PrintPreviewHandler::HandleHidePreview(const ListValue*) { 602 void PrintPreviewHandler::HandleHidePreview(const ListValue*) {
599 HidePreviewTab(); 603 HidePreviewTab();
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 return; 945 return;
942 946
943 // We no longer require the initiator tab details. Remove those details 947 // We no longer require the initiator tab details. Remove those details
944 // associated with the preview tab to allow the initiator tab to create 948 // associated with the preview tab to allow the initiator tab to create
945 // another preview tab. 949 // another preview tab.
946 printing::PrintPreviewTabController* tab_controller = 950 printing::PrintPreviewTabController* tab_controller =
947 printing::PrintPreviewTabController::GetInstance(); 951 printing::PrintPreviewTabController::GetInstance();
948 if (tab_controller) 952 if (tab_controller)
949 tab_controller->EraseInitiatorTabInfo(preview_tab()); 953 tab_controller->EraseInitiatorTabInfo(preview_tab());
950 } 954 }
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