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/chromeos/chromeos_utils.h"
6
7#include "base/strings/string_util.h"
8#include "base/sys_info.h"
9#include "chrome/grit/generated_resources.h"
10#include "ui/base/l10n/l10n_util.h"
11
12namespace chromeos {
13
14namespace {
15
16// List of ChromeOS board names corresponding to Chromebase devices. Googlers
17// can find a list of ChromeOS device and board names at http://go/cros-names
18const char* const kChromebaseBoards[]  = {
19  "monroe",
20};
21
22// List of ChromeOS board names corresponding to Chromebox devices. Googlers
23// can find a list of ChromeOS device and board names at http://go/cros-names
24const char* const kChromeboxBoards[]  = {
25  "panther",
26  "stumpy",
27  "zako",
28};
29
30}  // namespace
31
32base::string16 GetChromeDeviceType() {
33  return l10n_util::GetStringUTF16(GetChromeDeviceTypeResourceId());
34}
35
36int GetChromeDeviceTypeResourceId() {
37  const std::string board = base::SysInfo::GetLsbReleaseBoard();
38  for (size_t i = 0; i < arraysize(kChromeboxBoards); ++i) {
39    if (StartsWithASCII(board, kChromeboxBoards[i], true))
40      return IDS_CHROMEBOX;
41  }
42  for (size_t i = 0; i < arraysize(kChromebaseBoards); ++i) {
43    if (StartsWithASCII(board, kChromebaseBoards[i], true))
44      return IDS_CHROMEBASE;
45  }
46  return IDS_CHROMEBOOK;
47}
48
49}  // namespace chromeos
50