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

Side by Side Diff: chrome/service/cloud_print/print_system_win.cc

Issue 9812002: Include driver infor into PrinterBasicInfo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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
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 "chrome/service/cloud_print/print_system.h" 5 #include "chrome/service/cloud_print/print_system.h"
6 6
7 #include <objidl.h> 7 #include <objidl.h>
8 #include <winspool.h> 8 #include <winspool.h>
9 #include <xpsprint.h> 9 #include <xpsprint.h>
10 10
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 } 221 }
222 } 222 }
223 watcher_.StartWatching(printer_change_, this); 223 watcher_.StartWatching(printer_change_, this);
224 } 224 }
225 225
226 bool GetCurrentPrinterInfo(printing::PrinterBasicInfo* printer_info) { 226 bool GetCurrentPrinterInfo(printing::PrinterBasicInfo* printer_info) {
227 DCHECK(printer_info); 227 DCHECK(printer_info);
228 if (!printer_.IsValid()) 228 if (!printer_.IsValid())
229 return false; 229 return false;
230 230
231 DWORD bytes_needed = 0; 231 scoped_array<BYTE> printer_info_buffer;
232 bool ret = false; 232 const PRINTER_INFO_2* printer_info_2 =
233 GetPrinter(printer_, 2, NULL, 0, &bytes_needed); 233 GetPrinterInfo2(printer_, &printer_info_buffer);
234 if (0 != bytes_needed) { 234 if (!printer_info_2)
235 scoped_array<BYTE> printer_info_buffer(new BYTE[bytes_needed]); 235 return false;
236 if (GetPrinter(printer_, 2, printer_info_buffer.get(), 236
237 bytes_needed, &bytes_needed)) { 237 scoped_array<BYTE> driver_info_buffer;
238 PRINTER_INFO_2* printer_info_win = 238 InitBasicPrinterInfo(printer_info_2,
239 reinterpret_cast<PRINTER_INFO_2*>(printer_info_buffer.get()); 239 GetDriverInfo6(printer_, &driver_info_buffer),
240 printer_info->printer_name = WideToUTF8(printer_info_win->pPrinterName); 240 printer_info);
241 if (printer_info_win->pComment) 241 return true;
242 printer_info->printer_description =
243 WideToUTF8(printer_info_win->pComment);
244 if (printer_info_win->pLocation)
245 printer_info->options[kLocationTagName] =
246 WideToUTF8(printer_info_win->pLocation);
247 if (printer_info_win->pDriverName)
248 printer_info->options[kDriverNameTagName] =
249 WideToUTF8(printer_info_win->pDriverName);
250 printer_info->printer_status = printer_info_win->Status;
251 ret = true;
252 }
253 }
254 return ret;
255 } 242 }
256 243
257 private: 244 private:
258 base::win::ObjectWatcher watcher_; 245 base::win::ObjectWatcher watcher_;
259 printing::ScopedPrinterHandle printer_; // The printer being watched 246 printing::ScopedPrinterHandle printer_; // The printer being watched
260 // Returned by FindFirstPrinterChangeNotifier. 247 // Returned by FindFirstPrinterChangeNotifier.
261 ScopedPrinterChangeHandle printer_change_; 248 ScopedPrinterChangeHandle printer_change_;
262 Delegate* delegate_; // Delegate to notify 249 Delegate* delegate_; // Delegate to notify
263 bool did_signal_; // DoneWaiting was called 250 bool did_signal_; // DoneWaiting was called
264 std::string printer_info_; // For crash reporting. 251 std::string printer_info_; // For crash reporting.
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 RpcStringFree(reinterpret_cast<RPC_WSTR *>(&proxy_id_as_string)); 902 RpcStringFree(reinterpret_cast<RPC_WSTR *>(&proxy_id_as_string));
916 return ret; 903 return ret;
917 } 904 }
918 905
919 scoped_refptr<PrintSystem> PrintSystem::CreateInstance( 906 scoped_refptr<PrintSystem> PrintSystem::CreateInstance(
920 const base::DictionaryValue* print_system_settings) { 907 const base::DictionaryValue* print_system_settings) {
921 return new PrintSystemWin; 908 return new PrintSystemWin;
922 } 909 }
923 910
924 } // namespace cloud_print 911 } // namespace cloud_print
OLDNEW
« no previous file with comments | « no previous file | printing/backend/print_backend_consts.h » ('j') | printing/backend/print_backend_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698