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 "chrome/browser/tracing/crash_service_uploader.h" | 5 #include "chrome/browser/tracing/crash_service_uploader.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 std::string post_data; | 191 std::string post_data; |
192 SetupMultipart(product, version, metadata.Pass(), "trace.json.gz", | 192 SetupMultipart(product, version, metadata.Pass(), "trace.json.gz", |
193 compressed_contents, &post_data); | 193 compressed_contents, &post_data); |
194 | 194 |
195 content::BrowserThread::PostTask( | 195 content::BrowserThread::PostTask( |
196 content::BrowserThread::UI, FROM_HERE, | 196 content::BrowserThread::UI, FROM_HERE, |
197 base::Bind(&TraceCrashServiceUploader::CreateAndStartURLFetcher, | 197 base::Bind(&TraceCrashServiceUploader::CreateAndStartURLFetcher, |
198 base::Unretained(this), upload_url, post_data)); | 198 base::Unretained(this), upload_url, post_data)); |
199 } | 199 } |
200 | 200 |
201 void TraceCrashServiceUploader::OnUploadError(std::string error_message) { | 201 void TraceCrashServiceUploader::OnUploadError( |
| 202 const std::string& error_message) { |
202 LOG(ERROR) << error_message; | 203 LOG(ERROR) << error_message; |
203 content::BrowserThread::PostTask( | 204 content::BrowserThread::PostTask( |
204 content::BrowserThread::UI, FROM_HERE, | 205 content::BrowserThread::UI, FROM_HERE, |
205 base::Bind(done_callback_, false, error_message)); | 206 base::Bind(done_callback_, false, error_message)); |
206 } | 207 } |
207 | 208 |
208 void TraceCrashServiceUploader::SetupMultipart( | 209 void TraceCrashServiceUploader::SetupMultipart( |
209 const std::string& product, | 210 const std::string& product, |
210 const std::string& version, | 211 const std::string& version, |
211 scoped_ptr<base::DictionaryValue> metadata, | 212 scoped_ptr<base::DictionaryValue> metadata, |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 std::string content_type = kUploadContentType; | 299 std::string content_type = kUploadContentType; |
299 content_type.append("; boundary="); | 300 content_type.append("; boundary="); |
300 content_type.append(kMultipartBoundary); | 301 content_type.append(kMultipartBoundary); |
301 | 302 |
302 url_fetcher_ = | 303 url_fetcher_ = |
303 net::URLFetcher::Create(GURL(upload_url), net::URLFetcher::POST, this); | 304 net::URLFetcher::Create(GURL(upload_url), net::URLFetcher::POST, this); |
304 url_fetcher_->SetRequestContext(request_context_); | 305 url_fetcher_->SetRequestContext(request_context_); |
305 url_fetcher_->SetUploadData(content_type, post_data); | 306 url_fetcher_->SetUploadData(content_type, post_data); |
306 url_fetcher_->Start(); | 307 url_fetcher_->Start(); |
307 } | 308 } |
OLD | NEW |