Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: chrome/browser/bug_report_util.cc

Issue 6816024: Revert 80819 due to failed tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/win/windows_version.cc ('k') | chrome/browser/diagnostics/recon_diagnostics.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_util.h" 11 #include "base/file_util.h"
12 #include "base/file_version_info.h" 12 #include "base/file_version_info.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"
17 #include "chrome/browser/browser_process_impl.h" 16 #include "chrome/browser/browser_process_impl.h"
18 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/browser/safe_browsing/safe_browsing_util.h" 18 #include "chrome/browser/safe_browsing/safe_browsing_util.h"
20 #include "chrome/browser/ui/browser_list.h" 19 #include "chrome/browser/ui/browser_list.h"
21 #include "chrome/common/chrome_switches.h" 20 #include "chrome/common/chrome_switches.h"
22 #include "chrome/common/chrome_version_info.h" 21 #include "chrome/common/chrome_version_info.h"
23 #include "chrome/common/net/url_fetcher.h" 22 #include "chrome/common/net/url_fetcher.h"
24 #include "content/browser/tab_contents/tab_contents.h" 23 #include "content/browser/tab_contents/tab_contents.h"
25 #include "googleurl/src/gurl.h" 24 #include "googleurl/src/gurl.h"
26 #include "grit/generated_resources.h" 25 #include "grit/generated_resources.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 if (previous_delay_) { 128 if (previous_delay_) {
130 if (previous_delay_ < kRetryDelayLimit) 129 if (previous_delay_ < kRetryDelayLimit)
131 previous_delay_ *= kRetryDelayIncreaseFactor; 130 previous_delay_ *= kRetryDelayIncreaseFactor;
132 } else { 131 } else {
133 previous_delay_ = kInitialRetryDelay; 132 previous_delay_ = kInitialRetryDelay;
134 } 133 }
135 BugReportUtil::DispatchFeedback(profile_, post_body_, previous_delay_); 134 BugReportUtil::DispatchFeedback(profile_, post_body_, previous_delay_);
136 135
137 // Process the error for debug output 136 // Process the error for debug output
138 if (response_code == kHttpPostFailNoConnection) { 137 if (response_code == kHttpPostFailNoConnection) {
139 error_stream << "No connection to server."; 138 error_stream << "No connection to server.";
140 } else if ((response_code > kHttpPostFailClientError) && 139 } else if ((response_code > kHttpPostFailClientError) &&
141 (response_code < kHttpPostFailServerError)) { 140 (response_code < kHttpPostFailServerError)) {
142 error_stream << "Client error: HTTP response code " << response_code; 141 error_stream << "Client error: HTTP response code " << response_code;
143 } else if (response_code > kHttpPostFailServerError) { 142 } else if (response_code > kHttpPostFailServerError) {
144 error_stream << "Server error: HTTP response code " << response_code; 143 error_stream << "Server error: HTTP response code " << response_code;
145 } else { 144 } else {
146 error_stream << "Unknown error: HTTP response code " << response_code; 145 error_stream << "Unknown error: HTTP response code " << response_code;
147 } 146 }
148 } 147 }
149 148
150 LOG(WARNING) << "FEEDBACK: Submission to feedback server (" << url 149 LOG(WARNING) << "FEEDBACK: Submission to feedback server (" << url <<
151 << ") status: " << error_stream.str(); 150 ") status: " << error_stream.str() << std::endl;
152 151
153 // Delete the URLFetcher. 152 // Delete the URLFetcher.
154 delete source; 153 delete source;
155 // And then delete ourselves. 154 // And then delete ourselves.
156 delete this; 155 delete this;
157 } 156 }
158 157
159 // static 158 // static
160 void BugReportUtil::SetOSVersion(std::string* os_version) { 159 void BugReportUtil::SetOSVersion(std::string *os_version) {
161 #if defined(OS_WIN) 160 #if defined(OS_WIN)
162 base::win::OSInfo* os_info = base::win::OSInfo::GetInstance(); 161 OSVERSIONINFO osvi;
163 base::win::OSInfo::VersionNumber version_number = os_info->version_number(); 162 ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
164 *os_version = StringPrintf("%d.%d.%d", version_number.major, 163 osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
165 version_number.minor, version_number.build); 164
166 int service_pack = os_info->service_pack().major; 165 if (GetVersionEx(&osvi)) {
167 if (service_pack > 0) 166 *os_version = StringPrintf("%d.%d.%d %S",
168 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 }
169 #elif defined(OS_MACOSX) 174 #elif defined(OS_MACOSX)
170 int32 major; 175 int32 major;
171 int32 minor; 176 int32 minor;
172 int32 bugFix; 177 int32 bugFix;
173 base::SysInfo::OperatingSystemVersionNumbers(&major, &minor, &bugFix); 178 base::SysInfo::OperatingSystemVersionNumbers(&major, &minor, &bugFix);
174 *os_version = StringPrintf("%d.%d.%d", major, minor, bugFix); 179 *os_version = StringPrintf("%d.%d.%d", major, minor, bugFix);
175 #else 180 #else
176 *os_version = "unknown"; 181 *os_version = "unknown";
177 #endif 182 #endif
178 } 183 }
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 384
380 // static 385 // static
381 void BugReportUtil::ReportPhishing(TabContents* currentTab, 386 void BugReportUtil::ReportPhishing(TabContents* currentTab,
382 const std::string& phishing_url) { 387 const std::string& phishing_url) {
383 currentTab->controller().LoadURL( 388 currentTab->controller().LoadURL(
384 safe_browsing_util::GeneratePhishingReportUrl( 389 safe_browsing_util::GeneratePhishingReportUrl(
385 kReportPhishingUrl, phishing_url), 390 kReportPhishingUrl, phishing_url),
386 GURL(), 391 GURL(),
387 PageTransition::LINK); 392 PageTransition::LINK);
388 } 393 }
OLDNEW
« no previous file with comments | « base/win/windows_version.cc ('k') | chrome/browser/diagnostics/recon_diagnostics.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698