OLD | NEW |
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_path.h" | 9 #include "base/file_path.h" |
10 #include "base/file_version_info.h" | 10 #include "base/file_version_info.h" |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 return driver_info; | 352 return driver_info; |
353 | 353 |
354 std::string info[4]; | 354 std::string info[4]; |
355 if (driver->pName) | 355 if (driver->pName) |
356 info[0] = WideToUTF8(driver->pName); | 356 info[0] = WideToUTF8(driver->pName); |
357 | 357 |
358 if (driver->pDriverPath) { | 358 if (driver->pDriverPath) { |
359 scoped_ptr<FileVersionInfo> version_info( | 359 scoped_ptr<FileVersionInfo> version_info( |
360 FileVersionInfo::CreateFileVersionInfo( | 360 FileVersionInfo::CreateFileVersionInfo( |
361 FilePath(driver->pDriverPath))); | 361 FilePath(driver->pDriverPath))); |
362 info[1] = WideToUTF8(version_info->file_version()); | 362 if (version_info.get()) { |
363 info[2] = WideToUTF8(version_info->product_name()); | 363 info[1] = WideToUTF8(version_info->file_version()); |
364 info[3] = WideToUTF8(version_info->product_version()); | 364 info[2] = WideToUTF8(version_info->product_name()); |
| 365 info[3] = WideToUTF8(version_info->product_version()); |
| 366 } |
365 } | 367 } |
366 | 368 |
367 for (size_t i = 0; i < arraysize(info); ++i) { | 369 for (size_t i = 0; i < arraysize(info); ++i) { |
368 std::replace(info[i].begin(), info[i].end(), ';', ','); | 370 std::replace(info[i].begin(), info[i].end(), ';', ','); |
369 driver_info.append(info[i]); | 371 driver_info.append(info[i]); |
370 if (i < arraysize(info) - 1) | 372 if (i < arraysize(info) - 1) |
371 driver_info.append(";"); | 373 driver_info.append(";"); |
372 } | 374 } |
373 return driver_info; | 375 return driver_info; |
374 } | 376 } |
375 | 377 |
376 } // namespace printing | 378 } // namespace printing |
OLD | NEW |