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

Unified Diff: chrome/browser/metrics/metrics_log.cc

Issue 239093004: Move part of metrics from chrome/common to components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unittest that broke after rebase. Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/metrics/metrics_log.cc
diff --git a/chrome/browser/metrics/metrics_log.cc b/chrome/browser/metrics/metrics_log.cc
index 239657f11ec79747a346e6327789f21d743eeae2..a8b25cd2e214e1ad38d40bba4c0d0cf3ec0181d4 100644
--- a/chrome/browser/metrics/metrics_log.cc
+++ b/chrome/browser/metrics/metrics_log.cc
@@ -37,12 +37,12 @@
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/common/chrome_version_info.h"
#include "chrome/common/logging_chrome.h"
-#include "chrome/common/metrics/proto/omnibox_event.pb.h"
-#include "chrome/common/metrics/proto/profiler_event.pb.h"
-#include "chrome/common/metrics/proto/system_profile.pb.h"
#include "chrome/common/metrics/variations/variations_util.h"
#include "chrome/common/pref_names.h"
#include "chrome/installer/util/google_update_settings.h"
+#include "components/metrics/proto/omnibox_event.pb.h"
+#include "components/metrics/proto/profiler_event.pb.h"
+#include "components/metrics/proto/system_profile.pb.h"
#include "components/nacl/common/nacl_process_type.h"
#include "content/public/browser/gpu_data_manager.h"
#include "content/public/common/content_client.h"
@@ -70,6 +70,7 @@ using content::GpuDataManager;
using metrics::OmniboxEventProto;
using metrics::ProfilerEventProto;
using metrics::SystemProfileProto;
+using metrics::MetricsLogBase;
Ilya Sherman 2014/04/15 23:00:40 nit: Alphabetize, please.
using tracked_objects::ProcessDataSnapshot;
typedef chrome_variations::ActiveGroupId ActiveGroupId;
typedef SystemProfileProto::GoogleUpdate::ProductInfo ProductInfo;
@@ -207,6 +208,25 @@ ProfilerEventProto::TrackedObject::ProcessType AsProtobufProcessType(
}
}
+SystemProfileProto::Channel AsProtobufChannel(
+ chrome::VersionInfo::Channel channel) {
+ switch (channel) {
+ case chrome::VersionInfo::CHANNEL_UNKNOWN:
+ return SystemProfileProto::CHANNEL_UNKNOWN;
+ case chrome::VersionInfo::CHANNEL_CANARY:
+ return SystemProfileProto::CHANNEL_CANARY;
+ case chrome::VersionInfo::CHANNEL_DEV:
+ return SystemProfileProto::CHANNEL_DEV;
+ case chrome::VersionInfo::CHANNEL_BETA:
+ return SystemProfileProto::CHANNEL_BETA;
+ case chrome::VersionInfo::CHANNEL_STABLE:
+ return SystemProfileProto::CHANNEL_STABLE;
+ default:
+ NOTREACHED();
+ return SystemProfileProto::CHANNEL_UNKNOWN;
+ }
+}
+
// Computes a SHA-1 hash of |data| and returns it as a hex string.
std::string ComputeSHA1(const std::string& data) {
const std::string sha1 = base::SHA1HashString(data);
@@ -386,6 +406,9 @@ MetricsLog::MetricsLog(const std::string& client_id,
MetricsLog::GetVersionString()),
creation_time_(base::TimeTicks::Now()),
extension_metrics_(uma_proto()->client_id()) {
+ uma_proto()->mutable_system_profile()->set_channel(
+ AsProtobufChannel(chrome::VersionInfo::CHANNEL_STABLE));
+
#if defined(OS_CHROMEOS)
metrics_log_chromeos_.reset(new MetricsLogChromeOS(uma_proto()));
#endif // OS_CHROMEOS

Powered by Google App Engine
This is Rietveld 408576698