forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdevicetype_utils.cc
40 lines (32 loc) · 1.2 KB
/
devicetype_utils.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/chromeos/devicetype_utils.h"
#include "base/logging.h"
#include "chromeos/system/devicetype.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/chromeos/strings/grit/ui_chromeos_strings.h"
namespace ui {
base::string16 SubstituteChromeOSDeviceType(int resource_id) {
return l10n_util::GetStringFUTF16(resource_id, GetChromeOSDeviceName());
}
base::string16 GetChromeOSDeviceName() {
return l10n_util::GetStringUTF16(GetChromeOSDeviceTypeResourceId());
}
int GetChromeOSDeviceTypeResourceId() {
switch (chromeos::GetDeviceType()) {
case chromeos::DeviceType::kChromebase:
return IDS_CHROMEBASE_DEVICE_NAME;
case chromeos::DeviceType::kChromebook:
return IDS_CHROMEBOOK_DEVICE_NAME;
case chromeos::DeviceType::kChromebox:
return IDS_CHROMEBOX_DEVICE_NAME;
case chromeos::DeviceType::kChromebit:
return IDS_CHROMEBIT_DEVICE_NAME;
case chromeos::DeviceType::kUnknown:
return IDS_GENERIC_CHROMEOS_DEVICE_NAME;
}
NOTREACHED();
return IDS_GENERIC_CHROMEOS_DEVICE_NAME;
}
} // namespace ui