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

Unified Diff: chrome/browser/extensions/api/bluetooth/bluetooth_event_router.cc

Issue 284183012: Bluetooth: remove Profile API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/bluetooth/bluetooth_event_router.cc
diff --git a/chrome/browser/extensions/api/bluetooth/bluetooth_event_router.cc b/chrome/browser/extensions/api/bluetooth/bluetooth_event_router.cc
index 31a26c13e8b174b1a32614fb96229cc3c91c3acc..94b5ce2147a558f4d8d4ec5265a2b07385c37cc4 100644
--- a/chrome/browser/extensions/api/bluetooth/bluetooth_event_router.cc
+++ b/chrome/browser/extensions/api/bluetooth/bluetooth_event_router.cc
@@ -27,8 +27,6 @@
#include "device/bluetooth/bluetooth_adapter_factory.h"
#include "device/bluetooth/bluetooth_device.h"
#include "device/bluetooth/bluetooth_discovery_session.h"
-#include "device/bluetooth/bluetooth_profile.h"
-#include "device/bluetooth/bluetooth_socket.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_host.h"
@@ -37,12 +35,6 @@ namespace extensions {
namespace bluetooth = api::bluetooth;
namespace bt_private = api::bluetooth_private;
-// A struct storing a Bluetooth profile and the extension that added it.
-struct BluetoothEventRouter::ExtensionBluetoothProfileRecord {
- std::string extension_id;
- device::BluetoothProfile* profile;
-};
-
BluetoothEventRouter::BluetoothEventRouter(content::BrowserContext* context)
: browser_context_(context),
adapter_(NULL),
@@ -82,31 +74,6 @@ void BluetoothEventRouter::GetAdapter(
device::BluetoothAdapterFactory::GetAdapter(callback);
}
-void BluetoothEventRouter::AddProfile(
- const device::BluetoothUUID& uuid,
- const std::string& extension_id,
- device::BluetoothProfile* bluetooth_profile) {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
- DCHECK(!HasProfile(uuid));
- ExtensionBluetoothProfileRecord record = { extension_id, bluetooth_profile };
- bluetooth_profile_map_[uuid] = record;
-}
-
-void BluetoothEventRouter::RemoveProfile(const device::BluetoothUUID& uuid) {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
- BluetoothProfileMap::iterator iter = bluetooth_profile_map_.find(uuid);
- if (iter != bluetooth_profile_map_.end()) {
- device::BluetoothProfile* bluetooth_profile = iter->second.profile;
- bluetooth_profile_map_.erase(iter);
- bluetooth_profile->Unregister();
- }
-}
-
-bool BluetoothEventRouter::HasProfile(const device::BluetoothUUID& uuid) const {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
- return bluetooth_profile_map_.find(uuid) != bluetooth_profile_map_.end();
-}
-
void BluetoothEventRouter::StartDiscoverySession(
device::BluetoothAdapter* adapter,
const std::string& extension_id,
@@ -151,16 +118,6 @@ void BluetoothEventRouter::StopDiscoverySession(
session->Stop(callback, error_callback);
}
-device::BluetoothProfile* BluetoothEventRouter::GetProfile(
- const device::BluetoothUUID& uuid) const {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
- BluetoothProfileMap::const_iterator iter = bluetooth_profile_map_.find(uuid);
- if (iter != bluetooth_profile_map_.end())
- return iter->second.profile;
-
- return NULL;
-}
-
BluetoothApiPairingDelegate* BluetoothEventRouter::GetPairingDelegate(
const std::string& extension_id) {
return ContainsKey(pairing_delegate_map_, extension_id)
@@ -355,18 +312,6 @@ void BluetoothEventRouter::CleanUpForExtension(
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
RemovePairingDelegate(extension_id);
- // Remove all profiles added by the extension.
- BluetoothProfileMap::iterator profile_iter = bluetooth_profile_map_.begin();
- while (profile_iter != bluetooth_profile_map_.end()) {
- ExtensionBluetoothProfileRecord record = profile_iter->second;
- if (record.extension_id == extension_id) {
- bluetooth_profile_map_.erase(profile_iter++);
- record.profile->Unregister();
- } else {
- profile_iter++;
- }
- }
-
// Remove any discovery session initiated by the extension.
DiscoverySessionMap::iterator session_iter =
discovery_session_map_.find(extension_id);
@@ -377,13 +322,6 @@ void BluetoothEventRouter::CleanUpForExtension(
}
void BluetoothEventRouter::CleanUpAllExtensions() {
- for (BluetoothProfileMap::iterator it = bluetooth_profile_map_.begin();
- it != bluetooth_profile_map_.end();
- ++it) {
- it->second.profile->Unregister();
- }
- bluetooth_profile_map_.clear();
-
for (DiscoverySessionMap::iterator it = discovery_session_map_.begin();
it != discovery_session_map_.end();
++it) {

Powered by Google App Engine
This is Rietveld 408576698