OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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. |
| 4 |
| 5 #include "content/browser/bluetooth/first_device_bluetooth_chooser.h" |
| 6 |
| 7 namespace content { |
| 8 |
| 9 void FirstDeviceBluetoothChooser::SetAdapterPresence(AdapterPresence presence) { |
| 10 switch (presence) { |
| 11 case AdapterPresence::ABSENT: |
| 12 case AdapterPresence::POWERED_OFF: |
| 13 // Without a user-visible dialog, if the adapter is off, there's no way to |
| 14 // ask the user to turn it on again, so we should cancel. |
| 15 CallDialogCancelled(); |
| 16 break; |
| 17 case AdapterPresence::POWERED_ON: |
| 18 break; |
| 19 } |
| 20 } |
| 21 |
| 22 void FirstDeviceBluetoothChooser::ShowDiscovering(DiscoveryState state) { |
| 23 switch (state) { |
| 24 case DiscoveryState::FAILED_TO_START: |
| 25 case DiscoveryState::IDLE: |
| 26 // Without a user-visible dialog, if discovery finishes without finding a |
| 27 // device, we'll never find one, so we should cancel. |
| 28 CallDialogCancelled(); |
| 29 break; |
| 30 case DiscoveryState::DISCOVERING: |
| 31 break; |
| 32 } |
| 33 } |
| 34 |
| 35 void FirstDeviceBluetoothChooser::AddDevice(const std::string& deviceId, |
| 36 const base::string16& deviceName) { |
| 37 CallDeviceSelected(deviceId); |
| 38 } |
| 39 |
| 40 } // namespace content |
OLD | NEW |