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

Unified Diff: chrome/browser/printing/print_view_manager.cc

Issue 6775013: PrintPreview: While printing the preview data, set the initiator tab title as print job name. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fix a style error Created 9 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/printing/print_view_manager.cc
diff --git a/chrome/browser/printing/print_view_manager.cc b/chrome/browser/printing/print_view_manager.cc
index 20ac4eaacf617c126dd04a8aaa91ee743e6e9578..839273d20abb9514e0110a1506455348862edde3 100644
--- a/chrome/browser/printing/print_view_manager.cc
+++ b/chrome/browser/printing/print_view_manager.cc
@@ -60,10 +60,14 @@ void PrintViewManager::RenderViewGone() {
}
string16 PrintViewManager::RenderSourceName() {
- string16 name(tab_contents()->GetTitle());
- if (name.empty())
- name = l10n_util::GetStringUTF16(IDS_DEFAULT_PRINT_DOCUMENT_TITLE);
- return name;
+ if (job_title_.empty()) {
+ string16 name(tab_contents()->GetTitle());
+ if (name.empty())
+ job_title_ = l10n_util::GetStringUTF16(IDS_DEFAULT_PRINT_DOCUMENT_TITLE);
+ else
+ job_title_ = name;
+ }
+ return job_title_;
}
GURL PrintViewManager::RenderSourceUrl() {
@@ -74,10 +78,13 @@ GURL PrintViewManager::RenderSourceUrl() {
return GURL();
}
-void PrintViewManager::OnDidGetPrintedPagesCount(int cookie, int number_pages) {
+void PrintViewManager::OnDidGetBasicPrintJobInfo(
+ int cookie, int number_pages, const string16& job_title) {
DCHECK_GT(cookie, 0);
DCHECK_GT(number_pages, 0);
number_pages_ = number_pages;
+ job_title_ = job_title;
+
if (!OpportunisticallyCreatePrintJob(cookie))
return;
@@ -152,8 +159,8 @@ void PrintViewManager::OnDidPrintPage(
bool PrintViewManager::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(PrintViewManager, message)
- IPC_MESSAGE_HANDLER(PrintHostMsg_DidGetPrintedPagesCount,
- OnDidGetPrintedPagesCount)
+ IPC_MESSAGE_HANDLER(PrintHostMsg_DidGetBasicPrintJobInfo,
+ OnDidGetBasicPrintJobInfo)
IPC_MESSAGE_HANDLER(PrintHostMsg_DidPrintPage, OnDidPrintPage)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()

Powered by Google App Engine
This is Rietveld 408576698