OLD | NEW |
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 #include "extensions/browser/api/bluetooth/bluetooth_event_router.h" | 5 #include "extensions/browser/api/bluetooth/bluetooth_event_router.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 device::BluetoothAdapter* adapter, | 93 device::BluetoothAdapter* adapter, |
94 const std::string& extension_id, | 94 const std::string& extension_id, |
95 const base::Closure& callback, | 95 const base::Closure& callback, |
96 const base::Closure& error_callback) { | 96 const base::Closure& error_callback) { |
97 if (!adapter_.get() && IsBluetoothSupported()) { | 97 if (!adapter_.get() && IsBluetoothSupported()) { |
98 // If |adapter_| isn't set yet, call GetAdapter() which will synchronously | 98 // If |adapter_| isn't set yet, call GetAdapter() which will synchronously |
99 // invoke the callback (StartDiscoverySessionImpl). | 99 // invoke the callback (StartDiscoverySessionImpl). |
100 GetAdapter(base::Bind( | 100 GetAdapter(base::Bind( |
101 &IgnoreAdapterResultAndThen, | 101 &IgnoreAdapterResultAndThen, |
102 base::Bind(&BluetoothEventRouter::StartDiscoverySessionImpl, | 102 base::Bind(&BluetoothEventRouter::StartDiscoverySessionImpl, |
103 weak_ptr_factory_.GetWeakPtr(), make_scoped_refptr(adapter), | 103 weak_ptr_factory_.GetWeakPtr(), base::RetainedRef(adapter), |
104 extension_id, callback, error_callback))); | 104 extension_id, callback, error_callback))); |
105 return; | 105 return; |
106 } | 106 } |
107 StartDiscoverySessionImpl(adapter, extension_id, callback, error_callback); | 107 StartDiscoverySessionImpl(adapter, extension_id, callback, error_callback); |
108 } | 108 } |
109 | 109 |
110 void BluetoothEventRouter::StartDiscoverySessionImpl( | 110 void BluetoothEventRouter::StartDiscoverySessionImpl( |
111 device::BluetoothAdapter* adapter, | 111 device::BluetoothAdapter* adapter, |
112 const std::string& extension_id, | 112 const std::string& extension_id, |
113 const base::Closure& callback, | 113 const base::Closure& callback, |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 } | 467 } |
468 | 468 |
469 void BluetoothEventRouter::OnExtensionUnloaded( | 469 void BluetoothEventRouter::OnExtensionUnloaded( |
470 content::BrowserContext* browser_context, | 470 content::BrowserContext* browser_context, |
471 const Extension* extension, | 471 const Extension* extension, |
472 UnloadedExtensionInfo::Reason reason) { | 472 UnloadedExtensionInfo::Reason reason) { |
473 CleanUpForExtension(extension->id()); | 473 CleanUpForExtension(extension->id()); |
474 } | 474 } |
475 | 475 |
476 } // namespace extensions | 476 } // namespace extensions |
OLD | NEW |