| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/feedback/feedback_data.h" | 5 #include "components/feedback/feedback_data.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/json/json_string_value_serializer.h" | 9 #include "base/json/json_string_value_serializer.h" |
| 10 #include "base/memory/ref_counted_memory.h" | 10 #include "base/memory/ref_counted_memory.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 base::Bind(&FeedbackData::OnCompressComplete, this)); | 85 base::Bind(&FeedbackData::OnCompressComplete, this)); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void FeedbackData::AttachAndCompressFileData( | 88 void FeedbackData::AttachAndCompressFileData( |
| 89 scoped_ptr<std::string> attached_filedata) { | 89 scoped_ptr<std::string> attached_filedata) { |
| 90 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 90 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 91 | 91 |
| 92 if (!attached_filedata.get() || attached_filedata->empty()) | 92 if (!attached_filedata.get() || attached_filedata->empty()) |
| 93 return; | 93 return; |
| 94 ++pending_op_count_; | 94 ++pending_op_count_; |
| 95 #if defined(OS_WIN) | 95 base::FilePath attached_file = |
| 96 base::FilePath attached_file(base::UTF8ToWide(attached_filename_)); | 96 base::FilePath::FromUTF8Unsafe(attached_filename_); |
| 97 #else | |
| 98 base::FilePath attached_file(attached_filename_); | |
| 99 #endif | |
| 100 BrowserThread::PostBlockingPoolTaskAndReply( | 97 BrowserThread::PostBlockingPoolTaskAndReply( |
| 101 FROM_HERE, | 98 FROM_HERE, |
| 102 base::Bind(&FeedbackCommon::CompressFile, | 99 base::Bind(&FeedbackCommon::CompressFile, |
| 103 this, | 100 this, |
| 104 attached_file, | 101 attached_file, |
| 105 std::string(), | 102 std::string(), |
| 106 base::Passed(&attached_filedata)), | 103 base::Passed(&attached_filedata)), |
| 107 base::Bind(&FeedbackData::OnCompressComplete, this)); | 104 base::Bind(&FeedbackData::OnCompressComplete, this)); |
| 108 } | 105 } |
| 109 | 106 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 138 | 135 |
| 139 void FeedbackData::SendReport() { | 136 void FeedbackData::SendReport() { |
| 140 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 137 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 141 if (IsDataComplete() && !report_sent_) { | 138 if (IsDataComplete() && !report_sent_) { |
| 142 report_sent_ = true; | 139 report_sent_ = true; |
| 143 send_report_.Run(this); | 140 send_report_.Run(this); |
| 144 } | 141 } |
| 145 } | 142 } |
| 146 | 143 |
| 147 } // namespace feedback | 144 } // namespace feedback |
| OLD | NEW |