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

Side by Side Diff: chrome/browser/printing/print_preview_message_handler.cc

Issue 6783005: Print Preview: Set a print job's title and url correctly. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: tab helpers stay with friends Created 9 years, 8 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 | chrome/browser/printing/print_view_manager.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/printing/print_preview_message_handler.h" 5 #include "chrome/browser/printing/print_preview_message_handler.h"
6 6
7 #include "chrome/browser/browser_process.h" 7 #include "chrome/browser/browser_process.h"
8 #include "chrome/browser/printing/print_job_manager.h" 8 #include "chrome/browser/printing/print_job_manager.h"
9 #include "chrome/browser/printing/print_preview_tab_controller.h" 9 #include "chrome/browser/printing/print_preview_tab_controller.h"
10 #include "chrome/browser/printing/print_view_manager.h"
10 #include "chrome/browser/printing/printer_query.h" 11 #include "chrome/browser/printing/printer_query.h"
12 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
11 #include "chrome/browser/ui/webui/print_preview_handler.h" 13 #include "chrome/browser/ui/webui/print_preview_handler.h"
12 #include "chrome/browser/ui/webui/print_preview_ui.h" 14 #include "chrome/browser/ui/webui/print_preview_ui.h"
13 #include "chrome/browser/ui/webui/print_preview_ui_html_source.h" 15 #include "chrome/browser/ui/webui/print_preview_ui_html_source.h"
14 #include "chrome/common/content_restriction.h" 16 #include "chrome/common/content_restriction.h"
15 #include "chrome/common/print_messages.h" 17 #include "chrome/common/print_messages.h"
16 #include "content/browser/browser_thread.h" 18 #include "content/browser/browser_thread.h"
17 #include "content/browser/renderer_host/render_view_host.h" 19 #include "content/browser/renderer_host/render_view_host.h"
18 #include "content/browser/tab_contents/tab_contents.h" 20 #include "content/browser/tab_contents/tab_contents.h"
19 21
20 namespace printing { 22 namespace printing {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 return; 64 return;
63 65
64 base::SharedMemory* shared_buf = 66 base::SharedMemory* shared_buf =
65 new base::SharedMemory(params.metafile_data_handle, true); 67 new base::SharedMemory(params.metafile_data_handle, true);
66 if (!shared_buf->Map(params.data_size)) { 68 if (!shared_buf->Map(params.data_size)) {
67 NOTREACHED(); 69 NOTREACHED();
68 delete shared_buf; 70 delete shared_buf;
69 return; 71 return;
70 } 72 }
71 73
74 TabContentsWrapper* wrapper =
75 TabContentsWrapper::GetCurrentWrapperForContents(print_preview_tab);
76 wrapper->print_view_manager()->OverrideTitle(tab_contents());
77
72 PrintPreviewUI* print_preview_ui = 78 PrintPreviewUI* print_preview_ui =
73 static_cast<PrintPreviewUI*>(print_preview_tab->web_ui()); 79 static_cast<PrintPreviewUI*>(print_preview_tab->web_ui());
74 PrintPreviewUIHTMLSource* html_source = print_preview_ui->html_source(); 80 PrintPreviewUIHTMLSource* html_source = print_preview_ui->html_source();
75 html_source->SetPrintPreviewData( 81 html_source->SetPrintPreviewData(
76 std::make_pair(shared_buf, params.data_size)); 82 std::make_pair(shared_buf, params.data_size));
77 print_preview_ui->PreviewDataIsAvailable(params.expected_pages_count, 83 print_preview_ui->PreviewDataIsAvailable(params.expected_pages_count,
78 tab_contents()->GetTitle()); 84 tab_contents()->GetTitle());
79 } 85 }
80 86
81 void PrintPreviewMessageHandler::OnPrintPreviewNodeUnderContextMenu() { 87 void PrintPreviewMessageHandler::OnPrintPreviewNodeUnderContextMenu() {
(...skipping 20 matching lines...) Expand all
102 } 108 }
103 109
104 void PrintPreviewMessageHandler::DidStartLoading() { 110 void PrintPreviewMessageHandler::DidStartLoading() {
105 if (tab_contents()->delegate() && 111 if (tab_contents()->delegate() &&
106 printing::PrintPreviewTabController::IsPrintPreviewTab(tab_contents())) { 112 printing::PrintPreviewTabController::IsPrintPreviewTab(tab_contents())) {
107 tab_contents()->SetContentRestrictions(CONTENT_RESTRICTION_PRINT); 113 tab_contents()->SetContentRestrictions(CONTENT_RESTRICTION_PRINT);
108 } 114 }
109 } 115 }
110 116
111 } // namespace printing 117 } // namespace printing
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/printing/print_view_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698