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/values.h" | 10 #include "base/values.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 base::Bind(&FeedbackData::ReadFileComplete, this)); | 145 base::Bind(&FeedbackData::ReadFileComplete, this)); |
146 } else { | 146 } else { |
147 read_attached_file_complete_ = true; | 147 read_attached_file_complete_ = true; |
148 } | 148 } |
149 #endif | 149 #endif |
150 feedback_page_data_complete_ = true; | 150 feedback_page_data_complete_ = true; |
151 SendReport(); | 151 SendReport(); |
152 } | 152 } |
153 | 153 |
154 #if defined(OS_CHROMEOS) | 154 #if defined(OS_CHROMEOS) |
| 155 void FeedbackData::set_sys_info( |
| 156 scoped_ptr<chromeos::SystemLogsResponse> sys_info) { |
| 157 if (sys_info.get()) |
| 158 CompressSyslogs(sys_info.Pass()); |
| 159 } |
| 160 |
155 void FeedbackData::CompressSyslogs( | 161 void FeedbackData::CompressSyslogs( |
156 scoped_ptr<chromeos::SystemLogsResponse> sys_info) { | 162 scoped_ptr<chromeos::SystemLogsResponse> sys_info) { |
157 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 163 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
158 | 164 |
159 // We get the pointer first since base::Passed will nullify the scoper, hence | 165 // We get the pointer first since base::Passed will nullify the scoper, hence |
160 // it's not safe to use <scoper>.get() as a parameter to PostTaskAndReply. | 166 // it's not safe to use <scoper>.get() as a parameter to PostTaskAndReply. |
161 chromeos::SystemLogsResponse* sys_info_ptr = sys_info.get(); | 167 chromeos::SystemLogsResponse* sys_info_ptr = sys_info.get(); |
162 std::string* compressed_logs_ptr = new std::string; | 168 std::string* compressed_logs_ptr = new std::string; |
163 scoped_ptr<std::string> compressed_logs(compressed_logs_ptr); | 169 scoped_ptr<std::string> compressed_logs(compressed_logs_ptr); |
164 BrowserThread::PostBlockingPoolTaskAndReply( | 170 BrowserThread::PostBlockingPoolTaskAndReply( |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 } | 202 } |
197 | 203 |
198 // private | 204 // private |
199 void FeedbackData::ReadAttachedFile(const base::FilePath& from) { | 205 void FeedbackData::ReadAttachedFile(const base::FilePath& from) { |
200 if (!file_util::ReadFileToString(from, attached_filedata_.get())) { | 206 if (!file_util::ReadFileToString(from, attached_filedata_.get())) { |
201 if (attached_filedata_.get()) | 207 if (attached_filedata_.get()) |
202 attached_filedata_->clear(); | 208 attached_filedata_->clear(); |
203 } | 209 } |
204 } | 210 } |
205 #endif | 211 #endif |
OLD | NEW |