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

Side by Side Diff: extensions/browser/api/bluetooth/bluetooth_private_api.cc

Issue 420663003: Extensions: Move bluetooth APIs to extensions/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix android, gn Created 6 years, 3 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_private_api.h" 5 #include "extensions/browser/api/bluetooth/bluetooth_private_api.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "chrome/browser/extensions/api/bluetooth/bluetooth_api.h"
11 #include "chrome/browser/extensions/api/bluetooth/bluetooth_event_router.h"
12 #include "chrome/common/extensions/api/bluetooth_private.h"
13 #include "device/bluetooth/bluetooth_adapter.h" 10 #include "device/bluetooth/bluetooth_adapter.h"
14 #include "device/bluetooth/bluetooth_adapter_factory.h" 11 #include "device/bluetooth/bluetooth_adapter_factory.h"
12 #include "extensions/browser/api/bluetooth/bluetooth_api.h"
13 #include "extensions/browser/api/bluetooth/bluetooth_event_router.h"
14 #include "extensions/common/api/bluetooth_private.h"
15 15
16 namespace bt_private = extensions::api::bluetooth_private; 16 namespace bt_private = extensions::core_api::bluetooth_private;
17 17
18 namespace extensions { 18 namespace extensions {
19 19
20 static base::LazyInstance<BrowserContextKeyedAPIFactory<BluetoothPrivateAPI> > 20 static base::LazyInstance<BrowserContextKeyedAPIFactory<BluetoothPrivateAPI> >
21 g_factory = LAZY_INSTANCE_INITIALIZER; 21 g_factory = LAZY_INSTANCE_INITIALIZER;
22 22
23 // static 23 // static
24 BrowserContextKeyedAPIFactory<BluetoothPrivateAPI>* 24 BrowserContextKeyedAPIFactory<BluetoothPrivateAPI>*
25 BluetoothPrivateAPI::GetFactoryInstance() { 25 BluetoothPrivateAPI::GetFactoryInstance() {
26 return g_factory.Pointer(); 26 return g_factory.Pointer();
(...skipping 24 matching lines...) Expand all
51 void BluetoothPrivateAPI::OnListenerRemoved(const EventListenerInfo& details) { 51 void BluetoothPrivateAPI::OnListenerRemoved(const EventListenerInfo& details) {
52 // This function can be called multiple times for the same JS listener, for 52 // This function can be called multiple times for the same JS listener, for
53 // example, once for the addListener call and again if it is a lazy listener. 53 // example, once for the addListener call and again if it is a lazy listener.
54 if (!details.browser_context) 54 if (!details.browser_context)
55 return; 55 return;
56 56
57 BluetoothAPI::Get(browser_context_)->event_router()->RemovePairingDelegate( 57 BluetoothAPI::Get(browser_context_)->event_router()->RemovePairingDelegate(
58 details.extension_id); 58 details.extension_id);
59 } 59 }
60 60
61 namespace api { 61 namespace core_api {
62 62
63 namespace { 63 namespace {
64 64
65 const char kNameProperty[] = "name"; 65 const char kNameProperty[] = "name";
66 const char kPoweredProperty[] = "powered"; 66 const char kPoweredProperty[] = "powered";
67 const char kDiscoverableProperty[] = "discoverable"; 67 const char kDiscoverableProperty[] = "discoverable";
68 68
69 const char kSetAdapterPropertyError[] = "Error setting adapter properties: $1"; 69 const char kSetAdapterPropertyError[] = "Error setting adapter properties: $1";
70 70
71 const char kDeviceNotFoundError[] = 71 const char kDeviceNotFoundError[] =
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 break; 278 break;
279 default: 279 default:
280 NOTREACHED(); 280 NOTREACHED();
281 } 281 }
282 } 282 }
283 283
284 SendResponse(true); 284 SendResponse(true);
285 return true; 285 return true;
286 } 286 }
287 287
288 } // namespace api 288 } // namespace core_api
289 289
290 } // namespace extensions 290 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698