Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 } | |
|
Ilya Sherman
2014/05/19 11:43:57
You'll still need a NOTREACHED() and default retur
Alexei Svitkine (slow)
2014/05/19 11:49:00
Ah, got it. Done.
| |
| 30 } | |
| 31 | |
| 32 } // namespace | |
| 33 | |
| 34 ChromeMetricsServiceClient::ChromeMetricsServiceClient() | |
| 35 : MetricsServiceClient() { | |
| 36 } | |
| 37 | |
| 38 ChromeMetricsServiceClient::~ChromeMetricsServiceClient() { | |
| 39 } | |
| 40 | |
| 41 void ChromeMetricsServiceClient::SetClientID(const std::string& client_id) { | |
| 42 crash_keys::SetClientID(client_id); | |
| 43 } | |
| 44 | |
| 45 bool ChromeMetricsServiceClient::IsOffTheRecordSessionActive() { | |
| 46 return !chrome::IsOffTheRecordSessionActive(); | |
| 47 } | |
| 48 | |
| 49 std::string ChromeMetricsServiceClient::GetApplicationLocale() { | |
| 50 return g_browser_process->GetApplicationLocale(); | |
| 51 } | |
| 52 | |
| 53 bool ChromeMetricsServiceClient::GetBrand(std::string* brand_code) { | |
| 54 return google_util::GetBrand(brand_code); | |
| 55 } | |
| 56 | |
| 57 metrics::SystemProfileProto::Channel ChromeMetricsServiceClient::GetChannel() { | |
| 58 return AsProtobufChannel(chrome::VersionInfo::GetChannel()); | |
| 59 } | |
| 60 | |
| 61 std::string ChromeMetricsServiceClient::GetVersionString() { | |
| 62 // TODO(asvitkine): Move over from metrics_log.cc | |
| 63 return std::string(); | |
| 64 } | |
| OLD | NEW |