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

Side by Side Diff: content/browser/bluetooth/first_device_bluetooth_chooser.cc

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
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 #include "content/browser/bluetooth/first_device_bluetooth_chooser.h"
6
7 namespace content {
8
9 FirstDeviceBluetoothChooser::FirstDeviceBluetoothChooser(
10 const EventHandler& event_handler)
11 : event_handler_(event_handler) {}
12
13 FirstDeviceBluetoothChooser::~FirstDeviceBluetoothChooser() {}
14
15 void FirstDeviceBluetoothChooser::SetAdapterPresence(AdapterPresence presence) {
16 switch (presence) {
17 case AdapterPresence::ABSENT:
18 case AdapterPresence::POWERED_OFF:
19 // Without a user-visible dialog, if the adapter is off, there's no way to
20 // ask the user to turn it on again, so we should cancel.
21 event_handler_.Run(Event::CANCELLED, "");
22 break;
23 case AdapterPresence::POWERED_ON:
24 break;
25 }
26 }
27
28 void FirstDeviceBluetoothChooser::ShowDiscoveryState(DiscoveryState state) {
29 switch (state) {
30 case DiscoveryState::FAILED_TO_START:
31 case DiscoveryState::IDLE:
32 // Without a user-visible dialog, if discovery finishes without finding a
33 // device, we'll never find one, so we should cancel.
34 event_handler_.Run(Event::CANCELLED, "");
35 break;
36 case DiscoveryState::DISCOVERING:
37 break;
38 }
39 }
40
41 void FirstDeviceBluetoothChooser::AddDevice(const std::string& deviceId,
42 const base::string16& deviceName) {
43 event_handler_.Run(Event::SELECTED, deviceId);
44 }
45
46 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/bluetooth/first_device_bluetooth_chooser.h ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698