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

Side by Side Diff: chrome/browser/feedback/feedback_data.cc

Issue 24998007: Modify ZipString to allow the filename to be passed as an argument (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 2 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 | « no previous file | chrome/browser/feedback/feedback_util.h » ('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) 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/values.h" 10 #include "base/values.h"
(...skipping 13 matching lines...) Expand all
24 24
25 namespace { 25 namespace {
26 26
27 const char kMultilineIndicatorString[] = "<multiline>\n"; 27 const char kMultilineIndicatorString[] = "<multiline>\n";
28 const char kMultilineStartString[] = "---------- START ----------\n"; 28 const char kMultilineStartString[] = "---------- START ----------\n";
29 const char kMultilineEndString[] = "---------- END ----------\n\n"; 29 const char kMultilineEndString[] = "---------- END ----------\n\n";
30 30
31 const size_t kFeedbackMaxLength = 4 * 1024; 31 const size_t kFeedbackMaxLength = 4 * 1024;
32 const size_t kFeedbackMaxLineCount = 40; 32 const size_t kFeedbackMaxLineCount = 40;
33 33
34 const char kTraceFilename[] = "tracing.log\n"; 34 const char kTraceFilename[] = "tracing.zip\n";
35 const char kPerformanceCategoryTag[] = "Performance"; 35 const char kPerformanceCategoryTag[] = "Performance";
36 36
37 const base::FilePath::CharType kLogsFilename[] =
38 FILE_PATH_LITERAL("system_logs.txt");
39
37 // Converts the system logs into a string that we can compress and send 40 // Converts the system logs into a string that we can compress and send
38 // with the report. This method only converts those logs that we want in 41 // with the report. This method only converts those logs that we want in
39 // the compressed zip file sent with the report, hence it ignores any logs 42 // the compressed zip file sent with the report, hence it ignores any logs
40 // below the size threshold of what we want compressed. 43 // below the size threshold of what we want compressed.
41 std::string LogsToString(FeedbackData::SystemLogsMap* sys_info) { 44 std::string LogsToString(FeedbackData::SystemLogsMap* sys_info) {
42 std::string syslogs_string; 45 std::string syslogs_string;
43 for (FeedbackData::SystemLogsMap::const_iterator it = sys_info->begin(); 46 for (FeedbackData::SystemLogsMap::const_iterator it = sys_info->begin();
44 it != sys_info->end(); ++it) { 47 it != sys_info->end(); ++it) {
45 std::string key = it->first; 48 std::string key = it->first;
46 std::string value = it->second; 49 std::string value = it->second;
(...skipping 15 matching lines...) Expand all
62 } 65 }
63 } 66 }
64 return syslogs_string; 67 return syslogs_string;
65 } 68 }
66 69
67 void ZipLogs(FeedbackData::SystemLogsMap* sys_info, 70 void ZipLogs(FeedbackData::SystemLogsMap* sys_info,
68 std::string* compressed_logs) { 71 std::string* compressed_logs) {
69 DCHECK(compressed_logs); 72 DCHECK(compressed_logs);
70 std::string logs_string = LogsToString(sys_info); 73 std::string logs_string = LogsToString(sys_info);
71 if (logs_string.empty() || 74 if (logs_string.empty() ||
72 !feedback_util::ZipString(logs_string, compressed_logs)) { 75 !feedback_util::ZipString(kLogsFilename, logs_string, compressed_logs)) {
73 compressed_logs->clear(); 76 compressed_logs->clear();
74 } 77 }
75 } 78 }
76 79
77 } // namespace 80 } // namespace
78 81
79 // static 82 // static
80 bool FeedbackData::BelowCompressionThreshold(const std::string& content) { 83 bool FeedbackData::BelowCompressionThreshold(const std::string& content) {
81 if (content.length() > kFeedbackMaxLength) 84 if (content.length() > kFeedbackMaxLength)
82 return false; 85 return false;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 feedback_page_data_complete_; 164 feedback_page_data_complete_;
162 } 165 }
163 166
164 void FeedbackData::SendReport() { 167 void FeedbackData::SendReport() {
165 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 168 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
166 if (IsDataComplete() && !report_sent_) { 169 if (IsDataComplete() && !report_sent_) {
167 report_sent_ = true; 170 report_sent_ = true;
168 feedback_util::SendReport(this); 171 feedback_util::SendReport(this);
169 } 172 }
170 } 173 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/feedback/feedback_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698