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

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 comment wrapping. 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
« no previous file with comments | « content/content_browser.gypi ('k') | content/public/browser/bluetooth_chooser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 BluetoothChooser() {}
43 virtual ~BluetoothChooser();
44
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) {}
49
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) {}
54
55 // Shows a new device in the chooser.
56 virtual void AddDevice(const std::string& device_id,
57 const base::string16& device_name) {}
58
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) {}
62 };
63
64 } // namespace content
65
66 #endif // CONTENT_PUBLIC_BROWSER_BLUETOOTH_CHOOSER_H_
OLDNEW
« no previous file with comments | « content/content_browser.gypi ('k') | content/public/browser/bluetooth_chooser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698