NaCl docs: add sanitizers to GSoC ideas
[chromium-blink-merge.git] / chrome / browser / chromeos / chromeos_utils.cc
blob8a58a0e4f140c01117401dd612835487c2e401d8
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.
5 #include "chrome/browser/chromeos/chromeos_utils.h"
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"
12 namespace chromeos {
14 namespace {
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
18 const char* const kChromebaseBoards[] = {
19 "monroe",
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
24 const char* const kChromeboxBoards[] = {
25 "panther",
26 "stumpy",
27 "zako",
30 } // namespace
32 namespace chrome_device_types {
34 const char kChromebox[] = "chromebox";
35 const char kChromebase[] = "chromebase";
36 const char kChromebook[] = "chromebook";
38 } // namespace chrome_device_types
40 base::string16 GetChromeDeviceType() {
41 return l10n_util::GetStringUTF16(GetChromeDeviceTypeResourceId());
44 int GetChromeDeviceTypeResourceId() {
45 const std::string board = base::SysInfo::GetLsbReleaseBoard();
46 for (size_t i = 0; i < arraysize(kChromeboxBoards); ++i) {
47 if (StartsWithASCII(board, kChromeboxBoards[i], true))
48 return IDS_CHROMEBOX;
50 for (size_t i = 0; i < arraysize(kChromebaseBoards); ++i) {
51 if (StartsWithASCII(board, kChromebaseBoards[i], true))
52 return IDS_CHROMEBASE;
54 return IDS_CHROMEBOOK;
57 std::string GetChromeDeviceTypeString() {
58 int resource_id = GetChromeDeviceTypeResourceId();
59 switch (resource_id) {
60 case IDS_CHROMEBOX:
61 return chrome_device_types::kChromebox;
62 case IDS_CHROMEBASE:
63 return chrome_device_types::kChromebase;
64 default:
65 NOTREACHED() << "Unknown Chrome device type: " << resource_id;
66 case IDS_CHROMEBOOK:
67 return chrome_device_types::kChromebook;
71 } // namespace chromeos