Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / chromeos / system / devicetype.cc
blob18369d407dc70fa9027ab46dfcef9763a8d3c0a3
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[] = "DEVICETYPE";
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