| 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 "chrome/browser/extensions/api/bluetooth/bluetooth_api.h" | 5 #include "chrome/browser/extensions/api/bluetooth/bluetooth_api.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 namespace GetProfiles = extensions::api::bluetooth::GetProfiles; | 71 namespace GetProfiles = extensions::api::bluetooth::GetProfiles; |
| 72 namespace GetServices = extensions::api::bluetooth::GetServices; | 72 namespace GetServices = extensions::api::bluetooth::GetServices; |
| 73 namespace Read = extensions::api::bluetooth::Read; | 73 namespace Read = extensions::api::bluetooth::Read; |
| 74 namespace RemoveProfile = extensions::api::bluetooth::RemoveProfile; | 74 namespace RemoveProfile = extensions::api::bluetooth::RemoveProfile; |
| 75 namespace SetOutOfBandPairingData = | 75 namespace SetOutOfBandPairingData = |
| 76 extensions::api::bluetooth::SetOutOfBandPairingData; | 76 extensions::api::bluetooth::SetOutOfBandPairingData; |
| 77 namespace Write = extensions::api::bluetooth::Write; | 77 namespace Write = extensions::api::bluetooth::Write; |
| 78 | 78 |
| 79 namespace extensions { | 79 namespace extensions { |
| 80 | 80 |
| 81 static base::LazyInstance<ProfileKeyedAPIFactory<BluetoothAPI> > g_factory = | 81 static base::LazyInstance<BrowserContextKeyedAPIFactory<BluetoothAPI> > |
| 82 LAZY_INSTANCE_INITIALIZER; | 82 g_factory = LAZY_INSTANCE_INITIALIZER; |
| 83 | 83 |
| 84 // static | 84 // static |
| 85 ProfileKeyedAPIFactory<BluetoothAPI>* BluetoothAPI::GetFactoryInstance() { | 85 BrowserContextKeyedAPIFactory<BluetoothAPI>* |
| 86 BluetoothAPI::GetFactoryInstance() { |
| 86 return g_factory.Pointer(); | 87 return g_factory.Pointer(); |
| 87 } | 88 } |
| 88 | 89 |
| 89 // static | 90 // static |
| 90 BluetoothAPI* BluetoothAPI::Get(BrowserContext* context) { | 91 BluetoothAPI* BluetoothAPI::Get(BrowserContext* context) { |
| 91 return GetFactoryInstance()->GetForProfile(context); | 92 return GetFactoryInstance()->Get(context); |
| 92 } | 93 } |
| 93 | 94 |
| 94 BluetoothAPI::BluetoothAPI(BrowserContext* context) | 95 BluetoothAPI::BluetoothAPI(BrowserContext* context) |
| 95 : browser_context_(context) { | 96 : browser_context_(context) { |
| 96 ExtensionSystem::Get(browser_context_)->event_router()->RegisterObserver( | 97 ExtensionSystem::Get(browser_context_)->event_router()->RegisterObserver( |
| 97 this, bluetooth::OnAdapterStateChanged::kEventName); | 98 this, bluetooth::OnAdapterStateChanged::kEventName); |
| 98 } | 99 } |
| 99 | 100 |
| 100 BluetoothAPI::~BluetoothAPI() { | 101 BluetoothAPI::~BluetoothAPI() { |
| 101 } | 102 } |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 adapter->StopDiscovering( | 677 adapter->StopDiscovering( |
| 677 base::Bind(&BluetoothStopDiscoveryFunction::OnSuccessCallback, this), | 678 base::Bind(&BluetoothStopDiscoveryFunction::OnSuccessCallback, this), |
| 678 base::Bind(&BluetoothStopDiscoveryFunction::OnErrorCallback, this)); | 679 base::Bind(&BluetoothStopDiscoveryFunction::OnErrorCallback, this)); |
| 679 } | 680 } |
| 680 | 681 |
| 681 return true; | 682 return true; |
| 682 } | 683 } |
| 683 | 684 |
| 684 } // namespace api | 685 } // namespace api |
| 685 } // namespace extensions | 686 } // namespace extensions |
| OLD | NEW |