summaryrefslogtreecommitdiffstats
path: root/printing
diff options
context:
space:
mode:
authorvitalybuka@chromium.org <vitalybuka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-07 05:02:27 +0000
committervitalybuka@chromium.org <vitalybuka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-07 05:02:27 +0000
commitc817c402a7e8f2eda998b076bcf5925e68a99f51 (patch)
tree25ee72fe8857e34314d04324f1a377553b5df14c /printing
parent0b45d07ef6d841a9c4637fddaaeb9ef3fae2f4ee (diff)
downloadchromium_src-c817c402a7e8f2eda998b076bcf5925e68a99f51.zip
chromium_src-c817c402a7e8f2eda998b076bcf5925e68a99f51.tar.gz
chromium_src-c817c402a7e8f2eda998b076bcf5925e68a99f51.tar.bz2
GetPrinterDriverInfo returns string.
BUG=108194 TEST=none Review URL: http://codereview.chromium.org/9618032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@125326 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing')
-rw-r--r--printing/backend/print_backend.cc4
-rw-r--r--printing/backend/print_backend.h12
-rw-r--r--printing/backend/print_backend_chromeos.cc7
-rw-r--r--printing/backend/print_backend_cups.cc4
-rw-r--r--printing/backend/print_backend_win.cc21
5 files changed, 21 insertions, 27 deletions
diff --git a/printing/backend/print_backend.cc b/printing/backend/print_backend.cc
index 398e698..f3de089 100644
--- a/printing/backend/print_backend.cc
+++ b/printing/backend/print_backend.cc
@@ -16,10 +16,6 @@ PrinterCapsAndDefaults::PrinterCapsAndDefaults() {}
PrinterCapsAndDefaults::~PrinterCapsAndDefaults() {}
-PrinterDriverInfo::PrinterDriverInfo() {}
-
-PrinterDriverInfo::~PrinterDriverInfo() {}
-
PrintBackend::~PrintBackend() {}
} // namespace printing
diff --git a/printing/backend/print_backend.h b/printing/backend/print_backend.h
index 878bb25..59b16aa 100644
--- a/printing/backend/print_backend.h
+++ b/printing/backend/print_backend.h
@@ -43,16 +43,6 @@ struct PRINTING_EXPORT PrinterCapsAndDefaults {
std::string defaults_mime_type;
};
-struct PRINTING_EXPORT PrinterDriverInfo {
- PrinterDriverInfo();
- ~PrinterDriverInfo();
-
- std::string driver_name;
- std::string driver_version;
- std::string product_name;
- std::string product_version;
-};
-
// PrintBackend class will provide interface for different print backends
// (Windows, CUPS) to implement. User will call CreateInstance() to
// obtain available print backend.
@@ -79,7 +69,7 @@ class PRINTING_EXPORT PrintBackend
// Gets the information about driver for a specific printer.
virtual bool GetPrinterDriverInfo(
const std::string& printer_name,
- PrinterDriverInfo* driver_info) = 0;
+ std::string* driver_info) = 0;
// Returns true if printer_name points to a valid printer.
virtual bool IsValidPrinter(const std::string& printer_name) = 0;
diff --git a/printing/backend/print_backend_chromeos.cc b/printing/backend/print_backend_chromeos.cc
index ac62d90..b06683e 100644
--- a/printing/backend/print_backend_chromeos.cc
+++ b/printing/backend/print_backend_chromeos.cc
@@ -23,7 +23,7 @@ class PrintBackendChromeOS : public PrintBackend {
PrinterCapsAndDefaults* printer_info);
virtual bool GetPrinterDriverInfo(const std::string& printer_name,
- PrinterDriverInfo* driver_info);
+ std::string* driver_info);
virtual bool IsValidPrinter(const std::string& printer_name);
@@ -45,9 +45,8 @@ bool PrintBackendChromeOS::GetPrinterCapsAndDefaults(
return false;
}
-bool PrintBackendChromeOS::GetPrinterDriverInfo(
- const std::string& printer_name,
- PrinterDriverInfo* driver_info) {
+bool PrintBackendChromeOS::GetPrinterDriverInfo(const std::string& printer_name,
+ std::string* driver_info) {
NOTREACHED();
return false;
}
diff --git a/printing/backend/print_backend_cups.cc b/printing/backend/print_backend_cups.cc
index 736926d..9a17ddf 100644
--- a/printing/backend/print_backend_cups.cc
+++ b/printing/backend/print_backend_cups.cc
@@ -114,7 +114,7 @@ class PrintBackendCUPS : public PrintBackend {
PrinterCapsAndDefaults* printer_info) OVERRIDE;
virtual bool GetPrinterDriverInfo(const std::string& printer_name,
- PrinterDriverInfo* driver_info) OVERRIDE;
+ std::string* driver_info) OVERRIDE;
virtual bool IsValidPrinter(const std::string& printer_name) OVERRIDE;
@@ -229,7 +229,7 @@ bool PrintBackendCUPS::GetPrinterCapsAndDefaults(
}
bool PrintBackendCUPS::GetPrinterDriverInfo(const std::string& printer_name,
- PrinterDriverInfo* driver_info) {
+ std::string* driver_info) {
// TODO(vitalybuka): MAC implementation. http://crbug.com/108194
return false;
}
diff --git a/printing/backend/print_backend_win.cc b/printing/backend/print_backend_win.cc
index 8377551..9e3c98e 100644
--- a/printing/backend/print_backend_win.cc
+++ b/printing/backend/print_backend_win.cc
@@ -4,6 +4,7 @@
#include "printing/backend/print_backend.h"
+#include <algorithm>
#include <objidl.h>
#include <winspool.h>
@@ -50,7 +51,7 @@ class PrintBackendWin : public PrintBackend {
PrinterCapsAndDefaults* printer_info);
virtual bool GetPrinterDriverInfo(const std::string& printer_name,
- PrinterDriverInfo* driver_info);
+ std::string* driver_info);
virtual bool IsValidPrinter(const std::string& printer_name);
};
@@ -178,7 +179,7 @@ bool PrintBackendWin::GetPrinterCapsAndDefaults(
// Gets the information about driver for a specific printer.
bool PrintBackendWin::GetPrinterDriverInfo(const std::string& printer_name,
- PrinterDriverInfo* driver_info) {
+ std::string* driver_info) {
DCHECK(driver_info);
ScopedPrinterHandle printer_handle;
if (!::OpenPrinter(const_cast<LPTSTR>(UTF8ToWide(printer_name).c_str()),
@@ -200,16 +201,24 @@ bool PrintBackendWin::GetPrinterDriverInfo(const std::string& printer_name,
const DRIVER_INFO_6* driver_info_6 =
reinterpret_cast<DRIVER_INFO_6*>(driver_info_buffer.get());
+ std::string info[4];
+
if (driver_info_6->pName)
- driver_info->driver_name = WideToUTF8(driver_info_6->pName);
+ info[0] = WideToUTF8(driver_info_6->pName);
if (driver_info_6->pDriverPath) {
scoped_ptr<FileVersionInfo> version_info(
FileVersionInfo::CreateFileVersionInfo(
FilePath(driver_info_6->pDriverPath)));
- driver_info->driver_version = WideToUTF8(version_info->file_version());
- driver_info->product_name = WideToUTF8(version_info->product_name());
- driver_info->product_version = WideToUTF8(version_info->product_version());
+ info[1] = WideToUTF8(version_info->file_version());
+ info[2] = WideToUTF8(version_info->product_name());
+ info[3] = WideToUTF8(version_info->product_version());
+ }
+
+ for (size_t i = 0; i < arraysize(info); ++i) {
+ std::replace(info[i].begin(), info[i].end(), ';', ',');
+ driver_info->append(info[i]);
+ driver_info->append(";");
}
return true;