Chromium Code Reviews| Index: chrome/common/child_process_logging_posix.cc |
| diff --git a/chrome/common/child_process_logging_posix.cc b/chrome/common/child_process_logging_posix.cc |
| index 2015256fb7529aecd6dbf917e36d46f683499a32..a562cdbe14d0d537c08ae532e09ca9456051074c 100644 |
| --- a/chrome/common/child_process_logging_posix.cc |
| +++ b/chrome/common/child_process_logging_posix.cc |
| @@ -7,6 +7,7 @@ |
| #include "base/command_line.h" |
| #include "base/format_macros.h" |
| #include "base/string_number_conversions.h" |
| +#include "base/string_split.h" |
| #include "base/string_util.h" |
| #include "base/utf_string_conversions.h" |
| #include "chrome/installer/util/google_update_settings.h" |
| @@ -29,13 +30,14 @@ char g_client_id[kClientIdSize]; |
| char g_channel[kChannelSize] = ""; |
| static const size_t kGpuStringSize = 32; |
| - |
| char g_gpu_vendor_id[kGpuStringSize] = ""; |
| char g_gpu_device_id[kGpuStringSize] = ""; |
| char g_gpu_driver_ver[kGpuStringSize] = ""; |
| char g_gpu_ps_ver[kGpuStringSize] = ""; |
| char g_gpu_vs_ver[kGpuStringSize] = ""; |
| +char g_printer_info[kPrinterInfoStrLen * kMaxReportedPrinterRecords + 1] = ""; |
| + |
| static const size_t kNumSize = 32; |
| char g_num_extensions[kNumSize] = ""; |
| char g_num_switches[kNumSize] = ""; |
| @@ -103,6 +105,22 @@ void SetGpuInfo(const content::GPUInfo& gpu_info) { |
| g_gpu_vs_ver[kGpuStringSize - 1] = '\0'; |
| } |
| +void SetPrinterInfo(const char* printer_info) { |
| + std::string printer_info_str; |
| + std::vector<std::string> info; |
| + base::SplitString(printer_info, L';', &info); |
| + DCHECK_LE(info.size(), kMaxReportedPrinterRecords); |
| + info.resize(kMaxReportedPrinterRecords); |
| + for (size_t i = 0; i < info.size(); ++i) { |
| + printer_info_str += info[i]; |
| + // Truncate long switches, align short ones with spaces to be trimmed later. |
| + printer_info_str.resize((i + 1) * kPrinterInfoStrLen, ' '); |
| + } |
| + strncpy(g_printer_info, printer_info_str.c_str(), |
| + kPrinterInfoStrLen * kMaxReportedPrinterRecords); |
|
Lei Zhang
2012/03/14 21:52:30
Isn't this the same as "arraysize(g_printer_info)
Vitaly Buka (NO REVIEWS)
2012/03/14 22:08:33
Done.
|
| + g_printer_info[arraysize(g_printer_info) - 1] = '\0'; |
| +} |
| + |
| void SetNumberOfViews(int number_of_views) { |
| snprintf(g_num_views, kNumSize - 1, "%d", number_of_views); |
| g_num_views[kNumSize - 1] = '\0'; |