OLD | NEW |
---|---|
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 Loading... | |
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. | |
494 settings->SetString(printing::kSettingHeaderFooterTitle, | |
kmadhusu
2011/08/01 17:17:08
Set the header and footer info in |settings| only
Aayush Kumar
2011/08/02 00:18:13
Done.
| |
495 initiator_tab->GetTitle()); | |
496 std::string url; | |
497 NavigationEntry* entry = initiator_tab->controller().GetActiveEntry(); | |
498 if (entry) | |
499 url = entry->virtual_url().spec(); | |
500 settings->SetString(printing::kSettingHeaderFooterURL, url); | |
501 | |
492 VLOG(1) << "Print preview request start"; | 502 VLOG(1) << "Print preview request start"; |
493 RenderViewHost* rvh = initiator_tab->render_view_host(); | 503 RenderViewHost* rvh = initiator_tab->render_view_host(); |
494 rvh->Send(new PrintMsg_PrintPreview(rvh->routing_id(), *settings)); | 504 rvh->Send(new PrintMsg_PrintPreview(rvh->routing_id(), *settings)); |
495 } | 505 } |
496 | 506 |
497 void PrintPreviewHandler::HandlePrint(const ListValue* args) { | 507 void PrintPreviewHandler::HandlePrint(const ListValue* args) { |
498 ReportStats(); | 508 ReportStats(); |
499 | 509 |
500 // Record the number of times the user requests to regenerate preview data | 510 // Record the number of times the user requests to regenerate preview data |
501 // before printing. | 511 // before printing. |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
886 return; | 896 return; |
887 | 897 |
888 // We no longer require the initiator tab details. Remove those details | 898 // We no longer require the initiator tab details. Remove those details |
889 // associated with the preview tab to allow the initiator tab to create | 899 // associated with the preview tab to allow the initiator tab to create |
890 // another preview tab. | 900 // another preview tab. |
891 printing::PrintPreviewTabController* tab_controller = | 901 printing::PrintPreviewTabController* tab_controller = |
892 printing::PrintPreviewTabController::GetInstance(); | 902 printing::PrintPreviewTabController::GetInstance(); |
893 if (tab_controller) | 903 if (tab_controller) |
894 tab_controller->EraseInitiatorTabInfo(preview_tab()); | 904 tab_controller->EraseInitiatorTabInfo(preview_tab()); |
895 } | 905 } |
OLD | NEW |