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

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: remove chrome/ from gyp files Created 6 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
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
26 namespace { 19 namespace {
27 20
28 const char kMultilineIndicatorString[] = "<multiline>\n"; 21 const char kMultilineIndicatorString[] = "<multiline>\n";
29 const char kMultilineStartString[] = "---------- START ----------\n"; 22 const char kMultilineStartString[] = "---------- START ----------\n";
30 const char kMultilineEndString[] = "---------- END ----------\n\n"; 23 const char kMultilineEndString[] = "---------- END ----------\n\n";
31 24
32 const size_t kFeedbackMaxLength = 4 * 1024; 25 const size_t kFeedbackMaxLength = 4 * 1024;
33 const size_t kFeedbackMaxLineCount = 40; 26 const size_t kFeedbackMaxLineCount = 40;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 // static 99 // static
107 bool FeedbackData::BelowCompressionThreshold(const std::string& content) { 100 bool FeedbackData::BelowCompressionThreshold(const std::string& content) {
108 if (content.length() > kFeedbackMaxLength) 101 if (content.length() > kFeedbackMaxLength)
109 return false; 102 return false;
110 const size_t line_count = std::count(content.begin(), content.end(), '\n'); 103 const size_t line_count = std::count(content.begin(), content.end(), '\n');
111 if (line_count > kFeedbackMaxLineCount) 104 if (line_count > kFeedbackMaxLineCount)
112 return false; 105 return false;
113 return true; 106 return true;
114 } 107 }
115 108
116 FeedbackData::FeedbackData() : profile_(NULL), 109 FeedbackData::FeedbackData() : context_(NULL),
117 trace_id_(0), 110 trace_id_(0),
118 feedback_page_data_complete_(false), 111 feedback_page_data_complete_(false),
119 syslogs_compression_complete_(false), 112 syslogs_compression_complete_(false),
120 histograms_compression_complete_(false), 113 histograms_compression_complete_(false),
121 attached_file_compression_complete_(false), 114 attached_file_compression_complete_(false),
122 report_sent_(false) { 115 report_sent_(false) {
123 } 116 }
124 117
125 FeedbackData::~FeedbackData() { 118 FeedbackData::~FeedbackData() {
126 } 119 }
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 feedback_page_data_complete_; 262 feedback_page_data_complete_;
270 } 263 }
271 264
272 void FeedbackData::SendReport() { 265 void FeedbackData::SendReport() {
273 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 266 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
274 if (IsDataComplete() && !report_sent_) { 267 if (IsDataComplete() && !report_sent_) {
275 report_sent_ = true; 268 report_sent_ = true;
276 feedback_util::SendReport(this); 269 feedback_util::SendReport(this);
277 } 270 }
278 } 271 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698