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

Unified Diff: chrome/renderer/mock_render_thread.cc

Issue 7365003: Print Preview: Make preview generation event driven to eliminate synchronous messages. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: clang fix Created 9 years, 5 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
« no previous file with comments | « chrome/renderer/mock_render_thread.h ('k') | chrome/renderer/print_web_view_helper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/mock_render_thread.cc
===================================================================
--- chrome/renderer/mock_render_thread.cc (revision 92822)
+++ chrome/renderer/mock_render_thread.cc (working copy)
@@ -25,7 +25,7 @@
reply_deserializer_(NULL),
printer_(new MockPrinter),
print_dialog_user_response_(true),
- cancel_print_preview_(false) {
+ print_preview_pages_remaining_(0) {
}
MockRenderThread::~MockRenderThread() {
@@ -61,7 +61,7 @@
}
// Called by the Widget. Used to send messages to the browser.
-// We short-circuit the mechanim and handle the messages right here on this
+// We short-circuit the mechanism and handle the messages right here on this
// class.
bool MockRenderThread::Send(IPC::Message* msg) {
// We need to simulate a synchronous channel, thus we are going to receive
@@ -103,15 +103,14 @@
OnMsgOpenChannelToExtension)
IPC_MESSAGE_HANDLER(PrintHostMsg_GetDefaultPrintSettings,
OnGetDefaultPrintSettings)
- IPC_MESSAGE_HANDLER(PrintHostMsg_ScriptedPrint,
- OnScriptedPrint)
- IPC_MESSAGE_HANDLER(PrintHostMsg_UpdatePrintSettings,
- OnUpdatePrintSettings)
+ IPC_MESSAGE_HANDLER(PrintHostMsg_ScriptedPrint, OnScriptedPrint)
+ IPC_MESSAGE_HANDLER(PrintHostMsg_UpdatePrintSettings, OnUpdatePrintSettings)
IPC_MESSAGE_HANDLER(PrintHostMsg_DidGetPrintedPagesCount,
OnDidGetPrintedPagesCount)
IPC_MESSAGE_HANDLER(PrintHostMsg_DidPrintPage, OnDidPrintPage)
- IPC_MESSAGE_HANDLER(PrintHostMsg_DidPreviewPage,
- OnDidPreviewPage)
+ IPC_MESSAGE_HANDLER(PrintHostMsg_DidGetPreviewPageCount,
+ OnDidGetPreviewPageCount)
+ IPC_MESSAGE_HANDLER(PrintHostMsg_DidPreviewPage, OnDidPreviewPage)
#if defined(OS_WIN)
IPC_MESSAGE_HANDLER(PrintHostMsg_DuplicateSection, OnDuplicateSection)
#endif
@@ -212,10 +211,17 @@
printer_->PrintPage(params);
}
-void MockRenderThread::OnDidPreviewPage(int page_number, bool* cancel) {
- *cancel = cancel_print_preview_;
+void MockRenderThread::OnDidGetPreviewPageCount(int document_cookie,
+ int number_pages) {
+ print_preview_pages_remaining_ = number_pages;
}
+void MockRenderThread::OnDidPreviewPage(int page_number) {
+ if (page_number < 0)
+ return;
+ print_preview_pages_remaining_--;
+}
+
void MockRenderThread::OnUpdatePrintSettings(
int document_cookie,
const DictionaryValue& job_settings,
@@ -242,6 +248,6 @@
print_dialog_user_response_ = response;
}
-void MockRenderThread::set_cancel_print_preview(bool cancel) {
- cancel_print_preview_ = cancel;
+int MockRenderThread::print_preview_pages_remaining() {
+ return print_preview_pages_remaining_;
}
« no previous file with comments | « chrome/renderer/mock_render_thread.h ('k') | chrome/renderer/print_web_view_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698