| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "device/bluetooth/bluetooth_adapter_chromeos.h" | 5 #include "device/bluetooth/bluetooth_adapter_chromeos.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | |
| 11 #include "base/logging.h" | 10 #include "base/logging.h" |
| 12 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 13 #include "chromeos/chromeos_switches.h" | 12 #include "base/sys_info.h" |
| 14 #include "chromeos/dbus/bluetooth_adapter_client.h" | 13 #include "chromeos/dbus/bluetooth_adapter_client.h" |
| 15 #include "chromeos/dbus/bluetooth_device_client.h" | 14 #include "chromeos/dbus/bluetooth_device_client.h" |
| 16 #include "chromeos/dbus/bluetooth_input_client.h" | 15 #include "chromeos/dbus/bluetooth_input_client.h" |
| 17 #include "chromeos/dbus/dbus_thread_manager.h" | 16 #include "chromeos/dbus/dbus_thread_manager.h" |
| 18 #include "device/bluetooth/bluetooth_device.h" | 17 #include "device/bluetooth/bluetooth_device.h" |
| 19 #include "device/bluetooth/bluetooth_device_chromeos.h" | 18 #include "device/bluetooth/bluetooth_device_chromeos.h" |
| 20 | 19 |
| 21 using device::BluetoothAdapter; | 20 using device::BluetoothAdapter; |
| 22 using device::BluetoothDevice; | 21 using device::BluetoothDevice; |
| 23 | 22 |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 new BluetoothDeviceChromeOS(this, *iter); | 320 new BluetoothDeviceChromeOS(this, *iter); |
| 322 | 321 |
| 323 devices_[device_chromeos->GetAddress()] = device_chromeos; | 322 devices_[device_chromeos->GetAddress()] = device_chromeos; |
| 324 | 323 |
| 325 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_, | 324 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_, |
| 326 DeviceAdded(this, device_chromeos)); | 325 DeviceAdded(this, device_chromeos)); |
| 327 } | 326 } |
| 328 } | 327 } |
| 329 | 328 |
| 330 void BluetoothAdapterChromeOS::SetAdapterName() { | 329 void BluetoothAdapterChromeOS::SetAdapterName() { |
| 331 // Set a better name for the adapter than "BlueZ 5.x"; this isn't an ideal | 330 std::string board = base::SysInfo::GetLsbReleaseBoard(); |
| 332 // way to do this but it'll do for now. See http://crbug.com/126732 and | |
| 333 // http://crbug.com/126802. | |
| 334 std::string board; | |
| 335 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | |
| 336 if (command_line->HasSwitch(chromeos::switches::kChromeOSReleaseBoard)) { | |
| 337 board = command_line-> | |
| 338 GetSwitchValueASCII(chromeos::switches::kChromeOSReleaseBoard); | |
| 339 } | |
| 340 | |
| 341 std::string alias; | 331 std::string alias; |
| 342 if (board.substr(0, 6) == "stumpy") { | 332 if (board.substr(0, 6) == "stumpy") { |
| 343 alias = "Chromebox"; | 333 alias = "Chromebox"; |
| 344 } else if (board.substr(0, 4) == "link") { | 334 } else if (board.substr(0, 4) == "link") { |
| 345 alias = "Chromebook Pixel"; | 335 alias = "Chromebook Pixel"; |
| 346 } else { | 336 } else { |
| 347 alias = "Chromebook"; | 337 alias = "Chromebook"; |
| 348 } | 338 } |
| 349 | 339 |
| 350 DBusThreadManager::Get()->GetBluetoothAdapterClient()-> | 340 DBusThreadManager::Get()->GetBluetoothAdapterClient()-> |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 void BluetoothAdapterChromeOS::OnStopDiscoveryError( | 432 void BluetoothAdapterChromeOS::OnStopDiscoveryError( |
| 443 const ErrorCallback& error_callback, | 433 const ErrorCallback& error_callback, |
| 444 const std::string& error_name, | 434 const std::string& error_name, |
| 445 const std::string& error_message) { | 435 const std::string& error_message) { |
| 446 LOG(WARNING) << object_path_.value() << ": Failed to stop discovery: " | 436 LOG(WARNING) << object_path_.value() << ": Failed to stop discovery: " |
| 447 << error_name << ": " << error_message; | 437 << error_name << ": " << error_message; |
| 448 error_callback.Run(); | 438 error_callback.Run(); |
| 449 } | 439 } |
| 450 | 440 |
| 451 } // namespace chromeos | 441 } // namespace chromeos |
| OLD | NEW |