[Bluetooth] Moved checking privileges to JS layer.
authorTomasz Marciniak <t.marciniak@samsung.com>
Thu, 30 Apr 2015 12:21:42 +0000 (14:21 +0200)
committerPawel Andruszkiewicz <p.andruszkie@samsung.com>
Mon, 4 May 2015 07:17:42 +0000 (16:17 +0900)
[Verification] Code compiles without errors.

Change-Id: I13cb9c82ee862e869cd079ba85eef23fd1ecda44
Signed-off-by: Tomasz Marciniak <t.marciniak@samsung.com>
src/bluetooth/bluetooth.gyp
src/bluetooth/bluetooth_adapter.cc
src/bluetooth/bluetooth_api.js
src/bluetooth/bluetooth_device.cc
src/bluetooth/bluetooth_health_application.cc
src/bluetooth/bluetooth_health_channel.cc
src/bluetooth/bluetooth_health_profile_handler.cc
src/bluetooth/bluetooth_privilege.cc [deleted file]
src/bluetooth/bluetooth_privilege.h [deleted file]
src/bluetooth/bluetooth_service_handler.cc
src/bluetooth/bluetooth_socket.cc

index 3ce1d82a1e6646456d0e2044f1ae1550c5800349..4ce4d8d6370617a9cc66c3021bf1edf8e59ec954 100644 (file)
@@ -27,8 +27,6 @@
         'bluetooth_health_profile_handler.h',
         'bluetooth_instance.cc',
         'bluetooth_instance.h',
-        'bluetooth_privilege.cc',
-        'bluetooth_privilege.h',
         'bluetooth_service_handler.cc',
         'bluetooth_service_handler.h',
         'bluetooth_socket.cc',
index d9596239e7ea22b74f677f9368cd4785aeb3ad9f..ca8a0f469548ccf5c4fc2f00271fcb5e45c9eed3 100644 (file)
@@ -32,7 +32,6 @@
 #include "bluetooth/bluetooth_class.h"
 #include "bluetooth/bluetooth_device.h"
 #include "bluetooth/bluetooth_instance.h"
-#include "bluetooth/bluetooth_privilege.h"
 #include "bluetooth/bluetooth_socket.h"
 #include "bluetooth/bluetooth_util.h"
 
