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

Side by Side Diff: extensions/browser/api/bluetooth/bluetooth_event_router.h

Issue 1083163002: Expose SetDiscoveryFilter from BluetoothEventRouter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Another windows build fix Created 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef EXTENSIONS_BROWSER_API_BLUETOOTH_BLUETOOTH_EVENT_ROUTER_H_ 5 #ifndef EXTENSIONS_BROWSER_API_BLUETOOTH_BLUETOOTH_EVENT_ROUTER_H_
6 #define EXTENSIONS_BROWSER_API_BLUETOOTH_BLUETOOTH_EVENT_ROUTER_H_ 6 #define EXTENSIONS_BROWSER_API_BLUETOOTH_BLUETOOTH_EVENT_ROUTER_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 // Requests that the active discovery session that belongs to the extension 61 // Requests that the active discovery session that belongs to the extension
62 // with id |extension_id| be terminated. |callback| is called, if the session 62 // with id |extension_id| be terminated. |callback| is called, if the session
63 // successfully ended. |error_callback| is called, if the adapter failed to 63 // successfully ended. |error_callback| is called, if the adapter failed to
64 // terminate the session or if no active discovery session exists for the 64 // terminate the session or if no active discovery session exists for the
65 // extension. 65 // extension.
66 void StopDiscoverySession(device::BluetoothAdapter* adapter, 66 void StopDiscoverySession(device::BluetoothAdapter* adapter,
67 const std::string& extension_id, 67 const std::string& extension_id,
68 const base::Closure& callback, 68 const base::Closure& callback,
69 const base::Closure& error_callback); 69 const base::Closure& error_callback);
70 70
71 // Requests that the filter associated with discovery session that belongs
72 // to the extension with id |extension_id| be set to |discovery_filter|.
73 // Callback is called, if the filter was successfully updated.
74 // |error_callback| is called, if filter update failed.
75 void SetDiscoveryFilter(
76 scoped_ptr<device::BluetoothDiscoveryFilter> discovery_filter,
77 device::BluetoothAdapter* adapter,
78 const std::string& extension_id,
79 const base::Closure& callback,
80 const base::Closure& error_callback);
81
71 // Called when a bluetooth event listener is added. 82 // Called when a bluetooth event listener is added.
72 void OnListenerAdded(); 83 void OnListenerAdded();
73 84
74 // Called when a bluetooth event listener is removed. 85 // Called when a bluetooth event listener is removed.
75 void OnListenerRemoved(); 86 void OnListenerRemoved();
76 87
77 // Adds a pairing delegate for an extension. 88 // Adds a pairing delegate for an extension.
78 void AddPairingDelegate(const std::string& extension_id); 89 void AddPairingDelegate(const std::string& extension_id);
79 90
80 // Removes the pairing delegate for an extension. 91 // Removes the pairing delegate for an extension.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 void DispatchAdapterStateEvent(); 137 void DispatchAdapterStateEvent();
127 void DispatchDeviceEvent(const std::string& event_name, 138 void DispatchDeviceEvent(const std::string& event_name,
128 device::BluetoothDevice* device); 139 device::BluetoothDevice* device);
129 void CleanUpForExtension(const std::string& extension_id); 140 void CleanUpForExtension(const std::string& extension_id);
130 void CleanUpAllExtensions(); 141 void CleanUpAllExtensions();
131 void OnStartDiscoverySession( 142 void OnStartDiscoverySession(
132 const std::string& extension_id, 143 const std::string& extension_id,
133 const base::Closure& callback, 144 const base::Closure& callback,
134 scoped_ptr<device::BluetoothDiscoverySession> discovery_session); 145 scoped_ptr<device::BluetoothDiscoverySession> discovery_session);
135 146
147 void OnSetDiscoveryFilter(const std::string& extension_id,
148 const base::Closure& callback);
149
136 content::BrowserContext* browser_context_; 150 content::BrowserContext* browser_context_;
137 scoped_refptr<device::BluetoothAdapter> adapter_; 151 scoped_refptr<device::BluetoothAdapter> adapter_;
138 152
139 int num_event_listeners_; 153 int num_event_listeners_;
140 154
141 // A map that maps extension ids to BluetoothDiscoverySession pointers. 155 // A map that maps extension ids to BluetoothDiscoverySession pointers.
142 typedef std::map<std::string, device::BluetoothDiscoverySession*> 156 typedef std::map<std::string, device::BluetoothDiscoverySession*>
143 DiscoverySessionMap; 157 DiscoverySessionMap;
144 DiscoverySessionMap discovery_session_map_; 158 DiscoverySessionMap discovery_session_map_;
145 159
160 typedef std::map<std::string, device::BluetoothDiscoveryFilter*>
161 PreSetFilterMap;
162
163 // Maps an extension id to it's pre-set discovery filter.
164 PreSetFilterMap pre_set_filter_map_;
165
146 // Maps an extension id to its pairing delegate. 166 // Maps an extension id to its pairing delegate.
147 typedef std::map<std::string, BluetoothApiPairingDelegate*> 167 typedef std::map<std::string, BluetoothApiPairingDelegate*>
148 PairingDelegateMap; 168 PairingDelegateMap;
149 PairingDelegateMap pairing_delegate_map_; 169 PairingDelegateMap pairing_delegate_map_;
150 170
151 content::NotificationRegistrar registrar_; 171 content::NotificationRegistrar registrar_;
152 172
153 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> 173 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
154 extension_registry_observer_; 174 extension_registry_observer_;
155 175
156 base::WeakPtrFactory<BluetoothEventRouter> weak_ptr_factory_; 176 base::WeakPtrFactory<BluetoothEventRouter> weak_ptr_factory_;
157 177
158 DISALLOW_COPY_AND_ASSIGN(BluetoothEventRouter); 178 DISALLOW_COPY_AND_ASSIGN(BluetoothEventRouter);
159 }; 179 };
160 180
161 } // namespace extensions 181 } // namespace extensions
162 182
163 #endif // EXTENSIONS_BROWSER_API_BLUETOOTH_BLUETOOTH_EVENT_ROUTER_H_ 183 #endif // EXTENSIONS_BROWSER_API_BLUETOOTH_BLUETOOTH_EVENT_ROUTER_H_
OLDNEW
« no previous file with comments | « device/bluetooth/test/mock_bluetooth_adapter.cc ('k') | extensions/browser/api/bluetooth/bluetooth_event_router.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698