summaryrefslogtreecommitdiffstats
path: root/device
diff options
context:
space:
mode:
authorjdufault <jdufault@chromium.org>2015-07-14 17:16:46 -0700
committerCommit bot <commit-bot@chromium.org>2015-07-15 00:17:24 +0000
commit239d6629e3c9b2f582a1d7086430d1e432ca5867 (patch)
tree836b154b75c2fbc73d3eb12af7ef0dcf19aa17ac /device
parent782fd71235610567ae475fa1011795c361258c3c (diff)
downloadchromium_src-239d6629e3c9b2f582a1d7086430d1e432ca5867.zip
chromium_src-239d6629e3c9b2f582a1d7086430d1e432ca5867.tar.gz
chromium_src-239d6629e3c9b2f582a1d7086430d1e432ca5867.tar.bz2
Make default bluetooth adaptor name more robust w.r.t. CrOS device type.
This CL uses a new utility introduced in https://codereview.chromium.org/1204783005. It may make sense to push the device-type-to-ascii conversion up to /chromeos, since it is also done in https://codereview.chromium.org/1203263003. Review URL: https://codereview.chromium.org/1204093003 Cr-Commit-Position: refs/heads/master@{#338781}
Diffstat (limited to 'device')
-rw-r--r--device/bluetooth/bluetooth_adapter_chromeos.cc26
1 files changed, 18 insertions, 8 deletions
diff --git a/device/bluetooth/bluetooth_adapter_chromeos.cc b/device/bluetooth/bluetooth_adapter_chromeos.cc
index 9ba2cbd..345bdeb 100644
--- a/device/bluetooth/bluetooth_adapter_chromeos.cc
+++ b/device/bluetooth/bluetooth_adapter_chromeos.cc
@@ -12,7 +12,6 @@
#include "base/metrics/histogram.h"
#include "base/sequenced_task_runner.h"
#include "base/single_thread_task_runner.h"
-#include "base/sys_info.h"
#include "base/thread_task_runner_handle.h"
#include "chromeos/dbus/bluetooth_adapter_client.h"
#include "chromeos/dbus/bluetooth_agent_manager_client.h"
@@ -20,6 +19,7 @@
#include "chromeos/dbus/bluetooth_device_client.h"
#include "chromeos/dbus/bluetooth_input_client.h"
#include "chromeos/dbus/dbus_thread_manager.h"
+#include "chromeos/system/devicetype.h"
#include "device/bluetooth/bluetooth_adapter_profile_chromeos.h"
#include "device/bluetooth/bluetooth_advertisement_chromeos.h"
#include "device/bluetooth/bluetooth_audio_sink_chromeos.h"
@@ -755,14 +755,24 @@ void BluetoothAdapterChromeOS::SetAdapter(const dbus::ObjectPath& object_path) {
void BluetoothAdapterChromeOS::SetDefaultAdapterName() {
DCHECK(IsPresent());
- std::string board = base::SysInfo::GetLsbReleaseBoard();
+
std::string alias;
- if (board.substr(0, 6) == "stumpy") {
- alias = "Chromebox";
- } else if (board.substr(0, 4) == "link") {
- alias = "Chromebook Pixel";
- } else {
- alias = "Chromebook";
+ switch (chromeos::GetDeviceType()) {
+ case DeviceType::kChromebase:
+ alias = "Chromebase";
+ break;
+ case DeviceType::kChromebit:
+ alias = "Chromebit";
+ break;
+ case DeviceType::kChromebook:
+ alias = "Chromebook";
+ break;
+ case DeviceType::kChromebox:
+ alias = "Chromebox";
+ break;
+ case DeviceType::kUnknown:
+ alias = "Chromebook";
+ break;
}
SetName(alias, base::Bind(&base::DoNothing), base::Bind(&base::DoNothing));