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

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

Issue 121123002: Update uses of UTF conversions in ppapi/, printing/, remoting/, rlz/, sandbox/, skia/, sql/, sync/,… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 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 | « printing/backend/print_backend_win.cc ('k') | printing/printing_context_mac.mm » ('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/win_helper.h" 5 #include "printing/backend/win_helper.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/file_version_info.h" 9 #include "base/file_version_info.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 bool InitBasicPrinterInfo(HANDLE printer, PrinterBasicInfo* printer_info) { 282 bool InitBasicPrinterInfo(HANDLE printer, PrinterBasicInfo* printer_info) {
283 DCHECK(printer); 283 DCHECK(printer);
284 DCHECK(printer_info); 284 DCHECK(printer_info);
285 if (!printer) 285 if (!printer)
286 return false; 286 return false;
287 287
288 PrinterInfo2 info_2; 288 PrinterInfo2 info_2;
289 if (!info_2.Init(printer)) 289 if (!info_2.Init(printer))
290 return false; 290 return false;
291 291
292 printer_info->printer_name = WideToUTF8(info_2.get()->pPrinterName); 292 printer_info->printer_name = base::WideToUTF8(info_2.get()->pPrinterName);
293 if (info_2.get()->pComment) 293 if (info_2.get()->pComment) {
294 printer_info->printer_description = WideToUTF8(info_2.get()->pComment); 294 printer_info->printer_description =
295 if (info_2.get()->pLocation) 295 base::WideToUTF8(info_2.get()->pComment);
296 }
297 if (info_2.get()->pLocation) {
296 printer_info->options[kLocationTagName] = 298 printer_info->options[kLocationTagName] =
297 WideToUTF8(info_2.get()->pLocation); 299 base::WideToUTF8(info_2.get()->pLocation);
298 if (info_2.get()->pDriverName) 300 }
301 if (info_2.get()->pDriverName) {
299 printer_info->options[kDriverNameTagName] = 302 printer_info->options[kDriverNameTagName] =
300 WideToUTF8(info_2.get()->pDriverName); 303 base::WideToUTF8(info_2.get()->pDriverName);
304 }
301 printer_info->printer_status = info_2.get()->Status; 305 printer_info->printer_status = info_2.get()->Status;
302 306
303 std::string driver_info = GetDriverInfo(printer); 307 std::string driver_info = GetDriverInfo(printer);
304 if (!driver_info.empty()) 308 if (!driver_info.empty())
305 printer_info->options[kDriverInfoTagName] = driver_info; 309 printer_info->options[kDriverInfoTagName] = driver_info;
306 return true; 310 return true;
307 } 311 }
308 312
309 std::string GetDriverInfo(HANDLE printer) { 313 std::string GetDriverInfo(HANDLE printer) {
310 DCHECK(printer); 314 DCHECK(printer);
311 std::string driver_info; 315 std::string driver_info;
312 316
313 if (!printer) 317 if (!printer)
314 return driver_info; 318 return driver_info;
315 319
316 DriverInfo6 info_6; 320 DriverInfo6 info_6;
317 if (!info_6.Init(printer)) 321 if (!info_6.Init(printer))
318 return driver_info; 322 return driver_info;
319 323
320 std::string info[4]; 324 std::string info[4];
321 if (info_6.get()->pName) 325 if (info_6.get()->pName)
322 info[0] = WideToUTF8(info_6.get()->pName); 326 info[0] = base::WideToUTF8(info_6.get()->pName);
323 327
324 if (info_6.get()->pDriverPath) { 328 if (info_6.get()->pDriverPath) {
325 scoped_ptr<FileVersionInfo> version_info( 329 scoped_ptr<FileVersionInfo> version_info(
326 FileVersionInfo::CreateFileVersionInfo( 330 FileVersionInfo::CreateFileVersionInfo(
327 base::FilePath(info_6.get()->pDriverPath))); 331 base::FilePath(info_6.get()->pDriverPath)));
328 if (version_info.get()) { 332 if (version_info.get()) {
329 info[1] = WideToUTF8(version_info->file_version()); 333 info[1] = base::WideToUTF8(version_info->file_version());
330 info[2] = WideToUTF8(version_info->product_name()); 334 info[2] = base::WideToUTF8(version_info->product_name());
331 info[3] = WideToUTF8(version_info->product_version()); 335 info[3] = base::WideToUTF8(version_info->product_version());
332 } 336 }
333 } 337 }
334 338
335 for (size_t i = 0; i < arraysize(info); ++i) { 339 for (size_t i = 0; i < arraysize(info); ++i) {
336 std::replace(info[i].begin(), info[i].end(), ';', ','); 340 std::replace(info[i].begin(), info[i].end(), ';', ',');
337 driver_info.append(info[i]); 341 driver_info.append(info[i]);
338 if (i < arraysize(info) - 1) 342 if (i < arraysize(info) - 1)
339 driver_info.append(";"); 343 driver_info.append(";");
340 } 344 }
341 return driver_info; 345 return driver_info;
342 } 346 }
343 347
344 } // namespace printing 348 } // namespace printing
OLDNEW
« no previous file with comments | « printing/backend/print_backend_win.cc ('k') | printing/printing_context_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698