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

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

Issue 24436002: Remove screen dimensions from image sent with Feedback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 | « chrome/browser/feedback/feedback_data.h ('k') | chrome/browser/feedback/feedback_util.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) 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 26 matching lines...) Expand all
37 // with the report. This method only converts those logs that we want in 37 // with the report. This method only converts those logs that we want in
38 // the compressed zip file sent with the report, hence it ignores any logs 38 // the compressed zip file sent with the report, hence it ignores any logs
39 // below the size threshold of what we want compressed. 39 // below the size threshold of what we want compressed.
40 std::string LogsToString(FeedbackData::SystemLogsMap* sys_info) { 40 std::string LogsToString(FeedbackData::SystemLogsMap* sys_info) {
41 std::string syslogs_string; 41 std::string syslogs_string;
42 for (FeedbackData::SystemLogsMap::const_iterator it = sys_info->begin(); 42 for (FeedbackData::SystemLogsMap::const_iterator it = sys_info->begin();
43 it != sys_info->end(); ++it) { 43 it != sys_info->end(); ++it) {
44 std::string key = it->first; 44 std::string key = it->first;
45 std::string value = it->second; 45 std::string value = it->second;
46 46
47 // Screensize info is sent with every report to remember the window size 47 if (FeedbackData::BelowCompressionThreshold(value))
48 // for when feedback was invoked. This is a hack needed to know what
49 // dimensions the user screenshot is since the actual screenshot mechanism
50 // in JS doesn't give us the dimensions of the screenshot taken. These
51 // values shouldn't be sent with the report.
52 if (key == FeedbackData::kScreensizeHeightKey ||
53 key == FeedbackData::kScreensizeWidthKey ||
54 FeedbackData::BelowCompressionThreshold(value))
55 continue; 48 continue;
56 49
57 TrimString(key, "\n ", &key); 50 TrimString(key, "\n ", &key);
58 TrimString(value, "\n ", &value); 51 TrimString(value, "\n ", &value);
59 52
60 if (value.find("\n") != std::string::npos) { 53 if (value.find("\n") != std::string::npos) {
61 syslogs_string.append( 54 syslogs_string.append(
62 key + "=" + kMultilineIndicatorString + 55 key + "=" + kMultilineIndicatorString +
63 kMultilineStartString + 56 kMultilineStartString +
64 value + "\n" + 57 value + "\n" +
(...skipping 11 matching lines...) Expand all
76 std::string logs_string = LogsToString(sys_info); 69 std::string logs_string = LogsToString(sys_info);
77 if (logs_string.empty() || 70 if (logs_string.empty() ||
78 !feedback_util::ZipString(logs_string, compressed_logs)) { 71 !feedback_util::ZipString(logs_string, compressed_logs)) {
79 compressed_logs->clear(); 72 compressed_logs->clear();
80 } 73 }
81 } 74 }
82 75
83 } // namespace 76 } // namespace
84 77
85 // static 78 // static
86 const char FeedbackData::kScreensizeHeightKey[] = "ScreensizeHeight";
87 // static
88 const char FeedbackData::kScreensizeWidthKey[] = "ScreensizeWidth";
89
90 // static
91 bool FeedbackData::BelowCompressionThreshold(const std::string& content) { 79 bool FeedbackData::BelowCompressionThreshold(const std::string& content) {
92 if (content.length() > kFeedbackMaxLength) 80 if (content.length() > kFeedbackMaxLength)
93 return false; 81 return false;
94 const size_t line_count = std::count(content.begin(), content.end(), '\n'); 82 const size_t line_count = std::count(content.begin(), content.end(), '\n');
95 if (line_count > kFeedbackMaxLineCount) 83 if (line_count > kFeedbackMaxLineCount)
96 return false; 84 return false;
97 return true; 85 return true;
98 } 86 }
99 87
100 FeedbackData::FeedbackData() : profile_(NULL), 88 FeedbackData::FeedbackData() : profile_(NULL),
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 feedback_page_data_complete_; 158 feedback_page_data_complete_;
171 } 159 }
172 160
173 void FeedbackData::SendReport() { 161 void FeedbackData::SendReport() {
174 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 162 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
175 if (IsDataComplete() && !report_sent_) { 163 if (IsDataComplete() && !report_sent_) {
176 report_sent_ = true; 164 report_sent_ = true;
177 feedback_util::SendReport(this); 165 feedback_util::SendReport(this);
178 } 166 }
179 } 167 }
OLDNEW
« no previous file with comments | « chrome/browser/feedback/feedback_data.h ('k') | chrome/browser/feedback/feedback_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698