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

Side by Side Diff: chrome/browser/media/webrtc_log_uploader.cc

Issue 1269773002: Cleanup VersionInfo after componentization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/media/webrtc_log_uploader.h" 5 #include "chrome/browser/media/webrtc_log_uploader.h"
6 6
7 #include "base/files/file_enumerator.h" 7 #include "base/files/file_enumerator.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/logging.h" 10 #include "base/logging.h"
11 #include "base/pickle.h" 11 #include "base/pickle.h"
12 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
13 #include "base/strings/string_split.h" 13 #include "base/strings/string_split.h"
14 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
15 #include "base/time/time.h" 15 #include "base/time/time.h"
16 #include "chrome/browser/browser_process.h" 16 #include "chrome/browser/browser_process.h"
17 #include "chrome/browser/media/media_url_constants.h" 17 #include "chrome/browser/media/media_url_constants.h"
18 #include "chrome/browser/media/webrtc_log_list.h" 18 #include "chrome/browser/media/webrtc_log_list.h"
19 #include "chrome/browser/media/webrtc_log_util.h" 19 #include "chrome/browser/media/webrtc_log_util.h"
20 #include "chrome/common/chrome_version_info.h"
21 #include "chrome/common/partial_circular_buffer.h" 20 #include "chrome/common/partial_circular_buffer.h"
21 #include "components/version_info/version_info.h"
22 #include "content/public/browser/browser_thread.h" 22 #include "content/public/browser/browser_thread.h"
23 #include "net/base/mime_util.h" 23 #include "net/base/mime_util.h"
24 #include "net/url_request/url_fetcher.h" 24 #include "net/url_request/url_fetcher.h"
25 #include "third_party/zlib/zlib.h" 25 #include "third_party/zlib/zlib.h"
26 26
27 namespace { 27 namespace {
28 28
29 const int kLogCountLimit = 5; 29 const int kLogCountLimit = 5;
30 const uint32 kIntermediateCompressionBufferBytes = 256 * 1024; // 256 KB 30 const uint32 kIntermediateCompressionBufferBytes = 256 * 1024; // 256 KB
31 const int kLogListLimitLines = 50; 31 const int kLogListLimitLines = 50;
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 #endif 344 #endif
345 #elif defined(OS_ANDROID) 345 #elif defined(OS_ANDROID)
346 const char product[] = "Chrome_Android"; 346 const char product[] = "Chrome_Android";
347 #elif defined(OS_CHROMEOS) 347 #elif defined(OS_CHROMEOS)
348 const char product[] = "Chrome_ChromeOS"; 348 const char product[] = "Chrome_ChromeOS";
349 #else 349 #else
350 #error Platform not supported. 350 #error Platform not supported.
351 #endif 351 #endif
352 net::AddMultipartValueForUpload("prod", product, kMultipartBoundary, 352 net::AddMultipartValueForUpload("prod", product, kMultipartBoundary,
353 "", post_data); 353 "", post_data);
354 chrome::VersionInfo version_info; 354 net::AddMultipartValueForUpload("ver",
355 net::AddMultipartValueForUpload("ver", version_info.Version() + "-webrtc", 355 version_info::GetVersionNumber() + "-webrtc",
356 kMultipartBoundary, "", post_data); 356 kMultipartBoundary, "", post_data);
357 net::AddMultipartValueForUpload("guid", "0", kMultipartBoundary, 357 net::AddMultipartValueForUpload("guid", "0", kMultipartBoundary,
358 "", post_data); 358 "", post_data);
359 net::AddMultipartValueForUpload("type", "webrtc_log", kMultipartBoundary, 359 net::AddMultipartValueForUpload("type", "webrtc_log", kMultipartBoundary,
360 "", post_data); 360 "", post_data);
361 361
362 // Add custom meta data. 362 // Add custom meta data.
363 std::map<std::string, std::string>::const_iterator it = meta_data.begin(); 363 std::map<std::string, std::string>::const_iterator it = meta_data.begin();
364 for (; it != meta_data.end(); ++it) { 364 for (; it != meta_data.end(); ++it) {
365 net::AddMultipartValueForUpload(it->first, it->second, kMultipartBoundary, 365 net::AddMultipartValueForUpload(it->first, it->second, kMultipartBoundary,
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 if (!success) { 565 if (!success) {
566 error_message = "Uploading failed, response code: " + 566 error_message = "Uploading failed, response code: " +
567 base::IntToString(response_code); 567 base::IntToString(response_code);
568 } 568 }
569 content::BrowserThread::PostTask( 569 content::BrowserThread::PostTask(
570 content::BrowserThread::UI, FROM_HERE, 570 content::BrowserThread::UI, FROM_HERE,
571 base::Bind(upload_done_data.callback, success, report_id, 571 base::Bind(upload_done_data.callback, success, report_id,
572 error_message)); 572 error_message));
573 } 573 }
574 } 574 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698