@@ -440,8 +439,6 @@ bool BluetoothAdapter::is_initialized() const {
 void BluetoothAdapter::SetName(const picojson::value& data, picojson::object& out) {
   LoggerD("Entered");
 
-  CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothAdmin, &out);
-
   const auto callback_handle = util::GetAsyncCallbackHandle(data);
   const auto& args = util::GetArguments(data);
   const auto name = FromJson<std::string>(args, "name");
@@ -495,8 +492,6 @@ void BluetoothAdapter::SetName(const picojson::value& data, picojson::object& ou
 void BluetoothAdapter::SetPowered(const picojson::value& data, picojson::object& out) {
   LoggerD("Entered");
 
-  CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothAdmin, &out);
-
   const auto callback_handle = util::GetAsyncCallbackHandle(data);
   const auto& args = util::GetArguments(data);
   const auto new_powered = FromJson<bool>(args, "powered");
@@ -532,8 +527,6 @@ void BluetoothAdapter::SetPowered(const picojson::value& data, picojson::object&
 void BluetoothAdapter::SetVisible(const picojson::value& data, picojson::object& out) {
   LoggerD("Entered");
 
-  CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothManager, &out);
-
   const auto callback_handle = util::GetAsyncCallbackHandle(data);
   const auto& args = util::GetArguments(data);
   const auto visible = FromJson<bool>(args, "visible");
@@ -605,8 +598,6 @@ void BluetoothAdapter::SetVisible(const picojson::value& data, picojson::object&
 void BluetoothAdapter::DiscoverDevices(const picojson::value& /* data */, picojson::object& out) {
   LoggerD("Entered");
 
-  CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothGap, &out);
-
   PlatformResult result = PlatformResult(ErrorCode::NO_ERROR);
 
   if (!is_initialized_) {
@@ -639,8 +630,6 @@ void BluetoothAdapter::DiscoverDevices(const picojson::value& /* data */, picojs
 void BluetoothAdapter::StopDiscovery(const picojson::value& data, picojson::object& out) {
   LoggerD("Entered");
 
-  CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothGap, &out);
-
   const auto callback_handle = util::GetAsyncCallbackHandle(data);
 
   PlatformResult result = PlatformResult(ErrorCode::NO_ERROR);
@@ -687,8 +676,6 @@ void BluetoothAdapter::StopDiscovery(const picojson::value& data, picojson::obje
 void BluetoothAdapter::GetKnownDevices(const picojson::value& data, picojson::object& out) {
   LoggerD("Entered");
 
-  CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothGap, &out);
-
   const auto callback_handle = util::GetAsyncCallbackHandle(data);
 
   auto get_known_devices = [this](const std::shared_ptr<picojson::value>& response) -> void {
@@ -736,8 +723,6 @@ void BluetoothAdapter::GetKnownDevices(const picojson::value& data, picojson::ob
 void BluetoothAdapter::GetDevice(const picojson::value& data, picojson::object&  out) {
   LoggerD("Entered");
 
-  CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothGap, &out);
-
   const auto callback_handle = util::GetAsyncCallbackHandle(data);
   const auto& args = util::GetArguments(data);
 
@@ -836,8 +821,6 @@ class BondingHandler {
 void BluetoothAdapter::CreateBonding(const picojson::value& data, picojson::object& out) {
   LoggerD("Entered");
 
-  CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothGap, &out);
-
   const auto callback_handle = util::GetAsyncCallbackHandle(data);
   const auto& args = util::GetArguments(data);
 
@@ -942,8 +925,6 @@ void BluetoothAdapter::DestroyBonding(const picojson::value& data, picojson::obj
 {
   LoggerD("Entered");
 
-  CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothGap, &out);
-
   const auto callback_handle = util::GetAsyncCallbackHandle(data);
   const auto& args = util::GetArguments(data);
 
@@ -1042,8 +1023,6 @@ void BluetoothAdapter::DestroyBonding(const picojson::value& data, picojson::obj
 void BluetoothAdapter::RegisterRFCOMMServiceByUUID(const picojson::value& data, picojson::object& out) {
   LoggerD("Entered");
 
-  CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothSpp, &out);
-
   const auto callback_handle = util::GetAsyncCallbackHandle(data);
   const auto& args = util::GetArguments(data);
 
index eb0c617bb7ce75b514595a58cebbfef83384365b..84a3a3eec06b9e9c839fc6e7491014f27d36895f 100644 (file)
@@ -7,6 +7,7 @@
 var T = xwalk.utils.type;
 var Converter = xwalk.utils.converter;
 var AV = xwalk.utils.validator;
+var Privilege = xwalk.utils.privilege;
 
 var native = new xwalk.utils.NativeManager(extension);
 
@@ -149,12 +150,9 @@ var BluetoothClass = function(data) {
     });
 };
 
-var _PRIVILEGE_BLUETOOTH_GAP = 'http://tizen.org/privilege/bluetooth.gap';
-
 BluetoothClass.prototype.hasService = function() {
     console.log('Entered BluetoothClass.hasService()');
-
-    xwalk.utils.checkPrivilegeAccess(_PRIVILEGE_BLUETOOTH_GAP);
+    xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_GAP);
 
     var args = AV.validateMethod(arguments, [
         {
@@ -234,6 +232,7 @@ var BluetoothSocket = function(data) {
 
 BluetoothSocket.prototype.writeData = function() {
     console.log('Entered BluetoothSocket.writeData()');
+    xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_SPP);
 
     var args = AV.validateMethod(arguments, [
         {
@@ -259,6 +258,7 @@ BluetoothSocket.prototype.writeData = function() {
 
 BluetoothSocket.prototype.readData = function() {
     console.log('Entered BluetoothSocket.readData()');
+    xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_SPP);
 
     var callArgs = {
         id : this._id
@@ -275,6 +275,7 @@ BluetoothSocket.prototype.readData = function() {
 
 BluetoothSocket.prototype.close = function() {
     console.log('Entered BluetoothSocket.close()');
+    xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_SPP);
 
     if (_BLUETOOTH_SOCKET_STATE_CLOSED !== this.state) {
         var callArgs = {
@@ -358,6 +359,7 @@ var BluetoothDevice = function(data) {
 
 BluetoothDevice.prototype.connectToServiceByUUID = function() {
     console.log('Entered BluetoothDevice.connectToServiceByUUID()');
+    xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_SPP);
 
     var args = AV.validateMethod(arguments, [
         {
@@ -459,6 +461,8 @@ var BluetoothServiceHandler = function(data) {
 
 BluetoothServiceHandler.prototype.unregister = function() {
     console.log('Entered BluetoothServiceHandler.unregister()');
+    xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_SPP);
+
     var args = AV.validateMethod(arguments, [
         {
             name : 'successCallback',
@@ -554,6 +558,8 @@ var BluetoothHealthApplication = function(data) {
 
 BluetoothHealthApplication.prototype.unregister = function() {
     console.log('Entered BluetoothHealthApplication.unregister()');
+    xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_HEALTH);
+
     var args = AV.validateMethod(arguments, [
         {
             name : 'successCallback',
@@ -610,6 +616,7 @@ BluetoothHealthProfileHandler.prototype.constructor = BluetoothProfileHandler;
 
 BluetoothHealthProfileHandler.prototype.registerSinkApplication = function() {
     console.log('Entered BluetoothHealthProfileHandler.registerSinkApplication()');
+    xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_HEALTH);
 
     var args = AV.validateMethod(arguments, [
         {
@@ -652,6 +659,7 @@ BluetoothHealthProfileHandler.prototype.registerSinkApplication = function() {
 
 BluetoothHealthProfileHandler.prototype.connectToSource = function() {
     console.log('Entered BluetoothHealthProfileHandler.connectToSource()');
+    xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_HEALTH);
 
     var args = AV.validateMethod(arguments, [
         {
@@ -718,6 +726,7 @@ var BluetoothHealthChannel = function(data) {
 
 BluetoothHealthChannel.prototype.close = function() {
     console.log('Entered BluetoothHealthChannel.close()');
+    xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_HEALTH);
 
     if (this.isConnected) {
         var callArgs = {
@@ -737,6 +746,7 @@ BluetoothHealthChannel.prototype.close = function() {
 
 BluetoothHealthChannel.prototype.sendData = function() {
     console.log('Entered BluetoothHealthChannel.sendData()');
+    xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_HEALTH);
 
     var args = AV.validateMethod(arguments, [
         {
@@ -785,10 +795,10 @@ function _BluetoothHealthChannelChangeCallback(event) {
     }
 }
 
-var _PRIVILEGE_BLUETOOTH_HEALTH = 'http://tizen.org/privilege/bluetooth.health';
-
 BluetoothHealthChannel.prototype.setListener = function() {
     console.log('Entered BluetoothHealthChannel.setListener()');
+    xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_HEALTH);
+
     var args = AV.validateMethod(arguments, [
         {
             name : 'changeCallback',
@@ -797,8 +807,6 @@ BluetoothHealthChannel.prototype.setListener = function() {
         }
     ]);
 
-    xwalk.utils.checkPrivilegeAccess(_PRIVILEGE_BLUETOOTH_HEALTH);
-
     if (T.isEmptyObject(_healthListeners)) {
         native.addListener('BluetoothHealthChannelChangeCallback',
                 _BluetoothHealthChannelChangeCallback);
@@ -808,8 +816,7 @@ BluetoothHealthChannel.prototype.setListener = function() {
 
 BluetoothHealthChannel.prototype.unsetListener  = function() {
     console.log('Entered BluetoothHealthChannel.unsetListener ()');
-
-    xwalk.utils.checkPrivilegeAccess(_PRIVILEGE_BLUETOOTH_HEALTH);
+    xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_HEALTH);
 
     delete _healthListeners[this._id];
 
@@ -887,6 +894,8 @@ var BluetoothAdapter = function() {
 
 BluetoothAdapter.prototype.setName = function() {
     console.log('Entered BluetoothAdapter.setName()');
+    xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_ADMIN);
+
     var args = AV.validateMethod(arguments, [
         {
             name : 'name',
@@ -925,6 +934,8 @@ BluetoothAdapter.prototype.setName = function() {
 
 BluetoothAdapter.prototype.setPowered = function() {
     console.log('Entered BluetoothAdapter.setPowered()');
+    xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_ADMIN);
+
     var args = AV.validateMethod(arguments, [
         {
             name : 'powered',
@@ -963,6 +974,8 @@ BluetoothAdapter.prototype.setPowered = function() {
 
 BluetoothAdapter.prototype.setVisible = function() {
     console.log('Entered BluetoothAdapter.setVisible()');
+    xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTHMANAGER);
+
     var args = AV.validateMethod(arguments, [
         {
             name : 'visible',
@@ -1120,6 +1133,8 @@ function _BluetoothDiscoverDevicesErrorCallback(event) {
 
 BluetoothAdapter.prototype.discoverDevices = function() {
     console.log('Entered BluetoothAdapter.discoverDevices()');
+    xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_GAP);
+
     var args = AV.validateMethod(arguments, [
         {
             name : 'successCallback',
@@ -1154,6 +1169,8 @@ BluetoothAdapter.prototype.discoverDevices = function() {
 
 BluetoothAdapter.prototype.stopDiscovery = function() {
     console.log('Entered BluetoothAdapter.stopDiscovery()');
+    xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_GAP);
+
     var args = AV.validateMethod(arguments, [
         {
             name : 'successCallback',
@@ -1184,6 +1201,8 @@ BluetoothAdapter.prototype.stopDiscovery = function() {
 
 BluetoothAdapter.prototype.getKnownDevices = function() {
     console.log('Entered BluetoothAdapter.getKnownDevices()');
+    xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_GAP);
+
     var args = AV.validateMethod(arguments, [
         {
             name : 'successCallback',
@@ -1217,6 +1236,8 @@ BluetoothAdapter.prototype.getKnownDevices = function() {
 
 BluetoothAdapter.prototype.getDevice = function() {
     console.log('Entered BluetoothAdapter.getDevice()');
+    xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_GAP);
+
     var args = AV.validateMethod(arguments, [
         {
             name : 'address',
@@ -1249,6 +1270,8 @@ BluetoothAdapter.prototype.getDevice = function() {
 
 BluetoothAdapter.prototype.createBonding = function() {
     console.log('Entered BluetoothAdapter.createBonding()');
+    xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_GAP);
+
     var args = AV.validateMethod(arguments, [
         {
             name : 'address',
@@ -1287,6 +1310,8 @@ BluetoothAdapter.prototype.createBonding = function() {
 
 BluetoothAdapter.prototype.destroyBonding = function() {
     console.log('Entered BluetoothAdapter.destroyBonding()');
+    xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_GAP);
+
     var args = AV.validateMethod(arguments, [
         {
             name : 'address',
@@ -1325,6 +1350,8 @@ BluetoothAdapter.prototype.destroyBonding = function() {
 
 BluetoothAdapter.prototype.registerRFCOMMServiceByUUID = function() {
     console.log('Entered BluetoothAdapter.registerRFCOMMServiceByUUID()');
+    xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_SPP);
+
     var args = AV.validateMethod(arguments, [
         {
             name : 'uuid',
@@ -1418,7 +1445,7 @@ var BluetoothManager = function() {
 BluetoothManager.prototype.getDefaultAdapter = function() {
     console.log('Entered BluetoothManager.getDefaultAdapter()');
 
-    xwalk.utils.checkPrivilegeAccess(_PRIVILEGE_BLUETOOTH_GAP);
+    xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_GAP);
 
     return new BluetoothAdapter();
 };
index f9166fff86ef27b203d05593d170b602f0b7e78c..999e839e389082a7c2c292e6e8aebf195d50c710 100644 (file)
@@ -22,7 +22,6 @@
 
 #include "bluetooth_adapter.h"
 #include "bluetooth_class.h"
-#include "bluetooth_privilege.h"
 #include "bluetooth_util.h"
 
 namespace extension {
@@ -104,8 +103,6 @@ void BluetoothDevice::ToJson(bt_adapter_device_discovery_info_s *info, picojson:
 void BluetoothDevice::ConnectToServiceByUUID(const picojson::value& data, picojson::object& out) {
   LoggerD("Entered");
 
-  CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothSpp, &out);
-
   const auto& args = util::GetArguments(data);
 
   adapter_.ConnectToServiceByUUID(FromJson<std::string>(args, "address"),
index aec0358ffab9d5feb7d6ab04fb832af9cf775da5..d8144e0f6cbd10035a33a6a3197ec01db55cb596 100644 (file)
@@ -21,7 +21,6 @@
 #include "common/extension.h"
 
 #include "bluetooth_health_profile_handler.h"
-#include "bluetooth_privilege.h"
 #include "bluetooth_util.h"
 
 namespace extension {
@@ -43,8 +42,6 @@ BluetoothHealthApplication::BluetoothHealthApplication(
 void BluetoothHealthApplication::Unregister(const picojson::value& data, picojson::object& out) {
   LoggerD("Entered");
 
-  CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothHealth, &out);
-
   const auto& args = util::GetArguments(data);
 
   handler_.UnregisterSinkAppAsync(FromJson<std::string>(args, "id"),
index 0a9a236669740eaf4968ee633c232e695642d7e9..695ec551b5850183166de10114d7c6b4e481b317 100644 (file)
@@ -23,7 +23,6 @@
 #include "common/extension.h"
 
 #include "bluetooth_device.h"
-#include "bluetooth_privilege.h"
 #include "bluetooth_util.h"
 
 namespace extension {
@@ -43,8 +42,6 @@ const std::string kId = "_id";
 void BluetoothHealthChannel::Close(const picojson::value& data , picojson::object& out) {
   LoggerD("Entered");
 
-  CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothHealth, &out);
-
   const auto& args = util::GetArguments(data);
 
   unsigned int channel = common::stol(FromJson<std::string>(args, "channel"));
@@ -61,8 +58,6 @@ void BluetoothHealthChannel::Close(const picojson::value& data , picojson::objec
 void BluetoothHealthChannel::SendData(const picojson::value& data, picojson::object& out) {
   LoggerD("Entered");
 
-  CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothHealth, &out);
-
   const auto& args = util::GetArguments(data);
 
   unsigned int channel = common::stol(FromJson<std::string>(args, "channel"));
index e46d9c002cfc81883caa7d89b705438255b10193..ae1bd31c6c36c2e38c0d33ab688ab0f21f95edd6 100644 (file)
@@ -25,7 +25,6 @@
 #include "bluetooth/bluetooth_instance.h"
 #include "bluetooth/bluetooth_health_application.h"
 #include "bluetooth/bluetooth_health_channel.h"
-#include "bluetooth/bluetooth_privilege.h"
 #include "bluetooth/bluetooth_util.h"
 
 namespace extension {
@@ -226,8 +225,6 @@ void BluetoothHealthProfileHandler::OnDataReceived(unsigned int channel,
 void BluetoothHealthProfileHandler::RegisterSinkApp(const picojson::value& data, picojson::object& out) {
   LoggerD("Entered");
 
-  CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothHealth, &out);
-
   const auto& args = util::GetArguments(data);
   const auto data_type = static_cast<short>(FromJson<double>(args, "dataType"));
   const auto& name = FromJson<std::string>(args, "name");
@@ -287,8 +284,6 @@ void BluetoothHealthProfileHandler::RegisterSinkApp(const picojson::value& data,
 void BluetoothHealthProfileHandler::ConnectToSource(const picojson::value& data, picojson::object& out) {
   LoggerD("Entered");
 
-  CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothHealth, &out);
-
   const auto& args = util::GetArguments(data);
   const auto& address = FromJson<std::string>(args, "address");
   const auto& app_id = FromJson<std::string>(args, "appId");
diff --git a/src/bluetooth/bluetooth_privilege.cc b/src/bluetooth/bluetooth_privilege.cc
deleted file mode 100644 (file)
index 4f433e9..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- */
-
-#include "bluetooth_privilege.h"
-
-namespace extension {
-namespace bluetooth {
-
-namespace Privilege {
-const std::string kBluetoothAdmin = "http://tizen.org/privilege/bluetooth.admin";
-const std::string kBluetoothManager = "http://tizen.org/privilege/bluetoothmanager";
-const std::string kBluetoothGap = "http://tizen.org/privilege/bluetooth.gap";
-const std::string kBluetoothSpp = "http://tizen.org/privilege/bluetooth.spp";
-const std::string kBluetoothHealth = "http://tizen.org/privilege/bluetooth.health";
-} // namespace Privilege
-
-} // namespace bluetooth
-} // namespace extension
diff --git a/src/bluetooth/bluetooth_privilege.h b/src/bluetooth/bluetooth_privilege.h
deleted file mode 100644 (file)
index 13a87d6..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- */
-
-#ifndef BLUETOOTH_BLUETOOTH_PRIVILEGE_H_
-#define BLUETOOTH_BLUETOOTH_PRIVILEGE_H_
-
-#include <string>
-
-namespace extension {
-namespace bluetooth {
-
-namespace Privilege {
-
-extern const std::string kBluetoothAdmin;
-extern const std::string kBluetoothManager;
-extern const std::string kBluetoothGap;
-extern const std::string kBluetoothSpp;
-extern const std::string kBluetoothHealth;
-
-} // namespace Privilege
-
-} // namespace bluetooth
-} // namespace extension
-
-#endif // BLUETOOTH_BLUETOOTH_PRIVILEGE_H_
index 0f04c6a36e371a4337cc39e36941e343634f39fa..20ba473a9def440efd646fa659322c5a3cc2a267 100644 (file)
@@ -21,7 +21,6 @@
 #include "common/extension.h"
 
 #include "bluetooth_adapter.h"
-#include "bluetooth_privilege.h"
 #include "bluetooth_util.h"
 
 namespace extension {
@@ -36,8 +35,6 @@ BluetoothServiceHandler::BluetoothServiceHandler(BluetoothAdapter& adapter)
 void BluetoothServiceHandler::Unregister(const picojson::value& data, picojson::object& out) {
   LoggerD("Entered");
 
-  CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothSpp, &out);
-
   const auto& args = util::GetArguments(data);
 
   adapter_.UnregisterUUID(FromJson<std::string>(args, "uuid"),
index 3771f1e4dfeeafc7b94311c30166b515e5157764..9ed2a961af960b8f89c973d056d08dc856f02336 100644 (file)
@@ -24,7 +24,6 @@
 
 #include "bluetooth_adapter.h"
 #include "bluetooth_device.h"
-#include "bluetooth_privilege.h"
 #include "bluetooth_util.h"
 
 namespace extension {
@@ -50,8 +49,6 @@ BluetoothSocket::BluetoothSocket(BluetoothAdapter& adapter)
 void BluetoothSocket::WriteData(const picojson::value& data, picojson::object& out) {
   LoggerD("Enter");
 
-  CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothSpp, &out);
-
   const auto& args = util::GetArguments(data);
 
   int socket = common::stol(FromJson<std::string>(args, "id"));
@@ -76,8 +73,6 @@ void BluetoothSocket::WriteData(const picojson::value& data, picojson::object& o
 void BluetoothSocket::ReadData(const picojson::value& data, picojson::object& out) {
   LoggerD("Enter");
 
-  CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothSpp, &out);
-
   const auto& args = util::GetArguments(data);
 
   int socket = common::stol(FromJson<std::string>(args, "id"));
@@ -98,8 +93,6 @@ void BluetoothSocket::ReadData(const picojson::value& data, picojson::object& ou
 void BluetoothSocket::Close(const picojson::value& data, picojson::object& out) {
   LoggerD("Enter");
 
-  CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothSpp, &out);
-
   const auto& args = util::GetArguments(data);
 
   int socket = common::stol(FromJson<std::string>(args, "id"));