Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: content/public/browser/bluetooth_chooser.h

Issue 1286063002: Add a path for content/ to open and control a Bluetooth chooser dialog. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
Patch Set: Fix asvitkine's comments. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 #ifndef CONTENT_PUBLIC_BROWSER_BLUETOOTH_CHOOSER_H_
6 #define CONTENT_PUBLIC_BROWSER_BLUETOOTH_CHOOSER_H_
7
8 #include <string>
9
10 #include "base/callback.h"
11 #include "base/strings/string16.h"
12 #include "content/common/content_export.h"
13
14 namespace content {
15
16 // Represents a way to ask the user to select a Bluetooth device from a list of
17 // options.
18 class CONTENT_EXPORT BluetoothChooser {
19 public:
20 enum class Event {
21 // The user cancelled the chooser instead of selecting a device.
22 CANCELLED,
23 // The user selected device |opt_device_id|.
24 SELECTED,
25
26 // As the dialog implementations grow more user-visible buttons and knobs,
27 // we'll add enumerators here to support them.
28 };
29
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.
33 //
34 // The EventHandler won't be called after the chooser object is destroyed.
35 //
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
38 // methods.
39 typedef base::Callback<void(Event, const std::string& opt_device_id)>
40 EventHandler;
41
42 // |observer| must outlive |this|. |chooser_id| is propagated to the Observer
jam 2015/08/25 23:45:50 nit: no more observer
Jeffrey Yasskin 2015/08/26 00:19:01 Whoops, thanks.
43 // methods.
44 BluetoothChooser() {}
45 virtual ~BluetoothChooser();
46
47 // Lets the chooser tell the user the state of the Bluetooth adapter. This
48 // defaults to POWERED_ON.
49 enum class AdapterPresence { ABSENT, POWERED_OFF, POWERED_ON };
50 virtual void SetAdapterPresence(AdapterPresence presence) {}
51
52 // Lets the chooser tell the user whether discovery is happening. This
53 // defaults to DISCOVERING.
54 enum class DiscoveryState { FAILED_TO_START, DISCOVERING, IDLE };
55 virtual void ShowDiscoveryState(DiscoveryState state) {}
56
57 // Shows a new device in the chooser.
58 virtual void AddDevice(const std::string& device_id,
59 const base::string16& device_name) {}
60
61 // Tells the chooser that a device is no longer available. The chooser should
62 // not call DeviceSelected() for a device that's been removed.
63 virtual void RemoveDevice(const std::string& device_id) {}
64 };
65
66 } // namespace content
67
68 #endif // CONTENT_PUBLIC_BROWSER_BLUETOOTH_CHOOSER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698