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

Side by Side Diff: chrome/renderer/mock_printer.cc

Issue 7550022: Print Preview: Fixing behavior of event listeners. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressing comments Created 9 years, 4 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 | « chrome/renderer/mock_printer.h ('k') | chrome/renderer/mock_render_thread.h » ('j') | no next file with comments »
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/renderer/mock_printer.h" 5 #include "chrome/renderer/mock_printer.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/shared_memory.h" 8 #include "base/shared_memory.h"
9 #include "chrome/common/print_messages.h" 9 #include "chrome/common/print_messages.h"
10 #include "ipc/ipc_message_utils.h" 10 #include "ipc/ipc_message_utils.h"
(...skipping 17 matching lines...) Expand all
28 MockPrinter::MockPrinter() 28 MockPrinter::MockPrinter()
29 : dpi_(printing::kPointsPerInch), 29 : dpi_(printing::kPointsPerInch),
30 max_shrink_(2.0), 30 max_shrink_(2.0),
31 min_shrink_(1.25), 31 min_shrink_(1.25),
32 desired_dpi_(printing::kPointsPerInch), 32 desired_dpi_(printing::kPointsPerInch),
33 selection_only_(false), 33 selection_only_(false),
34 document_cookie_(-1), 34 document_cookie_(-1),
35 current_document_cookie_(0), 35 current_document_cookie_(0),
36 printer_status_(PRINTER_READY), 36 printer_status_(PRINTER_READY),
37 number_pages_(0), 37 number_pages_(0),
38 page_number_(0) { 38 page_number_(0),
39 is_first_request_(true),
40 preview_request_id_(0) {
39 page_size_.SetSize(static_cast<int>(8.5 * dpi_), 41 page_size_.SetSize(static_cast<int>(8.5 * dpi_),
40 static_cast<int>(11.0 * dpi_)); 42 static_cast<int>(11.0 * dpi_));
41 printable_size_.SetSize(static_cast<int>((7.5 * dpi_)), 43 printable_size_.SetSize(static_cast<int>((7.5 * dpi_)),
42 static_cast<int>((10.0 * dpi_))); 44 static_cast<int>((10.0 * dpi_)));
43 margin_left_ = margin_top_ = static_cast<int>(0.5 * dpi_); 45 margin_left_ = margin_top_ = static_cast<int>(0.5 * dpi_);
44 } 46 }
45 47
46 MockPrinter::~MockPrinter() { 48 MockPrinter::~MockPrinter() {
47 } 49 }
48 50
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 85
84 memset(settings, 0, sizeof(PrintMsg_PrintPages_Params)); 86 memset(settings, 0, sizeof(PrintMsg_PrintPages_Params));
85 settings->params.dpi = dpi_; 87 settings->params.dpi = dpi_;
86 settings->params.max_shrink = max_shrink_; 88 settings->params.max_shrink = max_shrink_;
87 settings->params.min_shrink = min_shrink_; 89 settings->params.min_shrink = min_shrink_;
88 settings->params.desired_dpi = desired_dpi_; 90 settings->params.desired_dpi = desired_dpi_;
89 settings->params.selection_only = selection_only_; 91 settings->params.selection_only = selection_only_;
90 settings->params.document_cookie = document_cookie_; 92 settings->params.document_cookie = document_cookie_;
91 settings->params.page_size = page_size_; 93 settings->params.page_size = page_size_;
92 settings->params.printable_size = printable_size_; 94 settings->params.printable_size = printable_size_;
95 settings->params.is_first_request = is_first_request_;
96 settings->params.preview_request_id = preview_request_id_;
93 printer_status_ = PRINTER_PRINTING; 97 printer_status_ = PRINTER_PRINTING;
94 } 98 }
95 99
96 void MockPrinter::UpdateSettings(int cookie, 100 void MockPrinter::UpdateSettings(int cookie,
97 PrintMsg_PrintPages_Params* params) { 101 PrintMsg_PrintPages_Params* params) {
98 EXPECT_EQ(document_cookie_, cookie); 102 EXPECT_EQ(document_cookie_, cookie);
99 103
100 memset(params, 0, sizeof(PrintMsg_PrintPages_Params)); 104 memset(params, 0, sizeof(PrintMsg_PrintPages_Params));
101 SetPrintParams(&(params->params)); 105 SetPrintParams(&(params->params));
102 printer_status_ = PRINTER_PRINTING; 106 printer_status_ = PRINTER_PRINTING;
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 params->dpi = dpi_; 227 params->dpi = dpi_;
224 params->max_shrink = max_shrink_; 228 params->max_shrink = max_shrink_;
225 params->min_shrink = min_shrink_; 229 params->min_shrink = min_shrink_;
226 params->desired_dpi = desired_dpi_; 230 params->desired_dpi = desired_dpi_;
227 params->selection_only = selection_only_; 231 params->selection_only = selection_only_;
228 params->document_cookie = document_cookie_; 232 params->document_cookie = document_cookie_;
229 params->page_size = page_size_; 233 params->page_size = page_size_;
230 params->printable_size = printable_size_; 234 params->printable_size = printable_size_;
231 params->margin_left = margin_left_; 235 params->margin_left = margin_left_;
232 params->margin_top = margin_top_; 236 params->margin_top = margin_top_;
237 params->is_first_request = is_first_request_;
238 params->preview_request_id = preview_request_id_;
233 } 239 }
OLDNEW
« no previous file with comments | « chrome/renderer/mock_printer.h ('k') | chrome/renderer/mock_render_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698