OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/feedback/feedback_data.h" | 5 #include "chrome/browser/feedback/feedback_data.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/json/json_string_value_serializer.h" | 8 #include "base/json/json_string_value_serializer.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 std::string LogsToString(const FeedbackData::SystemLogsMap& sys_info) { | 49 std::string LogsToString(const FeedbackData::SystemLogsMap& sys_info) { |
50 std::string syslogs_string; | 50 std::string syslogs_string; |
51 for (FeedbackData::SystemLogsMap::const_iterator it = sys_info.begin(); | 51 for (FeedbackData::SystemLogsMap::const_iterator it = sys_info.begin(); |
52 it != sys_info.end(); ++it) { | 52 it != sys_info.end(); ++it) { |
53 std::string key = it->first; | 53 std::string key = it->first; |
54 std::string value = it->second; | 54 std::string value = it->second; |
55 | 55 |
56 if (FeedbackData::BelowCompressionThreshold(value)) | 56 if (FeedbackData::BelowCompressionThreshold(value)) |
57 continue; | 57 continue; |
58 | 58 |
59 TrimString(key, "\n ", &key); | 59 base::TrimString(key, "\n ", &key); |
60 TrimString(value, "\n ", &value); | 60 base::TrimString(value, "\n ", &value); |
61 | 61 |
62 if (value.find("\n") != std::string::npos) { | 62 if (value.find("\n") != std::string::npos) { |
63 syslogs_string.append( | 63 syslogs_string.append( |
64 key + "=" + kMultilineIndicatorString + | 64 key + "=" + kMultilineIndicatorString + |
65 kMultilineStartString + | 65 kMultilineStartString + |
66 value + "\n" + | 66 value + "\n" + |
67 kMultilineEndString); | 67 kMultilineEndString); |
68 } else { | 68 } else { |
69 syslogs_string.append(key + "=" + value + "\n"); | 69 syslogs_string.append(key + "=" + value + "\n"); |
70 } | 70 } |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 feedback_page_data_complete_; | 269 feedback_page_data_complete_; |
270 } | 270 } |
271 | 271 |
272 void FeedbackData::SendReport() { | 272 void FeedbackData::SendReport() { |
273 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 273 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
274 if (IsDataComplete() && !report_sent_) { | 274 if (IsDataComplete() && !report_sent_) { |
275 report_sent_ = true; | 275 report_sent_ = true; |
276 feedback_util::SendReport(this); | 276 feedback_util::SendReport(this); |
277 } | 277 } |
278 } | 278 } |
OLD | NEW |