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

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

Issue 7015026: Cancel prerenders for pages that call window.print() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comment responses. Created 9 years, 7 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_view_manager.h" 5 #include "chrome/browser/printing/print_view_manager.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/printing/print_job.h" 10 #include "chrome/browser/printing/print_job.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 metafile.release(), 160 metafile.release(),
161 params.actual_shrink, 161 params.actual_shrink,
162 params.page_size, 162 params.page_size,
163 params.content_area, 163 params.content_area,
164 params.has_visible_overlays); 164 params.has_visible_overlays);
165 165
166 ShouldQuitFromInnerMessageLoop(); 166 ShouldQuitFromInnerMessageLoop();
167 } 167 }
168 168
169 void PrintViewManager::OnPrintingFailed(int cookie) { 169 void PrintViewManager::OnPrintingFailed(int cookie) {
170 scoped_refptr<PrinterQuery> printer_query; 170 g_browser_process->print_job_manager()->PopAndStopPrinterQuery(cookie);
171 g_browser_process->print_job_manager()->PopPrinterQuery(cookie,
172 &printer_query);
173 if (printer_query.get()) {
174 BrowserThread::PostTask(
175 BrowserThread::IO, FROM_HERE,
176 NewRunnableMethod(printer_query.get(),
177 &printing::PrinterQuery::StopWorker));
178 }
179
180 NotificationService::current()->Notify( 171 NotificationService::current()->Notify(
181 NotificationType::PRINT_JOB_RELEASED, 172 NotificationType::PRINT_JOB_RELEASED,
182 Source<TabContents>(tab_contents()), 173 Source<TabContents>(tab_contents()),
183 NotificationService::NoDetails()); 174 NotificationService::NoDetails());
184 } 175 }
185 176
186 bool PrintViewManager::OnMessageReceived(const IPC::Message& message) { 177 bool PrintViewManager::OnMessageReceived(const IPC::Message& message) {
187 bool handled = true; 178 bool handled = true;
188 IPC_BEGIN_MESSAGE_MAP(PrintViewManager, message) 179 IPC_BEGIN_MESSAGE_MAP(PrintViewManager, message)
189 IPC_MESSAGE_HANDLER(PrintHostMsg_DidGetPrintedPagesCount, 180 IPC_MESSAGE_HANDLER(PrintHostMsg_DidGetPrintedPagesCount,
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 return false; 447 return false;
457 } 448 }
458 449
459 // Settings are already loaded. Go ahead. This will set 450 // Settings are already loaded. Go ahead. This will set
460 // print_job_->is_job_pending() to true. 451 // print_job_->is_job_pending() to true.
461 print_job_->StartPrinting(); 452 print_job_->StartPrinting();
462 return true; 453 return true;
463 } 454 }
464 455
465 } // namespace printing 456 } // namespace printing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698