| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/chrome_watcher/chrome_postmortem_report_collector.h" |
| 6 |
| 7 #include <windows.h> |
| 8 |
| 9 #include "base/strings/string16.h" |
| 10 #include "base/strings/utf_string_conversions.h" |
| 11 #include "chrome/install_static/install_util.h" |
| 12 |
| 13 namespace chrome_watcher { |
| 14 |
| 15 ChromePostmortemReportCollector::ChromePostmortemReportCollector() |
| 16 : PostmortemReportCollector(), version_details_initialized_(false) {} |
| 17 |
| 18 const std::string& ChromePostmortemReportCollector::GetProductName() { |
| 19 if (!version_details_initialized_) |
| 20 InitializeVersionDetails(); |
| 21 return product_name_; |
| 22 } |
| 23 |
| 24 const std::string& ChromePostmortemReportCollector::GetProductVersion() { |
| 25 if (!version_details_initialized_) |
| 26 InitializeVersionDetails(); |
| 27 return version_number_; |
| 28 } |
| 29 |
| 30 const std::string& ChromePostmortemReportCollector::GetProductChannel() { |
| 31 if (!version_details_initialized_) |
| 32 InitializeVersionDetails(); |
| 33 return channel_name_; |
| 34 } |
| 35 |
| 36 void ChromePostmortemReportCollector::InitializeVersionDetails() { |
| 37 DCHECK(!version_details_initialized_); |
| 38 |
| 39 wchar_t exe_file[MAX_PATH] = {}; |
| 40 CHECK(::GetModuleFileName(nullptr, exe_file, arraysize(exe_file))); |
| 41 |
| 42 base::string16 product_name, version_number, special_build, channel_name; |
| 43 install_static::GetExecutableVersionDetails( |
| 44 exe_file, &product_name, &version_number, &special_build, &channel_name); |
| 45 |
| 46 product_name_ = base::UTF16ToUTF8(product_name); |
| 47 version_number_ = base::UTF16ToUTF8(version_number); |
| 48 channel_name_ = base::UTF16ToUTF8(channel_name); |
| 49 } |
| 50 |
| 51 } // namespace chrome_watcher |
| OLD | NEW |