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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/metrics/chrome_metrics_service_client.h"
6
7 #include "base/logging.h"
8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/google/google_util.h"
10 #include "chrome/browser/ui/browser_otr_state.h"
11 #include "chrome/common/chrome_version_info.h"
12 #include "chrome/common/crash_keys.h"
13
14 namespace {
15
16 metrics::SystemProfileProto::Channel AsProtobufChannel(
17 chrome::VersionInfo::Channel channel) {
18 switch (channel) {
19 case chrome::VersionInfo::CHANNEL_UNKNOWN:
20 return metrics::SystemProfileProto::CHANNEL_UNKNOWN;
21 case chrome::VersionInfo::CHANNEL_CANARY:
22 return metrics::SystemProfileProto::CHANNEL_CANARY;
23 case chrome::VersionInfo::CHANNEL_DEV:
24 return metrics::SystemProfileProto::CHANNEL_DEV;
25 case chrome::VersionInfo::CHANNEL_BETA:
26 return metrics::SystemProfileProto::CHANNEL_BETA;
27 case chrome::VersionInfo::CHANNEL_STABLE:
28 return metrics::SystemProfileProto::CHANNEL_STABLE;
29 default:
Ilya Sherman 2014/05/19 11:02:37 nit: Please remove the default case, so that the c
Alexei Svitkine (slow) 2014/05/19 11:34:57 Done.
30 NOTREACHED();
31 return metrics::SystemProfileProto::CHANNEL_UNKNOWN;
32 }
33 }
34
35 } // namespace
36
37 ChromeMetricsServiceClient::ChromeMetricsServiceClient()
38 : MetricsServiceClient() {
39 }
40
41 ChromeMetricsServiceClient::~ChromeMetricsServiceClient() {
42 }
43
44 void ChromeMetricsServiceClient::SetClientID(const std::string& client_id) {
45 crash_keys::SetClientID(client_id);
46 }
47
48 bool ChromeMetricsServiceClient::IsOffTheRecordSessionActive() {
49 return !chrome::IsOffTheRecordSessionActive();
50 }
51
52 std::string ChromeMetricsServiceClient::GetApplicationLocale() {
53 return g_browser_process->GetApplicationLocale();
54 }
55
56 bool ChromeMetricsServiceClient::GetBrand(std::string* brand_code) {
57 return google_util::GetBrand(brand_code);
58 }
59
60 metrics::SystemProfileProto::Channel ChromeMetricsServiceClient::GetChannel() {
61 return AsProtobufChannel(chrome::VersionInfo::GetChannel());
62 }
63
64 std::string ChromeMetricsServiceClient::GetVersionString() {
65 // TODO(asvitkine): Move over from metrics_log.cc
66 return std::string();
67 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698