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

Side by Side Diff: chrome/browser/safe_browsing/incident_reporting/environment_data_collection.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/safe_browsing/incident_reporting/environment_data_colle ction.h" 5 #include "chrome/browser/safe_browsing/incident_reporting/environment_data_colle ction.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/cpu.h" 9 #include "base/cpu.h"
10 #include "base/sys_info.h" 10 #include "base/sys_info.h"
11 #include "chrome/common/chrome_version_info.h" 11 #include "chrome/common/channel_info.h"
12 #include "chrome/common/safe_browsing/csd.pb.h" 12 #include "chrome/common/safe_browsing/csd.pb.h"
13 #include "components/version_info/version_info.h"
13 14
14 namespace safe_browsing { 15 namespace safe_browsing {
15 16
16 // Populates |process| with platform-specific data related to the chrome browser 17 // Populates |process| with platform-specific data related to the chrome browser
17 // process. 18 // process.
18 void CollectPlatformProcessData( 19 void CollectPlatformProcessData(
19 ClientIncidentReport_EnvironmentData_Process* process); 20 ClientIncidentReport_EnvironmentData_Process* process);
20 21
21 namespace { 22 namespace {
22 23
23 ClientIncidentReport_EnvironmentData_Process_Channel MapChannelToProtobuf( 24 ClientIncidentReport_EnvironmentData_Process_Channel MapChannelToProtobuf(
24 version_info::Channel channel) { 25 version_info::Channel channel) {
25 typedef ClientIncidentReport_EnvironmentData_Process Process; 26 typedef ClientIncidentReport_EnvironmentData_Process Process;
26 switch (channel) { 27 switch (channel) {
27 case version_info::Channel::CANARY: 28 case version_info::Channel::CANARY:
28 return Process::CHANNEL_CANARY; 29 return Process::CHANNEL_CANARY;
29 case version_info::Channel::DEV: 30 case version_info::Channel::DEV:
30 return Process::CHANNEL_DEV; 31 return Process::CHANNEL_DEV;
31 case version_info::Channel::BETA: 32 case version_info::Channel::BETA:
32 return Process::CHANNEL_BETA; 33 return Process::CHANNEL_BETA;
33 case version_info::Channel::STABLE: 34 case version_info::Channel::STABLE:
34 return Process::CHANNEL_STABLE; 35 return Process::CHANNEL_STABLE;
35 default: 36 default:
36 return Process::CHANNEL_UNKNOWN; 37 return Process::CHANNEL_UNKNOWN;
37 } 38 }
38 } 39 }
39 40
40 // Populates |process| with data related to the chrome browser process. 41 // Populates |process| with data related to the chrome browser process.
41 void CollectProcessData(ClientIncidentReport_EnvironmentData_Process* process) { 42 void CollectProcessData(ClientIncidentReport_EnvironmentData_Process* process) {
42 chrome::VersionInfo version_info;
43 // TODO(grt): Move this logic into VersionInfo (it also appears in 43 // TODO(grt): Move this logic into VersionInfo (it also appears in
44 // ChromeMetricsServiceClient). 44 // ChromeMetricsServiceClient).
45 std::string version(version_info.Version()); 45 std::string version(version_info::GetVersionNumber());
46 #if defined(ARCH_CPU_64_BITS) 46 #if defined(ARCH_CPU_64_BITS)
47 version += "-64"; 47 version += "-64";
48 #endif // defined(ARCH_CPU_64_BITS) 48 #endif // defined(ARCH_CPU_64_BITS)
49 if (!version_info.IsOfficialBuild()) 49 if (!version_info::IsOfficialBuild())
50 version += "-devel"; 50 version += "-devel";
51 process->set_version(version); 51 process->set_version(version);
52 52
53 process->set_chrome_update_channel( 53 process->set_chrome_update_channel(
54 MapChannelToProtobuf(chrome::VersionInfo::GetChannel())); 54 MapChannelToProtobuf(chrome::GetChannel()));
55 55
56 CollectPlatformProcessData(process); 56 CollectPlatformProcessData(process);
57 } 57 }
58 58
59 } // namespace 59 } // namespace
60 60
61 void CollectEnvironmentData(ClientIncidentReport_EnvironmentData* data) { 61 void CollectEnvironmentData(ClientIncidentReport_EnvironmentData* data) {
62 // OS 62 // OS
63 { 63 {
64 ClientIncidentReport_EnvironmentData_OS* os = data->mutable_os(); 64 ClientIncidentReport_EnvironmentData_OS* os = data->mutable_os();
(...skipping 17 matching lines...) Expand all
82 82
83 #if !defined(OS_WIN) 83 #if !defined(OS_WIN)
84 void CollectPlatformProcessData( 84 void CollectPlatformProcessData(
85 ClientIncidentReport_EnvironmentData_Process* process) { 85 ClientIncidentReport_EnvironmentData_Process* process) {
86 // Empty implementation for platforms that do not (yet) have their own 86 // Empty implementation for platforms that do not (yet) have their own
87 // implementations. 87 // implementations.
88 } 88 }
89 #endif 89 #endif
90 90
91 } // namespace safe_browsing 91 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_impl.cc ('k') | chrome/browser/safe_browsing/protocol_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698