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

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

Issue 7063030: PrintPreview: Print Preview is not staying associated with initiator renderer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 9 years, 6 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/profiles/profile.h » ('j') | chrome/browser/profiles/profile.h » ('J')
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/print_view_manager.h"
11 #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" 12 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
13 #include "chrome/browser/ui/webui/print_preview_handler.h" 13 #include "chrome/browser/ui/webui/print_preview_handler.h"
14 #include "chrome/browser/ui/webui/print_preview_ui.h" 14 #include "chrome/browser/ui/webui/print_preview_ui.h"
15 #include "chrome/browser/ui/webui/print_preview_ui_html_source.h"
16 #include "chrome/common/print_messages.h" 15 #include "chrome/common/print_messages.h"
17 #include "content/browser/browser_thread.h" 16 #include "content/browser/browser_thread.h"
18 #include "content/browser/renderer_host/render_view_host.h" 17 #include "content/browser/renderer_host/render_view_host.h"
19 #include "content/browser/tab_contents/tab_contents.h" 18 #include "content/browser/tab_contents/tab_contents.h"
20 #include "content/common/content_restriction.h" 19 #include "content/common/content_restriction.h"
21 20
22 namespace { 21 namespace {
23 22
24 void StopWorker(int document_cookie) { 23 void StopWorker(int document_cookie) {
25 printing::PrintJobManager* print_job_manager = 24 printing::PrintJobManager* print_job_manager =
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 delete shared_buf; 76 delete shared_buf;
78 return; 77 return;
79 } 78 }
80 79
81 TabContentsWrapper* wrapper = 80 TabContentsWrapper* wrapper =
82 TabContentsWrapper::GetCurrentWrapperForContents(print_preview_tab); 81 TabContentsWrapper::GetCurrentWrapperForContents(print_preview_tab);
83 wrapper->print_view_manager()->OverrideTitle(tab_contents()); 82 wrapper->print_view_manager()->OverrideTitle(tab_contents());
84 83
85 PrintPreviewUI* print_preview_ui = 84 PrintPreviewUI* print_preview_ui =
86 static_cast<PrintPreviewUI*>(print_preview_tab->web_ui()); 85 static_cast<PrintPreviewUI*>(print_preview_tab->web_ui());
87 PrintPreviewUIHTMLSource* html_source = print_preview_ui->html_source(); 86 print_preview_ui->SetPrintPreviewData(
88 html_source->SetPrintPreviewData(
89 std::make_pair(shared_buf, params.data_size)); 87 std::make_pair(shared_buf, params.data_size));
90 print_preview_ui->OnPreviewDataIsAvailable( 88 print_preview_ui->OnPreviewDataIsAvailable(
91 params.expected_pages_count, 89 params.expected_pages_count,
92 wrapper->print_view_manager()->RenderSourceName(), 90 wrapper->print_view_manager()->RenderSourceName(),
93 params.modifiable); 91 params.modifiable);
94 } 92 }
95 93
96 void PrintPreviewMessageHandler::OnPrintPreviewNodeUnderContextMenu() { 94 void PrintPreviewMessageHandler::OnPrintPreviewNodeUnderContextMenu() {
97 PrintPreviewTabController::PrintPreview(tab_contents()); 95 PrintPreviewTabController::PrintPreview(tab_contents());
98 } 96 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 } 129 }
132 130
133 void PrintPreviewMessageHandler::DidStartLoading() { 131 void PrintPreviewMessageHandler::DidStartLoading() {
134 if (tab_contents()->delegate() && 132 if (tab_contents()->delegate() &&
135 printing::PrintPreviewTabController::IsPrintPreviewTab(tab_contents())) { 133 printing::PrintPreviewTabController::IsPrintPreviewTab(tab_contents())) {
136 tab_contents()->SetContentRestrictions(CONTENT_RESTRICTION_PRINT); 134 tab_contents()->SetContentRestrictions(CONTENT_RESTRICTION_PRINT);
137 } 135 }
138 } 136 }
139 137
140 } // namespace printing 138 } // namespace printing
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/profiles/profile.h » ('j') | chrome/browser/profiles/profile.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698