Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / chrome / browser / chromeos / chromeos_utils.cc
blobc6777e5fd8d95b7ee9b3beab7d896c4e8a0db353
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",
28 "tricky",
29 "mccloud",
32 // List of ChromeOS board names corresponding to Chromebit devices. Googlers
33 // can find a list of ChromeOS device and board names at http://go/cros-names
34 const char* const kChromebitBoards[] = {
35 "veyron_brain",
38 } // namespace
40 namespace chrome_device_types {
42 const char kChromebox[] = "chromebox";
43 const char kChromebase[] = "chromebase";
44 const char kChromebit[] = "chromebit";
45 const char kChromebook[] = "chromebook";
47 } // namespace chrome_device_types
49 base::string16 GetChromeDeviceType() {
50 return l10n_util::GetStringUTF16(GetChromeDeviceTypeResourceId());
53 int GetChromeDeviceTypeResourceId() {
54 const std::string board = base::SysInfo::GetLsbReleaseBoard();
55 for (size_t i = 0; i < arraysize(kChromeboxBoards); ++i) {
56 if (StartsWithASCII(board, kChromeboxBoards[i], true))
57 return IDS_CHROMEBOX;
59 for (size_t i = 0; i < arraysize(kChromebaseBoards); ++i) {
60 if (StartsWithASCII(board, kChromebaseBoards[i], true))
61 return IDS_CHROMEBASE;
63 for (size_t i = 0; i < arraysize(kChromebitBoards); ++i) {
64 if (StartsWithASCII(board, kChromebitBoards[i], true))
65 return IDS_CHROMEBIT;
67 return IDS_CHROMEBOOK;
70 std::string GetChromeDeviceTypeString() {
71 int resource_id = GetChromeDeviceTypeResourceId();
72 switch (resource_id) {
73 case IDS_CHROMEBOX:
74 return chrome_device_types::kChromebox;
75 case IDS_CHROMEBASE:
76 return chrome_device_types::kChromebase;
77 case IDS_CHROMEBIT:
78 return chrome_device_types::kChromebit;
79 default:
80 NOTREACHED() << "Unknown Chrome device type: " << resource_id;
81 case IDS_CHROMEBOOK:
82 return chrome_device_types::kChromebook;
86 } // namespace chromeos