diff options
author | vitalybuka@chromium.org <vitalybuka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-16 04:49:14 +0000 |
---|---|---|
committer | vitalybuka@chromium.org <vitalybuka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-16 04:49:14 +0000 |
commit | 6724e59196711af2848b725b9b44d3dd3e632608 (patch) | |
tree | 8895f22d1cae9d432ee2f55890d1f853ce7b740a /chrome/app/breakpad_win.cc | |
parent | abc77243c735ff8b44deac96a5fc81fd9788b2c9 (diff) | |
download | chromium_src-6724e59196711af2848b725b9b44d3dd3e632608.zip chromium_src-6724e59196711af2848b725b9b44d3dd3e632608.tar.gz chromium_src-6724e59196711af2848b725b9b44d3dd3e632608.tar.bz2 |
Added SetPrinterInfo to include information about printer driver. This information will be added by Chrome (in different CL) just before performing error-prone printer related operations.
BUG=108194
TEST=none
Review URL: http://codereview.chromium.org/9600060
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@127105 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/app/breakpad_win.cc')
-rw-r--r-- | chrome/app/breakpad_win.cc | 76 |
1 files changed, 50 insertions, 26 deletions
diff --git a/chrome/app/breakpad_win.cc b/chrome/app/breakpad_win.cc index 9bd8e1e..6c0cdf7 100644 --- a/chrome/app/breakpad_win.cc +++ b/chrome/app/breakpad_win.cc @@ -74,6 +74,7 @@ static size_t g_num_of_extensions_offset; static size_t g_extension_ids_offset; static size_t g_client_id_offset; static size_t g_gpu_info_offset; +static size_t g_printer_info_offset; static size_t g_num_of_views_offset; static size_t g_num_switches_offset; static size_t g_switches_offset; @@ -257,19 +258,29 @@ google_breakpad::CustomClientInfo* GetCustomInfo(const std::wstring& exe_path, base::StringPrintf(L"extension-%i", i + 1).c_str(), L"")); } - // Add empty values for the gpu_info. We'll put the actual values - // when we collect them at this location. + // Add empty values for the gpu_info. We'll put the actual values when we + // collect them at this location. g_gpu_info_offset = g_custom_entries->size(); - g_custom_entries->push_back( - google_breakpad::CustomInfoEntry(L"gpu-venid", L"")); - g_custom_entries->push_back( - google_breakpad::CustomInfoEntry(L"gpu-devid", L"")); - g_custom_entries->push_back( - google_breakpad::CustomInfoEntry(L"gpu-driver", L"")); - g_custom_entries->push_back( - google_breakpad::CustomInfoEntry(L"gpu-psver", L"")); - g_custom_entries->push_back( - google_breakpad::CustomInfoEntry(L"gpu-vsver", L"")); + static const wchar_t* const kGpuEntries[] = { + L"gpu-venid", + L"gpu-devid", + L"gpu-driver", + L"gpu-psver", + L"gpu-vsver", + }; + for (size_t i = 0; i < arraysize(kGpuEntries); ++i) { + g_custom_entries->push_back( + google_breakpad::CustomInfoEntry(kGpuEntries[i], L"")); + } + + // Add empty values for the prn_info-*. We'll put the actual values when we + // collect them at this location. + g_printer_info_offset = g_custom_entries->size(); + for (size_t i = 0; i < kMaxReportedPrinterRecords; ++i) { + g_custom_entries->push_back( + google_breakpad::CustomInfoEntry( + base::StringPrintf(L"prn-info-%d", i + 1).c_str(), L"")); + } // Read the id from registry. If reporting has never been enabled // the result will be empty string. Its OK since when user enables reporting @@ -487,21 +498,34 @@ extern "C" void __declspec(dllexport) __cdecl SetGpuInfo( if (!g_custom_entries) return; - base::wcslcpy((*g_custom_entries)[g_gpu_info_offset].value, - vendor_id, - google_breakpad::CustomInfoEntry::kValueMaxLength); - base::wcslcpy((*g_custom_entries)[g_gpu_info_offset+1].value, - device_id, - google_breakpad::CustomInfoEntry::kValueMaxLength); - base::wcslcpy((*g_custom_entries)[g_gpu_info_offset+2].value, - driver_version, - google_breakpad::CustomInfoEntry::kValueMaxLength); - base::wcslcpy((*g_custom_entries)[g_gpu_info_offset+3].value, - pixel_shader_version, - google_breakpad::CustomInfoEntry::kValueMaxLength); - base::wcslcpy((*g_custom_entries)[g_gpu_info_offset+4].value, - vertex_shader_version, + const wchar_t* info[] = { + vendor_id, + device_id, + driver_version, + pixel_shader_version, + vertex_shader_version + }; + + for (size_t i = 0; i < arraysize(info); ++i) { + base::wcslcpy((*g_custom_entries)[g_gpu_info_offset + i].value, + info[i], + google_breakpad::CustomInfoEntry::kValueMaxLength); + } +} + +extern "C" void __declspec(dllexport) __cdecl SetPrinterInfo( + const wchar_t* printer_info) { + if (!g_custom_entries) + return; + std::vector<string16> info; + base::SplitString(printer_info, L';', &info); + DCHECK_LE(info.size(), kMaxReportedPrinterRecords); + info.resize(kMaxReportedPrinterRecords); + for (size_t i = 0; i < info.size(); ++i) { + base::wcslcpy((*g_custom_entries)[g_printer_info_offset + i].value, + info[i].c_str(), google_breakpad::CustomInfoEntry::kValueMaxLength); + } } extern "C" void __declspec(dllexport) __cdecl SetNumberOfViews( |