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

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

Issue 149181: Move Emf class to the printing library. Also creates a platform agnostic Nat... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/plugin/webplugin_delegate_stub.cc ('k') | chrome/renderer/mock_printer_driver_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/gfx/png_encoder.h" 8 #include "base/gfx/png_encoder.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/md5.h" 10 #include "base/md5.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 EXPECT_EQ(document_cookie_, params.document_cookie); 106 EXPECT_EQ(document_cookie_, params.document_cookie);
107 EXPECT_EQ(page_number_, params.page_number); 107 EXPECT_EQ(page_number_, params.page_number);
108 EXPECT_LE(params.page_number, number_pages_); 108 EXPECT_LE(params.page_number, number_pages_);
109 109
110 #if defined(OS_WIN) 110 #if defined(OS_WIN)
111 // Load the EMF data sent from a RenderView object and create a PageData 111 // Load the EMF data sent from a RenderView object and create a PageData
112 // object. 112 // object.
113 // We duplicate the given file handle when creating a base::SharedMemory 113 // We duplicate the given file handle when creating a base::SharedMemory
114 // instance so that its destructor closes the copy. 114 // instance so that its destructor closes the copy.
115 EXPECT_GT(params.data_size, 0U); 115 EXPECT_GT(params.data_size, 0U);
116 base::SharedMemory emf_data(params.emf_data_handle, true, 116 base::SharedMemory emf_data(params.metafile_data_handle, true,
117 GetCurrentProcess()); 117 GetCurrentProcess());
118 emf_data.Map(params.data_size); 118 emf_data.Map(params.data_size);
119 MockPrinterPage* page_data = driver_.LoadSource(emf_data.memory(), 119 MockPrinterPage* page_data = driver_.LoadSource(emf_data.memory(),
120 params.data_size); 120 params.data_size);
121 if (!page_data) { 121 if (!page_data) {
122 printer_status_ = PRINTER_ERROR; 122 printer_status_ = PRINTER_ERROR;
123 return; 123 return;
124 } 124 }
125 125
126 scoped_refptr<MockPrinterPage> page(page_data); 126 scoped_refptr<MockPrinterPage> page(page_data);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 } 210 }
211 211
212 bool MockPrinter::GetChecksum(const void* data, 212 bool MockPrinter::GetChecksum(const void* data,
213 size_t size, 213 size_t size,
214 std::string* checksum) const { 214 std::string* checksum) const {
215 MD5Digest digest; 215 MD5Digest digest;
216 MD5Sum(data, size, &digest); 216 MD5Sum(data, size, &digest);
217 checksum->assign(HexEncode(&digest, sizeof(digest))); 217 checksum->assign(HexEncode(&digest, sizeof(digest)));
218 return true; 218 return true;
219 } 219 }
OLDNEW
« no previous file with comments | « chrome/plugin/webplugin_delegate_stub.cc ('k') | chrome/renderer/mock_printer_driver_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698