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

Side by Side Diff: device/bluetooth/bluetooth_profile_experimental_chromeos.h

Issue 14487002: Bluetooth: Profile support for Chrome OS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013 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 DEVICE_BLUETOOTH_BLUETOOTH_PROFILE_EXPERIMENTAL_CHROMEOS_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_PROFILE_EXPERIMENTAL_CHROMEOS_H_
7
8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "base/callback.h"
12 #include "base/memory/weak_ptr.h"
13 #include "chromeos/chromeos_export.h"
14 #include "chromeos/dbus/experimental_bluetooth_profile_service_provider.h"
15 #include "dbus/file_descriptor.h"
youngki 2013/04/25 14:34:34 We could remove this include and forward-declare F
keybuk 2013/04/25 17:16:41 Done.
16 #include "dbus/object_path.h"
17 #include "device/bluetooth/bluetooth_profile.h"
18
19 namespace chromeos {
20
21 class CHROMEOS_EXPORT BluetoothProfileExperimentalChromeOS
22 : public device::BluetoothProfile,
23 private ExperimentalBluetoothProfileServiceProvider::Delegate {
24 public:
25 // BluetoothProfile override.
26 virtual void Unregister() OVERRIDE;
27 virtual void SetConnectionCallback(const SocketCallback& callback) OVERRIDE;
28
29 private:
30 friend BluetoothProfile;
31
32 BluetoothProfileExperimentalChromeOS();
33 virtual ~BluetoothProfileExperimentalChromeOS();
34
35 // Called by BluetoothProfile::Register to initialize the profile object
36 // asynchronously. |uuid|, |options| and |callback| are the arguments to
37 // BluetoothProfile::Register.
38 void Init(const std::string& uuid,
39 const device::BluetoothProfile::Options& options,
40 const ProfileCallback& callback);
41
42 // ExperimentalBluetoothProfileServiceProvider::Delegate override.
43 virtual void Release() OVERRIDE;
44 virtual void NewConnection(
45 const dbus::ObjectPath& device_path,
46 dbus::FileDescriptor* fd,
47 const ExperimentalBluetoothProfileServiceProvider::Delegate::Options&
48 options,
49 const ConfirmationCallback& callback) OVERRIDE;
50 virtual void RequestDisconnection(
51 const dbus::ObjectPath& device_path,
52 const ConfirmationCallback& callback) OVERRIDE;
53 virtual void Cancel() OVERRIDE;
54
55 // Called by dbus:: on completion of the D-Bus method call to register the
56 // profile object.
57 void OnRegisterProfile(const ProfileCallback& callback);
58 void OnRegisterProfileError(const ProfileCallback& callback,
59 const std::string& error_name,
60 const std::string& error_message);
61
62 // Called by dbus:: on completion of the D-Bus method call to unregister
63 // the profile object.
64 void OnUnregisterProfile();
65 void OnUnregisterProfileError(const std::string& error_name,
66 const std::string& error_message);
67
68 // Object path of the local profile D-Bus object.
69 dbus::ObjectPath object_path_;
70
71 // Local profile D-Bus object used for receiving profile delegate methods
72 // from BlueZ.
73 scoped_ptr<ExperimentalBluetoothProfileServiceProvider> profile_;
74
75 // Callback used on both outgoing and incoming connections to pass the
76 // connected socket to profile object owner.
77 SocketCallback socket_callback_;
78
79 // Note: This should remain the last member so it'll be destroyed and
80 // invalidate its weak pointers before any other members are destroyed.
81 base::WeakPtrFactory<BluetoothProfileExperimentalChromeOS> weak_ptr_factory_;
82
83 DISALLOW_COPY_AND_ASSIGN(BluetoothProfileExperimentalChromeOS);
84 };
85
86 } // namespace chromeos
87
88 #endif // DEVICE_BLUETOOTH_BLUETOOTH_PROFILE_EXPERIMENTAL_CHROMEOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698