| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/bug_report_util.h" | 5 #include "chrome/browser/bug_report_util.h" |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/file_version_info.h" | 11 #include "base/file_version_info.h" |
| 12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
| 13 #include "base/memory/singleton.h" | 13 #include "base/memory/singleton.h" |
| 14 #include "base/string_util.h" | 14 #include "base/string_util.h" |
| 15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 16 #include "base/win/windows_version.h" |
| 16 #include "chrome/browser/browser_list.h" | 17 #include "chrome/browser/browser_list.h" |
| 17 #include "chrome/browser/browser_process_impl.h" | 18 #include "chrome/browser/browser_process_impl.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chrome/browser/safe_browsing/safe_browsing_util.h" | 20 #include "chrome/browser/safe_browsing/safe_browsing_util.h" |
| 20 #include "chrome/common/chrome_version_info.h" | 21 #include "chrome/common/chrome_version_info.h" |
| 21 #include "chrome/common/chrome_switches.h" | 22 #include "chrome/common/chrome_switches.h" |
| 22 #include "chrome/common/net/url_fetcher.h" | 23 #include "chrome/common/net/url_fetcher.h" |
| 23 #include "content/browser/tab_contents/tab_contents.h" | 24 #include "content/browser/tab_contents/tab_contents.h" |
| 24 #include "googleurl/src/gurl.h" | 25 #include "googleurl/src/gurl.h" |
| 25 #include "grit/generated_resources.h" | 26 #include "grit/generated_resources.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 LOG(WARNING) << "FEEDBACK: Submission to feedback server (" << url << | 150 LOG(WARNING) << "FEEDBACK: Submission to feedback server (" << url << |
| 150 ") status: " << error_stream.str() << std::endl; | 151 ") status: " << error_stream.str() << std::endl; |
| 151 | 152 |
| 152 // Delete the URLFetcher. | 153 // Delete the URLFetcher. |
| 153 delete source; | 154 delete source; |
| 154 // And then delete ourselves. | 155 // And then delete ourselves. |
| 155 delete this; | 156 delete this; |
| 156 } | 157 } |
| 157 | 158 |
| 158 // static | 159 // static |
| 159 void BugReportUtil::SetOSVersion(std::string *os_version) { | 160 void BugReportUtil::SetOSVersion(std::string* os_version) { |
| 160 #if defined(OS_WIN) | 161 #if defined(OS_WIN) |
| 161 OSVERSIONINFO osvi; | 162 OSInfo* os_info = base::win::OSInfo::GetInstance(); |
| 162 ZeroMemory(&osvi, sizeof(OSVERSIONINFO)); | 163 const int* version = os_info->version_number(); |
| 163 osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); | 164 *os_version = StringPrintf("%d.%d.%d", version[0], version[1], version[2]); |
| 164 | 165 int service_pack = os_info->service_pack()[0]; |
| 165 if (GetVersionEx(&osvi)) { | 166 if (service_pack > 0) |
| 166 *os_version = StringPrintf("%d.%d.%d %S", | 167 os_version->append(StringPrintf("Service Pack %d", service_pack)); |
| 167 osvi.dwMajorVersion, | |
| 168 osvi.dwMinorVersion, | |
| 169 osvi.dwBuildNumber, | |
| 170 osvi.szCSDVersion); | |
| 171 } else { | |
| 172 *os_version = "unknown"; | |
| 173 } | |
| 174 #elif defined(OS_MACOSX) | 168 #elif defined(OS_MACOSX) |
| 175 int32 major; | 169 int32 major; |
| 176 int32 minor; | 170 int32 minor; |
| 177 int32 bugFix; | 171 int32 bugFix; |
| 178 base::SysInfo::OperatingSystemVersionNumbers(&major, &minor, &bugFix); | 172 base::SysInfo::OperatingSystemVersionNumbers(&major, &minor, &bugFix); |
| 179 *os_version = StringPrintf("%d.%d.%d", major, minor, bugFix); | 173 *os_version = StringPrintf("%d.%d.%d", major, minor, bugFix); |
| 180 #else | 174 #else |
| 181 *os_version = "unknown"; | 175 *os_version = "unknown"; |
| 182 #endif | 176 #endif |
| 183 } | 177 } |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 | 378 |
| 385 // static | 379 // static |
| 386 void BugReportUtil::ReportPhishing(TabContents* currentTab, | 380 void BugReportUtil::ReportPhishing(TabContents* currentTab, |
| 387 const std::string& phishing_url) { | 381 const std::string& phishing_url) { |
| 388 currentTab->controller().LoadURL( | 382 currentTab->controller().LoadURL( |
| 389 safe_browsing_util::GeneratePhishingReportUrl( | 383 safe_browsing_util::GeneratePhishingReportUrl( |
| 390 kReportPhishingUrl, phishing_url), | 384 kReportPhishingUrl, phishing_url), |
| 391 GURL(), | 385 GURL(), |
| 392 PageTransition::LINK); | 386 PageTransition::LINK); |
| 393 } | 387 } |
| OLD | NEW |