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

Side by Side Diff: chrome/browser/extensions/api/bluetooth/bluetooth_extension_function.cc

Issue 11743024: Implemented BluetoothExtensionFunction. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge Created 7 years, 11 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/extensions/api/bluetooth/bluetooth_extension_function.h "
6
7 #include "base/memory/ref_counted.h"
8 #include "chrome/browser/extensions/api/bluetooth/bluetooth_api.h"
9 #include "chrome/browser/extensions/api/bluetooth/bluetooth_event_router.h"
10 #include "chrome/browser/profiles/profile.h"
11 #include "device/bluetooth/bluetooth_adapter.h"
12 #include "device/bluetooth/bluetooth_adapter_factory.h"
13
14 namespace {
15
16 const char kPlatformNotSupported[] =
17 "This operation is not supported on your platform";
18
19 scoped_refptr<device::BluetoothAdapter> GetAdapter(Profile* profile) {
20 extensions::ExtensionBluetoothEventRouter* event_router =
21 extensions::BluetoothAPI::Get(profile)->bluetooth_event_router();
22 return event_router->GetAdapter();
23 }
24
25 } // namespace
26
27 namespace extensions {
28
29 namespace api {
30
31 BluetoothExtensionFunction::BluetoothExtensionFunction() {
32 }
33
34 BluetoothExtensionFunction::~BluetoothExtensionFunction() {
35 }
36
37 bool BluetoothExtensionFunction::RunImpl() {
38 scoped_refptr<device::BluetoothAdapter> adapter = GetAdapter(profile());
39 if (!adapter) {
40 SetError(kPlatformNotSupported);
41 return false;
42 }
43 DoWork(adapter);
44 return true;
45 }
46
47 } // namespace api
48
49 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/bluetooth/bluetooth_extension_function.h ('k') | chrome/chrome_browser_extensions.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698