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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 const char product[] = "Chrome_Android"; | 143 const char product[] = "Chrome_Android"; |
144 #elif defined(OS_CHROMEOS) | 144 #elif defined(OS_CHROMEOS) |
145 const char product[] = "Chrome_ChromeOS"; | 145 const char product[] = "Chrome_ChromeOS"; |
146 #else | 146 #else |
147 #error Platform not supported. | 147 #error Platform not supported. |
148 #endif | 148 #endif |
149 | 149 |
150 // VersionInfo::ProductNameAndVersionForUserAgent() returns a string like | 150 // VersionInfo::ProductNameAndVersionForUserAgent() returns a string like |
151 // "Chrome/aa.bb.cc.dd", split out the part before the "/". | 151 // "Chrome/aa.bb.cc.dd", split out the part before the "/". |
152 chrome::VersionInfo version_info; | 152 chrome::VersionInfo version_info; |
153 std::vector<std::string> product_components; | 153 std::vector<std::string> product_components = base::SplitString( |
154 base::SplitString(version_info.ProductNameAndVersionForUserAgent(), '/', | 154 version_info.ProductNameAndVersionForUserAgent(), "/", |
155 &product_components); | 155 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
156 DCHECK_EQ(2U, product_components.size()); | 156 DCHECK_EQ(2U, product_components.size()); |
157 std::string version; | 157 std::string version; |
158 if (product_components.size() == 2U) { | 158 if (product_components.size() == 2U) { |
159 version = product_components[1]; | 159 version = product_components[1]; |
160 } else { | 160 } else { |
161 version = "unknown"; | 161 version = "unknown"; |
162 } | 162 } |
163 | 163 |
164 if (url_fetcher_.get()) { | 164 if (url_fetcher_.get()) { |
165 OnUploadError("Already uploading."); | 165 OnUploadError("Already uploading."); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 std::string content_type = kUploadContentType; | 295 std::string content_type = kUploadContentType; |
296 content_type.append("; boundary="); | 296 content_type.append("; boundary="); |
297 content_type.append(kMultipartBoundary); | 297 content_type.append(kMultipartBoundary); |
298 | 298 |
299 url_fetcher_ = | 299 url_fetcher_ = |
300 net::URLFetcher::Create(GURL(upload_url), net::URLFetcher::POST, this); | 300 net::URLFetcher::Create(GURL(upload_url), net::URLFetcher::POST, this); |
301 url_fetcher_->SetRequestContext(request_context_); | 301 url_fetcher_->SetRequestContext(request_context_); |
302 url_fetcher_->SetUploadData(content_type, post_data); | 302 url_fetcher_->SetUploadData(content_type, post_data); |
303 url_fetcher_->Start(); | 303 url_fetcher_->Start(); |
304 } | 304 } |
OLD | NEW |