Convert cacheinvalidation_unittests to run exclusively on Swarming
[chromium-blink-merge.git] / chromeos / system / devicetype.cc
blobc99ddf4ca75ecee3d3e0de9959c48cf90d1d1397
1 // Copyright 2015 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.
5 #include "chromeos/system/devicetype.h"
7 #include <string>
9 #include "base/sys_info.h"
11 namespace chromeos {
13 namespace {
14 const char kDeviceType[] = "CHROMEOS_DEVICE_TYPE";
17 DeviceType GetDeviceType() {
18 std::string value;
19 if (base::SysInfo::GetLsbReleaseValue(kDeviceType, &value)) {
20 if (value == "CHROMEBASE")
21 return DeviceType::kChromebase;
22 else if (value == "CHROMEBIT")
23 return DeviceType::kChromebit;
24 // Most devices are Chromebooks, so we will also consider reference boards
25 // as chromebooks.
26 else if (value == "CHROMEBOOK" || value == "REFERENCE")
27 return DeviceType::kChromebook;
28 else if (value == "CHROMEBOX")
29 return DeviceType::kChromebox;
30 else
31 LOG(ERROR) << "Unknown device type \"" << value << "\"";
34 return DeviceType::kUnknown;
37 } // namespace chromeos