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

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

Issue 7348010: Added Header and Footer support using Skia (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Remove header_footer_info from settings Dictionary. Changes as per Steve and Kausalya's comments. 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 | « chrome/browser/ui/webui/print_preview_data_source.cc ('k') | chrome/common/print_messages.h » ('j') | 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 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 482
483 TabContents* initiator_tab = GetInitiatorTab(); 483 TabContents* initiator_tab = GetInitiatorTab();
484 if (!initiator_tab) { 484 if (!initiator_tab) {
485 if (!reported_failed_preview_) { 485 if (!reported_failed_preview_) {
486 ReportUserActionHistogram(PREVIEW_FAILED); 486 ReportUserActionHistogram(PREVIEW_FAILED);
487 reported_failed_preview_ = true; 487 reported_failed_preview_ = true;
488 } 488 }
489 print_preview_ui->OnPrintPreviewFailed(); 489 print_preview_ui->OnPrintPreviewFailed();
490 return; 490 return;
491 } 491 }
492
493 // Retrieve the page title and url and send it to the renderer process if
494 // headers and footers are to be displayed.
495 bool display_header_footer;
Lei Zhang 2011/08/03 01:28:31 If you don't initialize |display_header_footer|, y
Aayush Kumar 2011/08/03 15:52:54 Done.
496 if (!settings->GetBoolean(printing::kSettingHeaderFooter,
497 &display_header_footer)) {
498 NOTREACHED();
499 }
500 if (display_header_footer) {
501 settings->SetString(printing::kSettingHeaderFooterTitle,
502 initiator_tab->GetTitle());
503 std::string url;
504 NavigationEntry* entry = initiator_tab->controller().GetActiveEntry();
505 if (entry)
506 url = entry->virtual_url().spec();
507 settings->SetString(printing::kSettingHeaderFooterURL, url);
508 }
509
492 VLOG(1) << "Print preview request start"; 510 VLOG(1) << "Print preview request start";
493 RenderViewHost* rvh = initiator_tab->render_view_host(); 511 RenderViewHost* rvh = initiator_tab->render_view_host();
494 rvh->Send(new PrintMsg_PrintPreview(rvh->routing_id(), *settings)); 512 rvh->Send(new PrintMsg_PrintPreview(rvh->routing_id(), *settings));
495 } 513 }
496 514
497 void PrintPreviewHandler::HandlePrint(const ListValue* args) { 515 void PrintPreviewHandler::HandlePrint(const ListValue* args) {
498 ReportStats(); 516 ReportStats();
499 517
500 // Record the number of times the user requests to regenerate preview data 518 // Record the number of times the user requests to regenerate preview data
501 // before printing. 519 // before printing.
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 return; 904 return;
887 905
888 // We no longer require the initiator tab details. Remove those details 906 // We no longer require the initiator tab details. Remove those details
889 // associated with the preview tab to allow the initiator tab to create 907 // associated with the preview tab to allow the initiator tab to create
890 // another preview tab. 908 // another preview tab.
891 printing::PrintPreviewTabController* tab_controller = 909 printing::PrintPreviewTabController* tab_controller =
892 printing::PrintPreviewTabController::GetInstance(); 910 printing::PrintPreviewTabController::GetInstance();
893 if (tab_controller) 911 if (tab_controller)
894 tab_controller->EraseInitiatorTabInfo(preview_tab()); 912 tab_controller->EraseInitiatorTabInfo(preview_tab());
895 } 913 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/print_preview_data_source.cc ('k') | chrome/common/print_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698