Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(285)

Side by Side Diff: chrome/browser/tracing/crash_service_uploader.cc

Issue 1269773002: Cleanup VersionInfo after componentization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "base/json/json_writer.h" 11 #include "base/json/json_writer.h"
12 #include "base/memory/shared_memory.h" 12 #include "base/memory/shared_memory.h"
13 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
14 #include "base/strings/string_split.h" 14 #include "base/strings/string_split.h"
15 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
16 #include "base/strings/stringprintf.h" 16 #include "base/strings/stringprintf.h"
17 #include "base/time/time.h" 17 #include "base/time/time.h"
18 #include "chrome/common/chrome_version_info.h" 18 #include "components/version_info/version_info.h"
19 #include "content/public/browser/browser_thread.h" 19 #include "content/public/browser/browser_thread.h"
20 #include "content/public/common/content_switches.h" 20 #include "content/public/common/content_switches.h"
21 #include "net/base/mime_util.h" 21 #include "net/base/mime_util.h"
22 #include "net/base/network_delegate.h" 22 #include "net/base/network_delegate.h"
23 #include "net/proxy/proxy_config.h" 23 #include "net/proxy/proxy_config.h"
24 #include "net/proxy/proxy_config_service.h" 24 #include "net/proxy/proxy_config_service.h"
25 #include "net/url_request/url_fetcher.h" 25 #include "net/url_request/url_fetcher.h"
26 #include "net/url_request/url_request_context.h" 26 #include "net/url_request/url_request_context.h"
27 #include "net/url_request/url_request_context_builder.h" 27 #include "net/url_request/url_request_context_builder.h"
28 #include "net/url_request/url_request_context_getter.h" 28 #include "net/url_request/url_request_context_getter.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 #elif defined(OS_LINUX) 140 #elif defined(OS_LINUX)
141 const char product[] = "Chrome_Linux"; 141 const char product[] = "Chrome_Linux";
142 #elif defined(OS_ANDROID) 142 #elif defined(OS_ANDROID)
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 // version_info::GetProductNameAndVersionForUserAgent() 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;
153 std::vector<std::string> product_components = base::SplitString( 152 std::vector<std::string> product_components = base::SplitString(
154 version_info.ProductNameAndVersionForUserAgent(), "/", 153 version_info::GetProductNameAndVersionForUserAgent(), "/",
155 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); 154 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
156 DCHECK_EQ(2U, product_components.size()); 155 DCHECK_EQ(2U, product_components.size());
157 std::string version; 156 std::string version;
158 if (product_components.size() == 2U) { 157 if (product_components.size() == 2U) {
159 version = product_components[1]; 158 version = product_components[1];
160 } else { 159 } else {
161 version = "unknown"; 160 version = "unknown";
162 } 161 }
163 162
164 if (url_fetcher_.get()) { 163 if (url_fetcher_.get()) {
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 std::string content_type = kUploadContentType; 294 std::string content_type = kUploadContentType;
296 content_type.append("; boundary="); 295 content_type.append("; boundary=");
297 content_type.append(kMultipartBoundary); 296 content_type.append(kMultipartBoundary);
298 297
299 url_fetcher_ = 298 url_fetcher_ =
300 net::URLFetcher::Create(GURL(upload_url), net::URLFetcher::POST, this); 299 net::URLFetcher::Create(GURL(upload_url), net::URLFetcher::POST, this);
301 url_fetcher_->SetRequestContext(request_context_); 300 url_fetcher_->SetRequestContext(request_context_);
302 url_fetcher_->SetUploadData(content_type, post_data); 301 url_fetcher_->SetUploadData(content_type, post_data);
303 url_fetcher_->Start(); 302 url_fetcher_->Start();
304 } 303 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/sync_stopped_reporter_unittest.cc ('k') | chrome/browser/ui/app_list/app_list_service_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698