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.
5 #ifndef CONTENT_PUBLIC_BROWSER_BLUETOOTH_CHOOSER_H_
6 #define CONTENT_PUBLIC_BROWSER_BLUETOOTH_CHOOSER_H_
10 #include "base/callback.h"
11 #include "base/strings/string16.h"
12 #include "content/common/content_export.h"
16 // Represents a way to ask the user to select a Bluetooth device from a list of
18 class CONTENT_EXPORT BluetoothChooser
{
21 // The user cancelled the chooser instead of selecting a device.
23 // The user selected device |opt_device_id|.
26 // As the dialog implementations grow more user-visible buttons and knobs,
27 // we'll add enumerators here to support them.
30 // Chooser implementations are constructed with an |EventHandler| and report
31 // user interaction with the chooser through it. |opt_device_id| is an empty
32 // string except for Event::SELECTED.
34 // The EventHandler won't be called after the chooser object is destroyed.
36 // After the EventHandler is called with Event::CANCELLED or Event::SELECTED,
37 // it won't be called again, and users must not call any more BluetoothChooser
39 typedef base::Callback
<void(Event
, const std::string
& opt_device_id
)>
43 virtual ~BluetoothChooser();
45 // Lets the chooser tell the user the state of the Bluetooth adapter. This
46 // defaults to POWERED_ON.
47 enum class AdapterPresence
{ ABSENT
, POWERED_OFF
, POWERED_ON
};
48 virtual void SetAdapterPresence(AdapterPresence presence
) {}
50 // Lets the chooser tell the user whether discovery is happening. This
51 // defaults to DISCOVERING.
52 enum class DiscoveryState
{ FAILED_TO_START
, DISCOVERING
, IDLE
};
53 virtual void ShowDiscoveryState(DiscoveryState state
) {}
55 // Shows a new device in the chooser.
56 virtual void AddDevice(const std::string
& device_id
,
57 const base::string16
& device_name
) {}
59 // Tells the chooser that a device is no longer available. The chooser should
60 // not call DeviceSelected() for a device that's been removed.
61 virtual void RemoveDevice(const std::string
& device_id
) {}
64 } // namespace content
66 #endif // CONTENT_PUBLIC_BROWSER_BLUETOOTH_CHOOSER_H_