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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 std::string post_data; | 187 std::string post_data; |
188 SetupMultipart(product, version, metadata.Pass(), "trace.json.gz", | 188 SetupMultipart(product, version, metadata.Pass(), "trace.json.gz", |
189 compressed_contents, &post_data); | 189 compressed_contents, &post_data); |
190 | 190 |
191 content::BrowserThread::PostTask( | 191 content::BrowserThread::PostTask( |
192 content::BrowserThread::UI, FROM_HERE, | 192 content::BrowserThread::UI, FROM_HERE, |
193 base::Bind(&TraceCrashServiceUploader::CreateAndStartURLFetcher, | 193 base::Bind(&TraceCrashServiceUploader::CreateAndStartURLFetcher, |
194 base::Unretained(this), upload_url, post_data)); | 194 base::Unretained(this), upload_url, post_data)); |
195 } | 195 } |
196 | 196 |
197 void TraceCrashServiceUploader::OnUploadError(std::string error_message) { | 197 void TraceCrashServiceUploader::OnUploadError( |
| 198 const std::string& error_message) { |
198 LOG(ERROR) << error_message; | 199 LOG(ERROR) << error_message; |
199 content::BrowserThread::PostTask( | 200 content::BrowserThread::PostTask( |
200 content::BrowserThread::UI, FROM_HERE, | 201 content::BrowserThread::UI, FROM_HERE, |
201 base::Bind(done_callback_, false, error_message)); | 202 base::Bind(done_callback_, false, error_message)); |
202 } | 203 } |
203 | 204 |
204 void TraceCrashServiceUploader::SetupMultipart( | 205 void TraceCrashServiceUploader::SetupMultipart( |
205 const std::string& product, | 206 const std::string& product, |
206 const std::string& version, | 207 const std::string& version, |
207 scoped_ptr<base::DictionaryValue> metadata, | 208 scoped_ptr<base::DictionaryValue> metadata, |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 std::string content_type = kUploadContentType; | 295 std::string content_type = kUploadContentType; |
295 content_type.append("; boundary="); | 296 content_type.append("; boundary="); |
296 content_type.append(kMultipartBoundary); | 297 content_type.append(kMultipartBoundary); |
297 | 298 |
298 url_fetcher_ = | 299 url_fetcher_ = |
299 net::URLFetcher::Create(GURL(upload_url), net::URLFetcher::POST, this); | 300 net::URLFetcher::Create(GURL(upload_url), net::URLFetcher::POST, this); |
300 url_fetcher_->SetRequestContext(request_context_); | 301 url_fetcher_->SetRequestContext(request_context_); |
301 url_fetcher_->SetUploadData(content_type, post_data); | 302 url_fetcher_->SetUploadData(content_type, post_data); |
302 url_fetcher_->Start(); | 303 url_fetcher_->Start(); |
303 } | 304 } |
OLD | NEW |