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

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

Issue 292693003: Introduce MetricsServiceClient and ChromeMetricsServiceClient. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 years, 7 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
« no previous file with comments | « chrome/browser/metrics/chrome_metrics_service_client.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/metrics/chrome_metrics_service_client.cc
===================================================================
--- chrome/browser/metrics/chrome_metrics_service_client.cc (revision 0)
+++ chrome/browser/metrics/chrome_metrics_service_client.cc (working copy)
@@ -0,0 +1,66 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/metrics/chrome_metrics_service_client.h"
+
+#include "base/logging.h"
+#include "chrome/browser/browser_process.h"
+#include "chrome/browser/google/google_util.h"
+#include "chrome/browser/ui/browser_otr_state.h"
+#include "chrome/common/chrome_version_info.h"
+#include "chrome/common/crash_keys.h"
+
+namespace {
+
+metrics::SystemProfileProto::Channel AsProtobufChannel(
+ chrome::VersionInfo::Channel channel) {
+ switch (channel) {
+ case chrome::VersionInfo::CHANNEL_UNKNOWN:
+ return metrics::SystemProfileProto::CHANNEL_UNKNOWN;
+ case chrome::VersionInfo::CHANNEL_CANARY:
+ return metrics::SystemProfileProto::CHANNEL_CANARY;
+ case chrome::VersionInfo::CHANNEL_DEV:
+ return metrics::SystemProfileProto::CHANNEL_DEV;
+ case chrome::VersionInfo::CHANNEL_BETA:
+ return metrics::SystemProfileProto::CHANNEL_BETA;
+ case chrome::VersionInfo::CHANNEL_STABLE:
+ return metrics::SystemProfileProto::CHANNEL_STABLE;
+ }
+ NOTREACHED();
+ return metrics::SystemProfileProto::CHANNEL_UNKNOWN;
+}
+
+} // namespace
+
+ChromeMetricsServiceClient::ChromeMetricsServiceClient()
+ : MetricsServiceClient() {
+}
+
+ChromeMetricsServiceClient::~ChromeMetricsServiceClient() {
+}
+
+void ChromeMetricsServiceClient::SetClientID(const std::string& client_id) {
+ crash_keys::SetClientID(client_id);
+}
+
+bool ChromeMetricsServiceClient::IsOffTheRecordSessionActive() {
+ return !chrome::IsOffTheRecordSessionActive();
+}
+
+std::string ChromeMetricsServiceClient::GetApplicationLocale() {
+ return g_browser_process->GetApplicationLocale();
+}
+
+bool ChromeMetricsServiceClient::GetBrand(std::string* brand_code) {
+ return google_util::GetBrand(brand_code);
+}
+
+metrics::SystemProfileProto::Channel ChromeMetricsServiceClient::GetChannel() {
+ return AsProtobufChannel(chrome::VersionInfo::GetChannel());
+}
+
+std::string ChromeMetricsServiceClient::GetVersionString() {
+ // TODO(asvitkine): Move over from metrics_log.cc
+ return std::string();
+}
« no previous file with comments | « chrome/browser/metrics/chrome_metrics_service_client.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698