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

Side by Side Diff: components/printing/test/print_mock_render_thread.cc

Issue 1556463003: Mark printing code as basic printing and/or print preview code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 11 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "components/printing/test/print_mock_render_thread.h" 5 #include "components/printing/test/print_mock_render_thread.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 bool handled = true; 51 bool handled = true;
52 IPC_BEGIN_MESSAGE_MAP(PrintMockRenderThread, msg) 52 IPC_BEGIN_MESSAGE_MAP(PrintMockRenderThread, msg)
53 #if defined(ENABLE_PRINTING) 53 #if defined(ENABLE_PRINTING)
54 IPC_MESSAGE_HANDLER(PrintHostMsg_GetDefaultPrintSettings, 54 IPC_MESSAGE_HANDLER(PrintHostMsg_GetDefaultPrintSettings,
55 OnGetDefaultPrintSettings) 55 OnGetDefaultPrintSettings)
56 IPC_MESSAGE_HANDLER(PrintHostMsg_ScriptedPrint, OnScriptedPrint) 56 IPC_MESSAGE_HANDLER(PrintHostMsg_ScriptedPrint, OnScriptedPrint)
57 IPC_MESSAGE_HANDLER(PrintHostMsg_UpdatePrintSettings, OnUpdatePrintSettings) 57 IPC_MESSAGE_HANDLER(PrintHostMsg_UpdatePrintSettings, OnUpdatePrintSettings)
58 IPC_MESSAGE_HANDLER(PrintHostMsg_DidGetPrintedPagesCount, 58 IPC_MESSAGE_HANDLER(PrintHostMsg_DidGetPrintedPagesCount,
59 OnDidGetPrintedPagesCount) 59 OnDidGetPrintedPagesCount)
60 IPC_MESSAGE_HANDLER(PrintHostMsg_DidPrintPage, OnDidPrintPage) 60 IPC_MESSAGE_HANDLER(PrintHostMsg_DidPrintPage, OnDidPrintPage)
61 #if defined(ENABLE_PRINT_PREVIEW)
61 IPC_MESSAGE_HANDLER(PrintHostMsg_DidGetPreviewPageCount, 62 IPC_MESSAGE_HANDLER(PrintHostMsg_DidGetPreviewPageCount,
62 OnDidGetPreviewPageCount) 63 OnDidGetPreviewPageCount)
63 IPC_MESSAGE_HANDLER(PrintHostMsg_DidPreviewPage, OnDidPreviewPage) 64 IPC_MESSAGE_HANDLER(PrintHostMsg_DidPreviewPage, OnDidPreviewPage)
64 IPC_MESSAGE_HANDLER(PrintHostMsg_CheckForCancel, OnCheckForCancel) 65 IPC_MESSAGE_HANDLER(PrintHostMsg_CheckForCancel, OnCheckForCancel)
66 #endif
65 #if defined(OS_WIN) 67 #if defined(OS_WIN)
66 IPC_MESSAGE_HANDLER(PrintHostMsg_DuplicateSection, OnDuplicateSection) 68 IPC_MESSAGE_HANDLER(PrintHostMsg_DuplicateSection, OnDuplicateSection)
67 #endif 69 #endif
68 #endif // defined(ENABLE_PRINTING) 70 #endif // defined(ENABLE_PRINTING)
69 IPC_MESSAGE_UNHANDLED(handled = false) 71 IPC_MESSAGE_UNHANDLED(handled = false)
70 IPC_END_MESSAGE_MAP() 72 IPC_END_MESSAGE_MAP()
71 return handled; 73 return handled;
72 } 74 }
73 75
74 #if defined(ENABLE_PRINTING) 76 #if defined(ENABLE_PRINTING)
(...skipping 15 matching lines...) Expand all
90 void PrintMockRenderThread::OnDidGetPrintedPagesCount(int cookie, 92 void PrintMockRenderThread::OnDidGetPrintedPagesCount(int cookie,
91 int number_pages) { 93 int number_pages) {
92 printer_->SetPrintedPagesCount(cookie, number_pages); 94 printer_->SetPrintedPagesCount(cookie, number_pages);
93 } 95 }
94 96
95 void PrintMockRenderThread::OnDidPrintPage( 97 void PrintMockRenderThread::OnDidPrintPage(
96 const PrintHostMsg_DidPrintPage_Params& params) { 98 const PrintHostMsg_DidPrintPage_Params& params) {
97 printer_->PrintPage(params); 99 printer_->PrintPage(params);
98 } 100 }
99 101
102 #if defined(ENABLE_PRINT_PREVIEW)
100 void PrintMockRenderThread::OnDidGetPreviewPageCount( 103 void PrintMockRenderThread::OnDidGetPreviewPageCount(
101 const PrintHostMsg_DidGetPreviewPageCount_Params& params) { 104 const PrintHostMsg_DidGetPreviewPageCount_Params& params) {
102 print_preview_pages_remaining_ = params.page_count; 105 print_preview_pages_remaining_ = params.page_count;
103 } 106 }
104 107
105 void PrintMockRenderThread::OnDidPreviewPage( 108 void PrintMockRenderThread::OnDidPreviewPage(
106 const PrintHostMsg_DidPreviewPage_Params& params) { 109 const PrintHostMsg_DidPreviewPage_Params& params) {
107 DCHECK_GE(params.page_number, printing::FIRST_PAGE_INDEX); 110 DCHECK_GE(params.page_number, printing::FIRST_PAGE_INDEX);
108 print_preview_pages_remaining_--; 111 print_preview_pages_remaining_--;
109 } 112 }
110 113
111 void PrintMockRenderThread::OnCheckForCancel(int32_t preview_ui_id, 114 void PrintMockRenderThread::OnCheckForCancel(int32_t preview_ui_id,
112 int preview_request_id, 115 int preview_request_id,
113 bool* cancel) { 116 bool* cancel) {
114 *cancel = 117 *cancel =
115 (print_preview_pages_remaining_ == print_preview_cancel_page_number_); 118 (print_preview_pages_remaining_ == print_preview_cancel_page_number_);
116 } 119 }
120 #endif // defined(ENABLE_PRINT_PREVIEW)
117 121
118 void PrintMockRenderThread::OnUpdatePrintSettings( 122 void PrintMockRenderThread::OnUpdatePrintSettings(
119 int document_cookie, 123 int document_cookie,
120 const base::DictionaryValue& job_settings, 124 const base::DictionaryValue& job_settings,
121 PrintMsg_PrintPages_Params* params, 125 PrintMsg_PrintPages_Params* params,
122 bool* canceled) { 126 bool* canceled) {
123 if (canceled) 127 if (canceled)
124 *canceled = false; 128 *canceled = false;
125 // Check and make sure the required settings are all there. 129 // Check and make sure the required settings are all there.
126 // We don't actually care about the values. 130 // We don't actually care about the values.
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 } 182 }
179 183
180 void PrintMockRenderThread::set_print_preview_cancel_page_number(int page) { 184 void PrintMockRenderThread::set_print_preview_cancel_page_number(int page) {
181 print_preview_cancel_page_number_ = page; 185 print_preview_cancel_page_number_ = page;
182 } 186 }
183 187
184 int PrintMockRenderThread::print_preview_pages_remaining() const { 188 int PrintMockRenderThread::print_preview_pages_remaining() const {
185 return print_preview_pages_remaining_; 189 return print_preview_pages_remaining_;
186 } 190 }
187 #endif // defined(ENABLE_PRINTING) 191 #endif // defined(ENABLE_PRINTING)
OLDNEW
« no previous file with comments | « components/printing/test/print_mock_render_thread.h ('k') | components/printing/test/print_web_view_helper_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698