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 } |
| 30 NOTREACHED(); |
| 31 return metrics::SystemProfileProto::CHANNEL_UNKNOWN; |
| 32 } |
| 33 |
| 34 } // namespace |
| 35 |
| 36 ChromeMetricsServiceClient::ChromeMetricsServiceClient() |
| 37 : MetricsServiceClient() { |
| 38 } |
| 39 |
| 40 ChromeMetricsServiceClient::~ChromeMetricsServiceClient() { |
| 41 } |
| 42 |
| 43 void ChromeMetricsServiceClient::SetClientID(const std::string& client_id) { |
| 44 crash_keys::SetClientID(client_id); |
| 45 } |
| 46 |
| 47 bool ChromeMetricsServiceClient::IsOffTheRecordSessionActive() { |
| 48 return !chrome::IsOffTheRecordSessionActive(); |
| 49 } |
| 50 |
| 51 std::string ChromeMetricsServiceClient::GetApplicationLocale() { |
| 52 return g_browser_process->GetApplicationLocale(); |
| 53 } |
| 54 |
| 55 bool ChromeMetricsServiceClient::GetBrand(std::string* brand_code) { |
| 56 return google_util::GetBrand(brand_code); |
| 57 } |
| 58 |
| 59 metrics::SystemProfileProto::Channel ChromeMetricsServiceClient::GetChannel() { |
| 60 return AsProtobufChannel(chrome::VersionInfo::GetChannel()); |
| 61 } |
| 62 |
| 63 std::string ChromeMetricsServiceClient::GetVersionString() { |
| 64 // TODO(asvitkine): Move over from metrics_log.cc |
| 65 return std::string(); |
| 66 } |
OLD | NEW |