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

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

Issue 7574002: Be able to print items that do window.print(); window.close() (airline tix e.g.) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed Lei's comments. Created 9 years, 3 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
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 <vector> 7 #include <vector>
8 8
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/ref_counted_memory.h" 10 #include "base/memory/ref_counted_memory.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 // Inform the print preview tab of the failure. 178 // Inform the print preview tab of the failure.
179 TabContents* print_preview_tab = GetPrintPreviewTab(); 179 TabContents* print_preview_tab = GetPrintPreviewTab();
180 // User might have closed it already. 180 // User might have closed it already.
181 if (!print_preview_tab) 181 if (!print_preview_tab)
182 return; 182 return;
183 183
184 TabContentsWrapper* wrapper = 184 TabContentsWrapper* wrapper =
185 TabContentsWrapper::GetCurrentWrapperForContents(print_preview_tab); 185 TabContentsWrapper::GetCurrentWrapperForContents(print_preview_tab);
186 186
187 if (g_browser_process->background_printing_manager()-> 187 if (g_browser_process->background_printing_manager()->
188 HasTabContents(wrapper)) { 188 HasPreviewTabContents(wrapper)) {
189 // Preview tab was hidden to serve the print request. 189 // Preview tab was hidden to serve the print request.
190 delete wrapper; 190 delete wrapper;
191 } else { 191 } else {
192 PrintPreviewUI* print_preview_ui = 192 PrintPreviewUI* print_preview_ui =
193 static_cast<PrintPreviewUI*>(print_preview_tab->web_ui()); 193 static_cast<PrintPreviewUI*>(print_preview_tab->web_ui());
194 print_preview_ui->OnPrintPreviewFailed(); 194 print_preview_ui->OnPrintPreviewFailed();
195 } 195 }
196 } 196 }
197 197
198 void PrintPreviewMessageHandler::OnDidGetDefaultPageLayout( 198 void PrintPreviewMessageHandler::OnDidGetDefaultPageLayout(
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 } 235 }
236 236
237 void PrintPreviewMessageHandler::DidStartLoading() { 237 void PrintPreviewMessageHandler::DidStartLoading() {
238 if (tab_contents()->delegate() && 238 if (tab_contents()->delegate() &&
239 printing::PrintPreviewTabController::IsPrintPreviewTab(tab_contents())) { 239 printing::PrintPreviewTabController::IsPrintPreviewTab(tab_contents())) {
240 tab_contents()->SetContentRestrictions(CONTENT_RESTRICTION_PRINT); 240 tab_contents()->SetContentRestrictions(CONTENT_RESTRICTION_PRINT);
241 } 241 }
242 } 242 }
243 243
244 } // namespace printing 244 } // namespace printing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698