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

Side by Side Diff: printing/backend/print_backend_win.cc

Issue 168003002: Use DocumentProperties to get default DEVMODE instead of PRINTER_INFO_*. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 | « no previous file | printing/backend/printing_info_win.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) 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 "printing/backend/print_backend.h" 5 #include "printing/backend/print_backend.h"
6 6
7 #include <objidl.h> 7 #include <objidl.h>
8 #include <winspool.h> 8 #include <winspool.h>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 } 225 }
226 226
227 PrinterInfo5 info_5; 227 PrinterInfo5 info_5;
228 if (!info_5.Init(printer_handle)) 228 if (!info_5.Init(printer_handle))
229 return false; 229 return false;
230 const wchar_t* name = info_5.get()->pPrinterName; 230 const wchar_t* name = info_5.get()->pPrinterName;
231 const wchar_t* port = info_5.get()->pPortName; 231 const wchar_t* port = info_5.get()->pPortName;
232 DCHECK_EQ(name, base::UTF8ToUTF16(printer_name)); 232 DCHECK_EQ(name, base::UTF8ToUTF16(printer_name));
233 233
234 PrinterSemanticCapsAndDefaults caps; 234 PrinterSemanticCapsAndDefaults caps;
235 UserDefaultDevMode user_settings; 235
236 if (user_settings.Init(printer_handle)) { 236 scoped_ptr<DEVMODE[]> user_settings = CreateDevMode(printer_handle, NULL);
237 if (user_settings) {
237 if (user_settings.get()->dmFields & DM_COLOR) 238 if (user_settings.get()->dmFields & DM_COLOR)
238 caps.color_default = (user_settings.get()->dmColor == DMCOLOR_COLOR); 239 caps.color_default = (user_settings.get()->dmColor == DMCOLOR_COLOR);
239 240
240 if (user_settings.get()->dmFields & DM_DUPLEX) { 241 if (user_settings.get()->dmFields & DM_DUPLEX) {
241 switch (user_settings.get()->dmDuplex) { 242 switch (user_settings.get()->dmDuplex) {
242 case DMDUP_SIMPLEX: 243 case DMDUP_SIMPLEX:
243 caps.duplex_default = SIMPLEX; 244 caps.duplex_default = SIMPLEX;
244 break; 245 break;
245 case DMDUP_VERTICAL: 246 case DMDUP_VERTICAL:
246 caps.duplex_default = LONG_EDGE; 247 caps.duplex_default = LONG_EDGE;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 ScopedPrinterHandle printer_handle; 360 ScopedPrinterHandle printer_handle;
360 return printer_handle.OpenPrinter(base::UTF8ToWide(printer_name).c_str()); 361 return printer_handle.OpenPrinter(base::UTF8ToWide(printer_name).c_str());
361 } 362 }
362 363
363 scoped_refptr<PrintBackend> PrintBackend::CreateInstance( 364 scoped_refptr<PrintBackend> PrintBackend::CreateInstance(
364 const base::DictionaryValue* print_backend_settings) { 365 const base::DictionaryValue* print_backend_settings) {
365 return new PrintBackendWin; 366 return new PrintBackendWin;
366 } 367 }
367 368
368 } // namespace printing 369 } // namespace printing
OLDNEW
« no previous file with comments | « no previous file | printing/backend/printing_info_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698