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

Side by Side Diff: components/feedback/feedback_data.cc

Issue 225183018: Move feedback files into src/components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase to latest Created 6 years, 7 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
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 "components/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/memory/ref_counted_memory.h"
9 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
11 #include "base/values.h" 12 #include "base/values.h"
12 #include "chrome/browser/browser_process.h" 13 #include "components/feedback/feedback_util.h"
13 #include "chrome/browser/chromeos/settings/cros_settings.h" 14 #include "components/feedback/tracing_manager.h"
14 #include "chrome/browser/feedback/feedback_util.h"
15 #include "chrome/browser/feedback/tracing_manager.h"
16 #include "chrome/browser/profiles/profile_manager.h"
17 #include "content/public/browser/browser_thread.h" 15 #include "content/public/browser/browser_thread.h"
18 16
19 #if defined(USE_ASH)
20 #include "ash/shell.h"
21 #include "ash/shell_delegate.h"
22 #endif
23
24 using content::BrowserThread; 17 using content::BrowserThread;
25 18
19 namespace feedback {
26 namespace { 20 namespace {
27 21
28 const char kMultilineIndicatorString[] = "<multiline>\n"; 22 const char kMultilineIndicatorString[] = "<multiline>\n";
29 const char kMultilineStartString[] = "---------- START ----------\n"; 23 const char kMultilineStartString[] = "---------- START ----------\n";
30 const char kMultilineEndString[] = "---------- END ----------\n\n"; 24 const char kMultilineEndString[] = "---------- END ----------\n\n";
31 25
32 const size_t kFeedbackMaxLength = 4 * 1024; 26 const size_t kFeedbackMaxLength = 4 * 1024;
33 const size_t kFeedbackMaxLineCount = 40; 27 const size_t kFeedbackMaxLineCount = 40;
34 28
35 const char kTraceFilename[] = "tracing.zip\n"; 29 const char kTraceFilename[] = "tracing.zip\n";
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 // static 100 // static
107 bool FeedbackData::BelowCompressionThreshold(const std::string& content) { 101 bool FeedbackData::BelowCompressionThreshold(const std::string& content) {
108 if (content.length() > kFeedbackMaxLength) 102 if (content.length() > kFeedbackMaxLength)
109 return false; 103 return false;
110 const size_t line_count = std::count(content.begin(), content.end(), '\n'); 104 const size_t line_count = std::count(content.begin(), content.end(), '\n');
111 if (line_count > kFeedbackMaxLineCount) 105 if (line_count > kFeedbackMaxLineCount)
112 return false; 106 return false;
113 return true; 107 return true;
114 } 108 }
115 109
116 FeedbackData::FeedbackData() : profile_(NULL), 110 FeedbackData::FeedbackData() : context_(NULL),
117 trace_id_(0), 111 trace_id_(0),
118 feedback_page_data_complete_(false), 112 feedback_page_data_complete_(false),
119 syslogs_compression_complete_(false), 113 syslogs_compression_complete_(false),
120 histograms_compression_complete_(false), 114 histograms_compression_complete_(false),
121 attached_file_compression_complete_(false), 115 attached_file_compression_complete_(false),
122 report_sent_(false) { 116 report_sent_(false) {
123 } 117 }
124 118
125 FeedbackData::~FeedbackData() { 119 FeedbackData::~FeedbackData() {
126 } 120 }
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 feedback_page_data_complete_; 263 feedback_page_data_complete_;
270 } 264 }
271 265
272 void FeedbackData::SendReport() { 266 void FeedbackData::SendReport() {
273 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 267 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
274 if (IsDataComplete() && !report_sent_) { 268 if (IsDataComplete() && !report_sent_) {
275 report_sent_ = true; 269 report_sent_ = true;
276 feedback_util::SendReport(this); 270 feedback_util::SendReport(this);
277 } 271 }
278 } 272 }
273
274 } // namespace feedback
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698