diff options
-rw-r--r-- | chrome/app/generated_resources.grd | 6 | ||||
-rw-r--r-- | chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api.h | 4 | ||||
-rw-r--r-- | chrome/browser/extensions/browser_context_keyed_service_factories.cc | 10 | ||||
-rw-r--r-- | chrome/chrome_browser_extensions.gypi | 28 | ||||
-rw-r--r-- | chrome/chrome_common.gypi | 7 | ||||
-rw-r--r-- | chrome/chrome_tests.gypi | 8 | ||||
-rw-r--r-- | chrome/chrome_tests_unit.gypi | 2 | ||||
-rw-r--r-- | chrome/common/extensions/DEPS | 1 | ||||
-rw-r--r-- | chrome/common/extensions/api/manifest_types.json | 26 | ||||
-rw-r--r-- | chrome/common/extensions/api/schemas.gypi | 4 | ||||
-rw-r--r-- | chrome/common/extensions/chrome_manifest_handlers.cc | 2 | ||||
-rw-r--r-- | extensions/DEPS | 1 | ||||
-rw-r--r-- | extensions/browser/BUILD.gn | 29 | ||||
-rw-r--r-- | extensions/browser/DEPS | 1 | ||||
-rw-r--r-- | extensions/browser/api/api_resource_manager.h | 9 | ||||
-rw-r--r-- | extensions/browser/api/bluetooth/OWNERS (renamed from chrome/browser/extensions/api/bluetooth/OWNERS) | 0 | ||||
-rw-r--r-- | extensions/browser/api/bluetooth/bluetooth_api.cc (renamed from chrome/browser/extensions/api/bluetooth/bluetooth_api.cc) | 19 | ||||
-rw-r--r-- | extensions/browser/api/bluetooth/bluetooth_api.h (renamed from chrome/browser/extensions/api/bluetooth/bluetooth_api.h) | 14 | ||||
-rw-r--r-- | extensions/browser/api/bluetooth/bluetooth_api_pairing_delegate.cc (renamed from chrome/browser/extensions/api/bluetooth/bluetooth_api_pairing_delegate.cc) | 10 | ||||
-rw-r--r-- | extensions/browser/api/bluetooth/bluetooth_api_pairing_delegate.h (renamed from chrome/browser/extensions/api/bluetooth/bluetooth_api_pairing_delegate.h) | 10 | ||||
-rw-r--r-- | extensions/browser/api/bluetooth/bluetooth_api_utils.cc (renamed from chrome/browser/extensions/api/bluetooth/bluetooth_api_utils.cc) | 10 | ||||
-rw-r--r-- | extensions/browser/api/bluetooth/bluetooth_api_utils.h (renamed from chrome/browser/extensions/api/bluetooth/bluetooth_api_utils.h) | 12 | ||||
-rw-r--r-- | extensions/browser/api/bluetooth/bluetooth_apitest.cc (renamed from chrome/browser/extensions/api/bluetooth/bluetooth_apitest.cc) | 6 | ||||
-rw-r--r-- | extensions/browser/api/bluetooth/bluetooth_event_router.cc (renamed from chrome/browser/extensions/api/bluetooth/bluetooth_event_router.cc) | 18 | ||||
-rw-r--r-- | extensions/browser/api/bluetooth/bluetooth_event_router.h (renamed from chrome/browser/extensions/api/bluetooth/bluetooth_event_router.h) | 10 | ||||
-rw-r--r-- | extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc (renamed from chrome/browser/extensions/api/bluetooth/bluetooth_event_router_unittest.cc) | 7 | ||||
-rw-r--r-- | extensions/browser/api/bluetooth/bluetooth_extension_function.cc (renamed from chrome/browser/extensions/api/bluetooth/bluetooth_extension_function.cc) | 10 | ||||
-rw-r--r-- | extensions/browser/api/bluetooth/bluetooth_extension_function.h (renamed from chrome/browser/extensions/api/bluetooth/bluetooth_extension_function.h) | 10 | ||||
-rw-r--r-- | extensions/browser/api/bluetooth/bluetooth_private_api.cc (renamed from chrome/browser/extensions/api/bluetooth/bluetooth_private_api.cc) | 14 | ||||
-rw-r--r-- | extensions/browser/api/bluetooth/bluetooth_private_api.h (renamed from chrome/browser/extensions/api/bluetooth/bluetooth_private_api.h) | 12 | ||||
-rw-r--r-- | extensions/browser/api/bluetooth/bluetooth_private_apitest.cc (renamed from chrome/browser/extensions/api/bluetooth/bluetooth_private_apitest.cc) | 29 | ||||
-rw-r--r-- | extensions/browser/api/bluetooth_low_energy/OWNERS (renamed from chrome/browser/extensions/api/bluetooth_low_energy/OWNERS) | 0 | ||||
-rw-r--r-- | extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_api.cc (renamed from chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_api.cc) | 14 | ||||
-rw-r--r-- | extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_api.h (renamed from chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_api.h) | 12 | ||||
-rw-r--r-- | extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_apitest.cc (renamed from chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_apitest.cc) | 4 | ||||
-rw-r--r-- | extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_connection.cc (renamed from chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_connection.cc) | 2 | ||||
-rw-r--r-- | extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_connection.h (renamed from chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_connection.h) | 6 | ||||
-rw-r--r-- | extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_event_router.cc (renamed from chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_event_router.cc) | 14 | ||||
-rw-r--r-- | extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_event_router.h (renamed from chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_event_router.h) | 30 | ||||
-rw-r--r-- | extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_notify_session.cc (renamed from chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_notify_session.cc) | 2 | ||||
-rw-r--r-- | extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_notify_session.h (renamed from chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_notify_session.h) | 6 | ||||
-rw-r--r-- | extensions/browser/api/bluetooth_low_energy/utils.cc (renamed from chrome/browser/extensions/api/bluetooth_low_energy/utils.cc) | 6 | ||||
-rw-r--r-- | extensions/browser/api/bluetooth_low_energy/utils.h (renamed from chrome/browser/extensions/api/bluetooth_low_energy/utils.h) | 12 | ||||
-rw-r--r-- | extensions/browser/api/bluetooth_socket/OWNERS (renamed from chrome/browser/extensions/api/bluetooth_socket/OWNERS) | 0 | ||||
-rw-r--r-- | extensions/browser/api/bluetooth_socket/bluetooth_api_socket.cc (renamed from chrome/browser/extensions/api/bluetooth_socket/bluetooth_api_socket.cc) | 2 | ||||
-rw-r--r-- | extensions/browser/api/bluetooth_socket/bluetooth_api_socket.h (renamed from chrome/browser/extensions/api/bluetooth_socket/bluetooth_api_socket.h) | 6 | ||||
-rw-r--r-- | extensions/browser/api/bluetooth_socket/bluetooth_socket_api.cc (renamed from chrome/browser/extensions/api/bluetooth_socket/bluetooth_socket_api.cc) | 28 | ||||
-rw-r--r-- | extensions/browser/api/bluetooth_socket/bluetooth_socket_api.h (renamed from chrome/browser/extensions/api/bluetooth_socket/bluetooth_socket_api.h) | 14 | ||||
-rw-r--r-- | extensions/browser/api/bluetooth_socket/bluetooth_socket_apitest.cc (renamed from chrome/browser/extensions/api/bluetooth_socket/bluetooth_socket_apitest.cc) | 4 | ||||
-rw-r--r-- | extensions/browser/api/bluetooth_socket/bluetooth_socket_event_dispatcher.cc (renamed from chrome/browser/extensions/api/bluetooth_socket/bluetooth_socket_event_dispatcher.cc) | 14 | ||||
-rw-r--r-- | extensions/browser/api/bluetooth_socket/bluetooth_socket_event_dispatcher.h (renamed from chrome/browser/extensions/api/bluetooth_socket/bluetooth_socket_event_dispatcher.h) | 12 | ||||
-rw-r--r-- | extensions/common/BUILD.gn | 13 | ||||
-rw-r--r-- | extensions/common/DEPS | 1 | ||||
-rw-r--r-- | extensions/common/api/bluetooth.idl (renamed from chrome/common/extensions/api/bluetooth.idl) | 0 | ||||
-rw-r--r-- | extensions/common/api/bluetooth/bluetooth_manifest_data.cc (renamed from chrome/common/extensions/api/bluetooth/bluetooth_manifest_data.cc) | 4 | ||||
-rw-r--r-- | extensions/common/api/bluetooth/bluetooth_manifest_data.h (renamed from chrome/common/extensions/api/bluetooth/bluetooth_manifest_data.h) | 6 | ||||
-rw-r--r-- | extensions/common/api/bluetooth/bluetooth_manifest_handler.cc (renamed from chrome/common/extensions/api/bluetooth/bluetooth_manifest_handler.cc) | 6 | ||||
-rw-r--r-- | extensions/common/api/bluetooth/bluetooth_manifest_handler.h (renamed from chrome/common/extensions/api/bluetooth/bluetooth_manifest_handler.h) | 6 | ||||
-rw-r--r-- | extensions/common/api/bluetooth/bluetooth_manifest_permission.cc (renamed from chrome/common/extensions/api/bluetooth/bluetooth_manifest_permission.cc) | 14 | ||||
-rw-r--r-- | extensions/common/api/bluetooth/bluetooth_manifest_permission.h (renamed from chrome/common/extensions/api/bluetooth/bluetooth_manifest_permission.h) | 6 | ||||
-rw-r--r-- | extensions/common/api/bluetooth_low_energy.idl (renamed from chrome/common/extensions/api/bluetooth_low_energy.idl) | 0 | ||||
-rw-r--r-- | extensions/common/api/bluetooth_private.json (renamed from chrome/common/extensions/api/bluetooth_private.json) | 2 | ||||
-rw-r--r-- | extensions/common/api/bluetooth_socket.idl (renamed from chrome/common/extensions/api/bluetooth_socket.idl) | 0 | ||||
-rw-r--r-- | extensions/common/api/extensions_manifest_types.json | 26 | ||||
-rw-r--r-- | extensions/common/api/schemas.gypi | 4 | ||||
-rw-r--r-- | extensions/extensions.gyp | 43 | ||||
-rw-r--r-- | extensions/extensions_strings.grd | 12 |
67 files changed, 356 insertions, 304 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 79ad7e2..05e79d9 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -4355,12 +4355,6 @@ Make sure you do not expose any sensitive information. <message name="IDS_EXTENSION_PROMPT_WARNING_ALL_DEVICES" desc="Permission string for access all user's connected devices."> Access all your hardware devices </message> - <message name="IDS_EXTENSION_PROMPT_WARNING_BLUETOOTH" desc="Permission string for general access to the Bluetooth API."> - Access information about Bluetooth devices paired with your system and discover nearby Bluetooth devices. - </message> - <message name="IDS_EXTENSION_PROMPT_WARNING_BLUETOOTH_DEVICES" desc="Permission string for implementing Bluetooth profiles."> - Send messages to and receive messages from Bluetooth devices. - </message> <message name="IDS_EXTENSION_PROMPT_WARNING_DOWNLOADS" desc="Permission string for access to downloads."> Manage your downloads </message> diff --git a/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api.h b/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api.h index e325ff6..f80f85b 100644 --- a/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api.h +++ b/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api.h @@ -9,7 +9,7 @@ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" -#include "chrome/browser/extensions/api/bluetooth_socket/bluetooth_socket_api.h" +#include "extensions/browser/api/bluetooth_socket/bluetooth_socket_api.h" #include "extensions/browser/browser_context_keyed_api_factory.h" #include "extensions/browser/extension_function.h" @@ -166,7 +166,7 @@ class EasyUnlockPrivateSeekBluetoothDeviceByAddressFunction }; class EasyUnlockPrivateConnectToBluetoothServiceInsecurelyFunction - : public BluetoothSocketAbstractConnectFunction { + : public core_api::BluetoothSocketAbstractConnectFunction { public: DECLARE_EXTENSION_FUNCTION( "easyUnlockPrivate.connectToBluetoothServiceInsecurely", diff --git a/chrome/browser/extensions/browser_context_keyed_service_factories.cc b/chrome/browser/extensions/browser_context_keyed_service_factories.cc index e8dee929..23d40f7 100644 --- a/chrome/browser/extensions/browser_context_keyed_service_factories.cc +++ b/chrome/browser/extensions/browser_context_keyed_service_factories.cc @@ -8,10 +8,6 @@ #include "chrome/browser/extensions/api/activity_log_private/activity_log_private_api.h" #include "chrome/browser/extensions/api/alarms/alarm_manager.h" #include "chrome/browser/extensions/api/audio/audio_api.h" -#include "chrome/browser/extensions/api/bluetooth/bluetooth_api.h" -#include "chrome/browser/extensions/api/bluetooth/bluetooth_private_api.h" -#include "chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_api.h" -#include "chrome/browser/extensions/api/bluetooth_socket/bluetooth_socket_event_dispatcher.h" #include "chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.h" #include "chrome/browser/extensions/api/bookmarks/bookmarks_api.h" #include "chrome/browser/extensions/api/braille_display_private/braille_display_private_api.h" @@ -63,6 +59,10 @@ #include "chrome/browser/extensions/token_cache/token_cache_service_factory.h" #include "chrome/browser/speech/extension_api/tts_extension_api.h" #include "extensions/browser/api/api_resource_manager.h" +#include "extensions/browser/api/bluetooth/bluetooth_api.h" +#include "extensions/browser/api/bluetooth/bluetooth_private_api.h" +#include "extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_api.h" +#include "extensions/browser/api/bluetooth_socket/bluetooth_socket_event_dispatcher.h" #include "extensions/browser/api/power/power_api_manager.h" #include "extensions/browser/api/usb/usb_device_resource.h" @@ -163,7 +163,7 @@ void EnsureBrowserContextKeyedServiceFactoriesBuilt() { #endif TokenCacheServiceFactory::GetInstance(); extensions::ExtensionGCMAppHandler::GetFactoryInstance(); - extensions::api::BluetoothSocketEventDispatcher::GetFactoryInstance(); + extensions::core_api::BluetoothSocketEventDispatcher::GetFactoryInstance(); } } // namespace chrome_extensions diff --git a/chrome/chrome_browser_extensions.gypi b/chrome/chrome_browser_extensions.gypi index 96b3c62..f69e2ad 100644 --- a/chrome/chrome_browser_extensions.gypi +++ b/chrome/chrome_browser_extensions.gypi @@ -118,34 +118,6 @@ 'browser/extensions/api/automation_internal/automation_util.h', 'browser/extensions/api/autotest_private/autotest_private_api.cc', 'browser/extensions/api/autotest_private/autotest_private_api.h', - 'browser/extensions/api/bluetooth/bluetooth_api.cc', - 'browser/extensions/api/bluetooth/bluetooth_api.h', - 'browser/extensions/api/bluetooth/bluetooth_api_pairing_delegate.cc', - 'browser/extensions/api/bluetooth/bluetooth_api_pairing_delegate.h', - 'browser/extensions/api/bluetooth/bluetooth_api_utils.cc', - 'browser/extensions/api/bluetooth/bluetooth_api_utils.h', - 'browser/extensions/api/bluetooth/bluetooth_event_router.cc', - 'browser/extensions/api/bluetooth/bluetooth_event_router.h', - 'browser/extensions/api/bluetooth/bluetooth_extension_function.cc', - 'browser/extensions/api/bluetooth/bluetooth_extension_function.h', - 'browser/extensions/api/bluetooth/bluetooth_private_api.cc', - 'browser/extensions/api/bluetooth/bluetooth_private_api.h', - 'browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_api.cc', - 'browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_api.h', - 'browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_connection.cc', - 'browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_connection.h', - 'browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_event_router.cc', - 'browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_event_router.h', - 'browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_notify_session.cc', - 'browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_notify_session.h', - 'browser/extensions/api/bluetooth_low_energy/utils.cc', - 'browser/extensions/api/bluetooth_low_energy/utils.h', - 'browser/extensions/api/bluetooth_socket/bluetooth_api_socket.cc', - 'browser/extensions/api/bluetooth_socket/bluetooth_api_socket.h', - 'browser/extensions/api/bluetooth_socket/bluetooth_socket_api.cc', - 'browser/extensions/api/bluetooth_socket/bluetooth_socket_api.h', - 'browser/extensions/api/bluetooth_socket/bluetooth_socket_event_dispatcher.cc', - 'browser/extensions/api/bluetooth_socket/bluetooth_socket_event_dispatcher.h', 'browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc', 'browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.h', 'browser/extensions/api/bookmarks/bookmark_api_constants.cc', diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index 1be2c43..dfb3308 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -190,12 +190,6 @@ 'common/worker_thread_ticker.h', ], 'chrome_common_extensions_sources': [ - 'common/extensions/api/bluetooth/bluetooth_manifest_data.cc', - 'common/extensions/api/bluetooth/bluetooth_manifest_data.h', - 'common/extensions/api/bluetooth/bluetooth_manifest_handler.cc', - 'common/extensions/api/bluetooth/bluetooth_manifest_handler.h', - 'common/extensions/api/bluetooth/bluetooth_manifest_permission.cc', - 'common/extensions/api/bluetooth/bluetooth_manifest_permission.h', 'common/extensions/api/commands/commands_handler.cc', 'common/extensions/api/commands/commands_handler.h', 'common/extensions/api/extension_action/browser_action_handler.cc', @@ -343,7 +337,6 @@ ['enable_extensions==1', { 'sources': [ '<@(chrome_common_extensions_sources)' ], 'dependencies': [ - '../device/bluetooth/bluetooth.gyp:device_bluetooth', '../device/usb/usb.gyp:device_usb', ], }], diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 48d1b21..1844919 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -879,6 +879,10 @@ '../components/autofill/content/renderer/test_password_generation_agent.h', '../components/autofill/content/renderer/test_password_generation_agent.cc', # TODO(rockot): Remove this once extensions_browsertests exists. + '../extensions/browser/api/bluetooth/bluetooth_apitest.cc', + '../extensions/browser/api/bluetooth/bluetooth_private_apitest.cc', + '../extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_apitest.cc', + '../extensions/browser/api/bluetooth_socket/bluetooth_socket_apitest.cc', '../extensions/browser/api/runtime/runtime_apitest.cc', 'app/chrome_command_ids.h', 'app/chrome_dll.rc', @@ -1075,10 +1079,6 @@ 'browser/extensions/api/audio/audio_apitest.cc', 'browser/extensions/api/automation/automation_apitest.cc', 'browser/extensions/api/autotest_private/autotest_private_apitest.cc', - 'browser/extensions/api/bluetooth/bluetooth_apitest.cc', - 'browser/extensions/api/bluetooth/bluetooth_private_apitest.cc', - 'browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_apitest.cc', - 'browser/extensions/api/bluetooth_socket/bluetooth_socket_apitest.cc', 'browser/extensions/api/bookmark_manager_private/bookmark_manager_private_apitest.cc', 'browser/extensions/api/braille_display_private/braille_display_private_apitest.cc', 'browser/extensions/api/braille_display_private/mock_braille_controller.cc', diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi index cc955d3..1431b97 100644 --- a/chrome/chrome_tests_unit.gypi +++ b/chrome/chrome_tests_unit.gypi @@ -528,6 +528,7 @@ # http://crbug.com/348066. They are duplicated here because we haven't # extensions_unittests running in the bots yet. Until that happens, # they should be kept here. + '../extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc', '../extensions/browser/api/cast_channel/cast_channel_api_unittest.cc', '../extensions/browser/api/cast_channel/cast_socket_unittest.cc', '../extensions/browser/api/cast_channel/logger_unittest.cc', @@ -838,7 +839,6 @@ 'browser/extensions/activity_log/uma_policy_unittest.cc', 'browser/extensions/api/activity_log_private/activity_log_private_api_unittest.cc', 'browser/extensions/api/alarms/alarms_api_unittest.cc', - 'browser/extensions/api/bluetooth/bluetooth_event_router_unittest.cc', 'browser/extensions/api/bookmarks/bookmark_api_helpers_unittest.cc', 'browser/extensions/api/content_settings/content_settings_store_unittest.cc', 'browser/extensions/api/content_settings/content_settings_unittest.cc', diff --git a/chrome/common/extensions/DEPS b/chrome/common/extensions/DEPS index c661eba..a13d255 100644 --- a/chrome/common/extensions/DEPS +++ b/chrome/common/extensions/DEPS @@ -1,6 +1,5 @@ include_rules = [ "+components/policy/core/common", - "+device/bluetooth", # For BluetoothPermission "+device/usb", # For UsbDevicePermission "+extensions/grit", "+extensions/strings/grit", diff --git a/chrome/common/extensions/api/manifest_types.json b/chrome/common/extensions/api/manifest_types.json index cd1aafc..ca479fb 100644 --- a/chrome/common/extensions/api/manifest_types.json +++ b/chrome/common/extensions/api/manifest_types.json @@ -142,32 +142,6 @@ } }, { - "id": "bluetooth", - "type": "object", - "description": "The <code>bluetooth</code> manifest property give permission to an app to use the $(ref:bluetooth) API. A list of UUIDs can be optionally specified to enable communication with devices.", - "properties": { - "uuids": { - "description": "The <code>uuids</code> manifest property declares the list of protocols, profiles and services that an app can communicate using.", - "optional": true, - "type": "array", - "items": { - "description": "<p>The list specified as UUID strings.</p>", - "type": "string" - } - }, - "socket": { - "type": "boolean", - "description": "If <code>true</code>, gives permission to an app to use the $(ref:bluetoothSocket) API", - "optional": true - }, - "low_energy": { - "type": "boolean", - "description": "If <code>true</code>, gives permission to an app to use the $(ref:bluetoothLowEnergy) API", - "optional": true - } - } - }, - { "id": "automation", "description": "This API provides programmatic access to the user interface elements of Chrome. This includes everything in the web view, and optionally Chrome's full user interface.", "choices": [ diff --git a/chrome/common/extensions/api/schemas.gypi b/chrome/common/extensions/api/schemas.gypi index ab95990..0c82c44 100644 --- a/chrome/common/extensions/api/schemas.gypi +++ b/chrome/common/extensions/api/schemas.gypi @@ -24,10 +24,6 @@ 'automation.idl', 'automation_internal.idl', 'autotest_private.idl', - 'bluetooth.idl', - 'bluetooth_low_energy.idl', - 'bluetooth_private.json', - 'bluetooth_socket.idl', 'bookmark_manager_private.json', 'bookmarks.json', 'braille_display_private.idl', diff --git a/chrome/common/extensions/chrome_manifest_handlers.cc b/chrome/common/extensions/chrome_manifest_handlers.cc index 1d03184..013fab2 100644 --- a/chrome/common/extensions/chrome_manifest_handlers.cc +++ b/chrome/common/extensions/chrome_manifest_handlers.cc @@ -4,7 +4,6 @@ #include "chrome/common/extensions/chrome_manifest_handlers.h" -#include "chrome/common/extensions/api/bluetooth/bluetooth_manifest_handler.h" #include "chrome/common/extensions/api/commands/commands_handler.h" #include "chrome/common/extensions/api/extension_action/browser_action_handler.h" #include "chrome/common/extensions/api/extension_action/page_action_handler.h" @@ -33,6 +32,7 @@ #include "chrome/common/extensions/manifest_handlers/theme_handler.h" #include "chrome/common/extensions/manifest_handlers/ui_overrides_handler.h" #include "chrome/common/extensions/manifest_url_handler.h" +#include "extensions/common/api/bluetooth/bluetooth_manifest_handler.h" #include "extensions/common/api/sockets/sockets_manifest_handler.h" #include "extensions/common/manifest_handlers/externally_connectable.h" #include "extensions/common/manifest_handlers/requirements_info.h" diff --git a/extensions/DEPS b/extensions/DEPS index 67c2fd1..91be1a7 100644 --- a/extensions/DEPS +++ b/extensions/DEPS @@ -31,6 +31,7 @@ specific_include_rules = { "+chrome/browser/extensions/extension_function_test_utils.h", "+chrome/browser/extensions/extension_service.h", "+chrome/browser/extensions/extension_service_test_base.h", + "+chrome/browser/extensions/extension_test_message_listener.h", "+chrome/browser/extensions/test_extension_dir.h", "+chrome/browser/extensions/test_extension_prefs.h", "+chrome/browser/extensions/test_extension_system.h", diff --git a/extensions/browser/BUILD.gn b/extensions/browser/BUILD.gn index b1667d2..03278c0 100644 --- a/extensions/browser/BUILD.gn +++ b/extensions/browser/BUILD.gn @@ -43,6 +43,34 @@ source_set("browser") { "api/app_view/app_view_internal_api.h", "api/async_api_function.cc", "api/async_api_function.h", + "api/bluetooth/bluetooth_api.cc", + "api/bluetooth/bluetooth_api.h", + "api/bluetooth/bluetooth_api_pairing_delegate.cc", + "api/bluetooth/bluetooth_api_pairing_delegate.h", + "api/bluetooth/bluetooth_api_utils.cc", + "api/bluetooth/bluetooth_api_utils.h", + "api/bluetooth/bluetooth_event_router.cc", + "api/bluetooth/bluetooth_event_router.h", + "api/bluetooth/bluetooth_extension_function.cc", + "api/bluetooth/bluetooth_extension_function.h", + "api/bluetooth/bluetooth_private_api.cc", + "api/bluetooth/bluetooth_private_api.h", + "api/bluetooth_low_energy/bluetooth_low_energy_api.cc", + "api/bluetooth_low_energy/bluetooth_low_energy_api.h", + "api/bluetooth_low_energy/bluetooth_low_energy_connection.cc", + "api/bluetooth_low_energy/bluetooth_low_energy_connection.h", + "api/bluetooth_low_energy/bluetooth_low_energy_event_router.cc", + "api/bluetooth_low_energy/bluetooth_low_energy_event_router.h", + "api/bluetooth_low_energy/bluetooth_low_energy_notify_session.cc", + "api/bluetooth_low_energy/bluetooth_low_energy_notify_session.h", + "api/bluetooth_low_energy/utils.cc", + "api/bluetooth_low_energy/utils.h", + "api/bluetooth_socket/bluetooth_api_socket.cc", + "api/bluetooth_socket/bluetooth_api_socket.h", + "api/bluetooth_socket/bluetooth_socket_api.cc", + "api/bluetooth_socket/bluetooth_socket_api.h", + "api/bluetooth_socket/bluetooth_socket_event_dispatcher.cc", + "api/bluetooth_socket/bluetooth_socket_event_dispatcher.h", "api/cast_channel/cast_auth_util.cc", "api/cast_channel/cast_auth_util.h", "api/cast_channel/cast_channel_api.cc", @@ -304,6 +332,7 @@ source_set("browser") { deps += [ "//components/usb_service", "//crypto:platform", + "//device/bluetooth", "//device/hid", "//device/serial", "//extensions/browser/api/cast_channel:cast_channel_proto", diff --git a/extensions/browser/DEPS b/extensions/browser/DEPS index d6800f3..dfc1e78 100644 --- a/extensions/browser/DEPS +++ b/extensions/browser/DEPS @@ -4,6 +4,7 @@ include_rules = [ "+components/sessions", "+components/web_modal", "+content/public/browser", + "+device/bluetooth", "+grit/extensions_strings.h", "+net", "+skia/ext/image_operations.h", diff --git a/extensions/browser/api/api_resource_manager.h b/extensions/browser/api/api_resource_manager.h index 0eaf36d..e8b5d33 100644 --- a/extensions/browser/api/api_resource_manager.h +++ b/extensions/browser/api/api_resource_manager.h @@ -27,12 +27,9 @@ namespace extensions { -namespace api { +namespace core_api { class BluetoothSocketApiFunction; class BluetoothSocketEventDispatcher; -} - -namespace core_api { class SerialEventDispatcher; class TCPServerSocketEventDispatcher; class TCPSocketEventDispatcher; @@ -204,8 +201,8 @@ class ApiResourceManager : public BrowserContextKeyedAPI, // TODO(rockot): ApiResourceData could be moved out of ApiResourceManager and // we could avoid maintaining a friends list here. friend class BluetoothAPI; - friend class api::BluetoothSocketApiFunction; - friend class api::BluetoothSocketEventDispatcher; + friend class core_api::BluetoothSocketApiFunction; + friend class core_api::BluetoothSocketEventDispatcher; friend class core_api::SerialEventDispatcher; friend class core_api::TCPServerSocketEventDispatcher; friend class core_api::TCPSocketEventDispatcher; diff --git a/chrome/browser/extensions/api/bluetooth/OWNERS b/extensions/browser/api/bluetooth/OWNERS index beccf04..beccf04 100644 --- a/chrome/browser/extensions/api/bluetooth/OWNERS +++ b/extensions/browser/api/bluetooth/OWNERS diff --git a/chrome/browser/extensions/api/bluetooth/bluetooth_api.cc b/extensions/browser/api/bluetooth/bluetooth_api.cc index 12b6154..2e1e4bc 100644 --- a/chrome/browser/extensions/api/bluetooth/bluetooth_api.cc +++ b/extensions/browser/api/bluetooth/bluetooth_api.cc @@ -2,21 +2,20 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/api/bluetooth/bluetooth_api.h" +#include "extensions/browser/api/bluetooth/bluetooth_api.h" #include <string> #include "base/bind_helpers.h" #include "base/lazy_instance.h" #include "base/memory/ref_counted.h" -#include "chrome/browser/extensions/api/bluetooth/bluetooth_api_utils.h" -#include "chrome/browser/extensions/api/bluetooth/bluetooth_event_router.h" -#include "chrome/browser/profiles/profile_manager.h" -#include "chrome/common/extensions/api/bluetooth.h" #include "content/public/browser/browser_thread.h" #include "device/bluetooth/bluetooth_adapter.h" #include "device/bluetooth/bluetooth_device.h" +#include "extensions/browser/api/bluetooth/bluetooth_api_utils.h" +#include "extensions/browser/api/bluetooth/bluetooth_event_router.h" #include "extensions/browser/event_router.h" +#include "extensions/common/api/bluetooth.h" using content::BrowserContext; using content::BrowserThread; @@ -24,9 +23,9 @@ using content::BrowserThread; using device::BluetoothAdapter; using device::BluetoothDevice; -namespace bluetooth = extensions::api::bluetooth; -namespace GetDevice = extensions::api::bluetooth::GetDevice; -namespace GetDevices = extensions::api::bluetooth::GetDevices; +namespace bluetooth = extensions::core_api::bluetooth; +namespace GetDevice = extensions::core_api::bluetooth::GetDevice; +namespace GetDevices = extensions::core_api::bluetooth::GetDevices; namespace { @@ -97,7 +96,7 @@ void BluetoothAPI::OnListenerRemoved(const EventListenerInfo& details) { event_router()->OnListenerRemoved(); } -namespace api { +namespace core_api { BluetoothGetAdapterStateFunction::~BluetoothGetAdapterStateFunction() {} @@ -200,5 +199,5 @@ bool BluetoothStopDiscoveryFunction::DoWork( return true; } -} // namespace api +} // namespace core_api } // namespace extensions diff --git a/chrome/browser/extensions/api/bluetooth/bluetooth_api.h b/extensions/browser/api/bluetooth/bluetooth_api.h index 0d26080..b395eb5 100644 --- a/chrome/browser/extensions/api/bluetooth/bluetooth_api.h +++ b/extensions/browser/api/bluetooth/bluetooth_api.h @@ -2,19 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_API_H_ -#define CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_API_H_ +#ifndef EXTENSIONS_BROWSER_API_BLUETOOTH_BLUETOOTH_API_H_ +#define EXTENSIONS_BROWSER_API_BLUETOOTH_BLUETOOTH_API_H_ #include <string> #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" -#include "chrome/browser/extensions/api/bluetooth/bluetooth_extension_function.h" -#include "chrome/common/extensions/api/bluetooth.h" #include "device/bluetooth/bluetooth_device.h" +#include "extensions/browser/api/bluetooth/bluetooth_extension_function.h" #include "extensions/browser/browser_context_keyed_api_factory.h" #include "extensions/browser/event_router.h" #include "extensions/browser/extension_function.h" +#include "extensions/common/api/bluetooth.h" namespace content { class BrowserContext; @@ -64,7 +64,7 @@ class BluetoothAPI : public BrowserContextKeyedAPI, scoped_ptr<BluetoothEventRouter> event_router_; }; -namespace api { +namespace core_api { class BluetoothGetAdapterStateFunction : public BluetoothExtensionFunction { public: @@ -131,7 +131,7 @@ class BluetoothStopDiscoveryFunction : public BluetoothExtensionFunction { void OnErrorCallback(); }; -} // namespace api +} // namespace core_api } // namespace extensions -#endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_API_H_ +#endif // EXTENSIONS_BROWSER_API_BLUETOOTH_BLUETOOTH_API_H_ diff --git a/chrome/browser/extensions/api/bluetooth/bluetooth_api_pairing_delegate.cc b/extensions/browser/api/bluetooth/bluetooth_api_pairing_delegate.cc index 615f79a..7ffbe63 100644 --- a/chrome/browser/extensions/api/bluetooth/bluetooth_api_pairing_delegate.cc +++ b/extensions/browser/api/bluetooth/bluetooth_api_pairing_delegate.cc @@ -2,27 +2,27 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/api/bluetooth/bluetooth_api_pairing_delegate.h" +#include "extensions/browser/api/bluetooth/bluetooth_api_pairing_delegate.h" #include "base/memory/scoped_ptr.h" #include "base/values.h" -#include "chrome/browser/extensions/api/bluetooth/bluetooth_api_utils.h" -#include "chrome/common/extensions/api/bluetooth_private.h" #include "content/public/browser/browser_context.h" #include "device/bluetooth/bluetooth_device.h" +#include "extensions/browser/api/bluetooth/bluetooth_api_utils.h" #include "extensions/browser/event_router.h" #include "extensions/browser/extension_system.h" +#include "extensions/common/api/bluetooth_private.h" namespace extensions { -namespace bt_private = api::bluetooth_private; +namespace bt_private = core_api::bluetooth_private; namespace { void PopulatePairingEvent(const device::BluetoothDevice* device, bt_private::PairingEventType type, bt_private::PairingEvent* out) { - api::bluetooth::BluetoothDeviceToApiDevice(*device, &out->device); + core_api::bluetooth::BluetoothDeviceToApiDevice(*device, &out->device); out->pairing = type; } diff --git a/chrome/browser/extensions/api/bluetooth/bluetooth_api_pairing_delegate.h b/extensions/browser/api/bluetooth/bluetooth_api_pairing_delegate.h index 95791b3..e999264 100644 --- a/chrome/browser/extensions/api/bluetooth/bluetooth_api_pairing_delegate.h +++ b/extensions/browser/api/bluetooth/bluetooth_api_pairing_delegate.h @@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_API_PAIRING_DELEGATE_H_ -#define CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_API_PAIRING_DELEGATE_H_ +#ifndef EXTENSIONS_BROWSER_API_BLUETOOTH_BLUETOOTH_API_PAIRING_DELEGATE_H_ +#define EXTENSIONS_BROWSER_API_BLUETOOTH_BLUETOOTH_API_PAIRING_DELEGATE_H_ #include <string> -#include "chrome/common/extensions/api/bluetooth_private.h" #include "device/bluetooth/bluetooth_device.h" +#include "extensions/common/api/bluetooth_private.h" namespace content { class BrowserContext; @@ -41,7 +41,7 @@ class BluetoothApiPairingDelegate private: // Dispatches a pairing event to the extension. void DispatchPairingEvent( - const api::bluetooth_private::PairingEvent& pairing_event); + const core_api::bluetooth_private::PairingEvent& pairing_event); std::string extension_id_; content::BrowserContext* browser_context_; @@ -49,4 +49,4 @@ class BluetoothApiPairingDelegate } // namespace extensions -#endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_API_PAIRING_DELEGATE_H_ +#endif // EXTENSIONS_BROWSER_API_BLUETOOTH_BLUETOOTH_API_PAIRING_DELEGATE_H_ diff --git a/chrome/browser/extensions/api/bluetooth/bluetooth_api_utils.cc b/extensions/browser/api/bluetooth/bluetooth_api_utils.cc index e13ec1b..58a5d0a 100644 --- a/chrome/browser/extensions/api/bluetooth/bluetooth_api_utils.cc +++ b/extensions/browser/api/bluetooth/bluetooth_api_utils.cc @@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/api/bluetooth/bluetooth_api_utils.h" +#include "extensions/browser/api/bluetooth/bluetooth_api_utils.h" #include "base/strings/utf_string_conversions.h" #include "base/values.h" -#include "chrome/common/extensions/api/bluetooth.h" #include "device/bluetooth/bluetooth_adapter.h" #include "device/bluetooth/bluetooth_device.h" +#include "extensions/common/api/bluetooth.h" -namespace bluetooth = extensions::api::bluetooth; +namespace bluetooth = extensions::core_api::bluetooth; using device::BluetoothDevice; using bluetooth::VendorIdSource; @@ -88,7 +88,7 @@ bool ConvertDeviceTypeToApi(const BluetoothDevice::DeviceType& input, } // namespace namespace extensions { -namespace api { +namespace core_api { namespace bluetooth { void BluetoothDeviceToApiDevice(const device::BluetoothDevice& device, @@ -143,5 +143,5 @@ void PopulateAdapterState(const device::BluetoothAdapter& adapter, } } // namespace bluetooth -} // namespace api +} // namespace core_api } // namespace extensions diff --git a/chrome/browser/extensions/api/bluetooth/bluetooth_api_utils.h b/extensions/browser/api/bluetooth/bluetooth_api_utils.h index 2389d5b..082244f9 100644 --- a/chrome/browser/extensions/api/bluetooth/bluetooth_api_utils.h +++ b/extensions/browser/api/bluetooth/bluetooth_api_utils.h @@ -2,16 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_API_UTILS_H_ -#define CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_API_UTILS_H_ +#ifndef EXTENSIONS_BROWSER_API_BLUETOOTH_BLUETOOTH_API_UTILS_H_ +#define EXTENSIONS_BROWSER_API_BLUETOOTH_BLUETOOTH_API_UTILS_H_ #include "base/values.h" -#include "chrome/common/extensions/api/bluetooth.h" #include "device/bluetooth/bluetooth_adapter.h" #include "device/bluetooth/bluetooth_device.h" +#include "extensions/common/api/bluetooth.h" namespace extensions { -namespace api { +namespace core_api { namespace bluetooth { // Fill in a Device object from a BluetoothDevice. @@ -24,7 +24,7 @@ void PopulateAdapterState(const device::BluetoothAdapter& adapter, AdapterState* out); } // namespace bluetooth -} // namespace api +} // namespace core_api } // namespace extensions -#endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_API_UTILS_H_ +#endif // EXTENSIONS_BROWSER_API_BLUETOOTH_BLUETOOTH_API_UTILS_H_ diff --git a/chrome/browser/extensions/api/bluetooth/bluetooth_apitest.cc b/extensions/browser/api/bluetooth/bluetooth_apitest.cc index c2016a6..b62982f 100644 --- a/chrome/browser/extensions/api/bluetooth/bluetooth_apitest.cc +++ b/extensions/browser/api/bluetooth/bluetooth_apitest.cc @@ -6,8 +6,6 @@ #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" -#include "chrome/browser/extensions/api/bluetooth/bluetooth_api.h" -#include "chrome/browser/extensions/api/bluetooth/bluetooth_event_router.h" #include "chrome/browser/extensions/extension_apitest.h" #include "chrome/browser/extensions/extension_function_test_utils.h" #include "chrome/browser/extensions/extension_service.h" @@ -19,6 +17,8 @@ #include "device/bluetooth/test/mock_bluetooth_adapter.h" #include "device/bluetooth/test/mock_bluetooth_device.h" #include "device/bluetooth/test/mock_bluetooth_discovery_session.h" +#include "extensions/browser/api/bluetooth/bluetooth_api.h" +#include "extensions/browser/api/bluetooth/bluetooth_event_router.h" #include "testing/gmock/include/gmock/gmock.h" using device::BluetoothAdapter; @@ -31,7 +31,7 @@ using device::MockBluetoothDiscoverySession; using extensions::Extension; namespace utils = extension_function_test_utils; -namespace api = extensions::api; +namespace api = extensions::core_api; namespace { diff --git a/chrome/browser/extensions/api/bluetooth/bluetooth_event_router.cc b/extensions/browser/api/bluetooth/bluetooth_event_router.cc index f420726ae..1064d0b 100644 --- a/chrome/browser/extensions/api/bluetooth/bluetooth_event_router.cc +++ b/extensions/browser/api/bluetooth/bluetooth_event_router.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/api/bluetooth/bluetooth_event_router.h" +#include "extensions/browser/api/bluetooth/bluetooth_event_router.h" #include <map> #include <string> @@ -15,26 +15,26 @@ #include "base/memory/scoped_vector.h" #include "base/stl_util.h" #include "base/strings/utf_string_conversions.h" -#include "chrome/browser/extensions/api/bluetooth/bluetooth_api_pairing_delegate.h" -#include "chrome/browser/extensions/api/bluetooth/bluetooth_api_utils.h" -#include "chrome/browser/extensions/api/bluetooth/bluetooth_private_api.h" -#include "chrome/common/extensions/api/bluetooth.h" -#include "chrome/common/extensions/api/bluetooth_private.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" #include "device/bluetooth/bluetooth_adapter.h" #include "device/bluetooth/bluetooth_adapter_factory.h" #include "device/bluetooth/bluetooth_device.h" #include "device/bluetooth/bluetooth_discovery_session.h" +#include "extensions/browser/api/bluetooth/bluetooth_api_pairing_delegate.h" +#include "extensions/browser/api/bluetooth/bluetooth_api_utils.h" +#include "extensions/browser/api/bluetooth/bluetooth_private_api.h" #include "extensions/browser/event_router.h" #include "extensions/browser/extension_host.h" #include "extensions/browser/extension_registry.h" #include "extensions/browser/notification_types.h" +#include "extensions/common/api/bluetooth.h" +#include "extensions/common/api/bluetooth_private.h" namespace extensions { -namespace bluetooth = api::bluetooth; -namespace bt_private = api::bluetooth_private; +namespace bluetooth = core_api::bluetooth; +namespace bt_private = core_api::bluetooth_private; BluetoothEventRouter::BluetoothEventRouter(content::BrowserContext* context) : browser_context_(context), @@ -284,7 +284,7 @@ void BluetoothEventRouter::OnListenerRemoved() { void BluetoothEventRouter::DispatchAdapterStateEvent() { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); - api::bluetooth::AdapterState state; + core_api::bluetooth::AdapterState state; PopulateAdapterState(*adapter_.get(), &state); scoped_ptr<base::ListValue> args = diff --git a/chrome/browser/extensions/api/bluetooth/bluetooth_event_router.h b/extensions/browser/api/bluetooth/bluetooth_event_router.h index 16aae8c..e0fdf9a 100644 --- a/chrome/browser/extensions/api/bluetooth/bluetooth_event_router.h +++ b/extensions/browser/api/bluetooth/bluetooth_event_router.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_EVENT_ROUTER_H_ -#define CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_EVENT_ROUTER_H_ +#ifndef EXTENSIONS_BROWSER_API_BLUETOOTH_BLUETOOTH_EVENT_ROUTER_H_ +#define EXTENSIONS_BROWSER_API_BLUETOOTH_BLUETOOTH_EVENT_ROUTER_H_ #include <map> @@ -12,13 +12,13 @@ #include "base/memory/scoped_vector.h" #include "base/memory/weak_ptr.h" #include "base/scoped_observer.h" -#include "chrome/common/extensions/api/bluetooth.h" -#include "chrome/common/extensions/api/bluetooth_private.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "device/bluetooth/bluetooth_adapter.h" #include "device/bluetooth/bluetooth_adapter_factory.h" #include "extensions/browser/extension_registry_observer.h" +#include "extensions/common/api/bluetooth.h" +#include "extensions/common/api/bluetooth_private.h" namespace content { class BrowserContext; @@ -161,4 +161,4 @@ class BluetoothEventRouter : public device::BluetoothAdapter::Observer, } // namespace extensions -#endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_EVENT_ROUTER_H_ +#endif // EXTENSIONS_BROWSER_API_BLUETOOTH_BLUETOOTH_EVENT_ROUTER_H_ diff --git a/chrome/browser/extensions/api/bluetooth/bluetooth_event_router_unittest.cc b/extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc index 030d305..4d336b7 100644 --- a/chrome/browser/extensions/api/bluetooth/bluetooth_event_router_unittest.cc +++ b/extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc @@ -8,18 +8,17 @@ #include "base/memory/scoped_ptr.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" -#include "chrome/browser/extensions/api/bluetooth/bluetooth_event_router.h" -#include "chrome/browser/extensions/extension_system_factory.h" #include "chrome/browser/extensions/test_extension_system.h" -#include "chrome/common/extensions/api/bluetooth.h" #include "chrome/test/base/testing_profile.h" #include "content/public/test/test_browser_thread.h" #include "content/public/test/test_browser_thread_bundle.h" #include "device/bluetooth/bluetooth_uuid.h" #include "device/bluetooth/test/mock_bluetooth_adapter.h" #include "device/bluetooth/test/mock_bluetooth_device.h" +#include "extensions/browser/api/bluetooth/bluetooth_event_router.h" #include "extensions/browser/event_router.h" #include "extensions/browser/extension_registry.h" +#include "extensions/common/api/bluetooth.h" #include "extensions/common/extension_builder.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -34,7 +33,7 @@ const device::BluetoothUUID kHealthProfileUuid("4321"); namespace extensions { -namespace bluetooth = api::bluetooth; +namespace bluetooth = core_api::bluetooth; class BluetoothEventRouterTest : public testing::Test { public: diff --git a/chrome/browser/extensions/api/bluetooth/bluetooth_extension_function.cc b/extensions/browser/api/bluetooth/bluetooth_extension_function.cc index bbc4fbd..7a5eefe 100644 --- a/chrome/browser/extensions/api/bluetooth/bluetooth_extension_function.cc +++ b/extensions/browser/api/bluetooth/bluetooth_extension_function.cc @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/api/bluetooth/bluetooth_extension_function.h" +#include "extensions/browser/api/bluetooth/bluetooth_extension_function.h" #include "base/memory/ref_counted.h" -#include "chrome/browser/extensions/api/bluetooth/bluetooth_api.h" -#include "chrome/browser/extensions/api/bluetooth/bluetooth_event_router.h" #include "content/public/browser/browser_thread.h" #include "device/bluetooth/bluetooth_adapter.h" #include "device/bluetooth/bluetooth_adapter_factory.h" +#include "extensions/browser/api/bluetooth/bluetooth_api.h" +#include "extensions/browser/api/bluetooth/bluetooth_event_router.h" using content::BrowserThread; @@ -38,7 +38,7 @@ void GetAdapter(const device::BluetoothAdapterFactory::AdapterCallback callback, } // namespace namespace extensions { -namespace api { +namespace core_api { BluetoothExtensionFunction::BluetoothExtensionFunction() { } @@ -65,5 +65,5 @@ void BluetoothExtensionFunction::RunOnAdapterReady( DoWork(adapter); } -} // namespace api +} // namespace core_api } // namespace extensions diff --git a/chrome/browser/extensions/api/bluetooth/bluetooth_extension_function.h b/extensions/browser/api/bluetooth/bluetooth_extension_function.h index dfe9ea5..9a1cc73 100644 --- a/chrome/browser/extensions/api/bluetooth/bluetooth_extension_function.h +++ b/extensions/browser/api/bluetooth/bluetooth_extension_function.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_EXTENSION_FUNCTION_H_ -#define CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_EXTENSION_FUNCTION_H_ +#ifndef EXTENSIONS_BROWSER_API_BLUETOOTH_BLUETOOTH_EXTENSION_FUNCTION_H_ +#define EXTENSIONS_BROWSER_API_BLUETOOTH_BLUETOOTH_EXTENSION_FUNCTION_H_ #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" @@ -16,7 +16,7 @@ class BluetoothAdapter; } // namespace device namespace extensions { -namespace api { +namespace core_api { // Base class for bluetooth extension functions. This class initializes // bluetooth adapter and calls (on the UI thread) DoWork() implemented by @@ -41,7 +41,7 @@ class BluetoothExtensionFunction : public AsyncExtensionFunction { DISALLOW_COPY_AND_ASSIGN(BluetoothExtensionFunction); }; -} // namespace api +} // namespace core_api } // namespace extensions -#endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_EXTENSION_FUNCTION_H_ +#endif // EXTENSIONS_BROWSER_API_BLUETOOTH_BLUETOOTH_EXTENSION_FUNCTION_H_ diff --git a/chrome/browser/extensions/api/bluetooth/bluetooth_private_api.cc b/extensions/browser/api/bluetooth/bluetooth_private_api.cc index 861197d..8729f73 100644 --- a/chrome/browser/extensions/api/bluetooth/bluetooth_private_api.cc +++ b/extensions/browser/api/bluetooth/bluetooth_private_api.cc @@ -2,18 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/api/bluetooth/bluetooth_private_api.h" +#include "extensions/browser/api/bluetooth/bluetooth_private_api.h" #include "base/callback.h" #include "base/lazy_instance.h" #include "base/strings/string_util.h" -#include "chrome/browser/extensions/api/bluetooth/bluetooth_api.h" -#include "chrome/browser/extensions/api/bluetooth/bluetooth_event_router.h" -#include "chrome/common/extensions/api/bluetooth_private.h" #include "device/bluetooth/bluetooth_adapter.h" #include "device/bluetooth/bluetooth_adapter_factory.h" +#include "extensions/browser/api/bluetooth/bluetooth_api.h" +#include "extensions/browser/api/bluetooth/bluetooth_event_router.h" +#include "extensions/common/api/bluetooth_private.h" -namespace bt_private = extensions::api::bluetooth_private; +namespace bt_private = extensions::core_api::bluetooth_private; namespace extensions { @@ -58,7 +58,7 @@ void BluetoothPrivateAPI::OnListenerRemoved(const EventListenerInfo& details) { details.extension_id); } -namespace api { +namespace core_api { namespace { @@ -285,6 +285,6 @@ bool BluetoothPrivateSetPairingResponseFunction::DoWork( return true; } -} // namespace api +} // namespace core_api } // namespace extensions diff --git a/chrome/browser/extensions/api/bluetooth/bluetooth_private_api.h b/extensions/browser/api/bluetooth/bluetooth_private_api.h index 4960e07..0520861 100644 --- a/chrome/browser/extensions/api/bluetooth/bluetooth_private_api.h +++ b/extensions/browser/api/bluetooth/bluetooth_private_api.h @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_PRIVATE_API_H_ -#define CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_PRIVATE_API_H_ +#ifndef EXTENSIONS_BROWSER_API_BLUETOOTH_BLUETOOTH_PRIVATE_API_H_ +#define EXTENSIONS_BROWSER_API_BLUETOOTH_BLUETOOTH_PRIVATE_API_H_ #include "base/callback_forward.h" -#include "chrome/browser/extensions/api/bluetooth/bluetooth_extension_function.h" +#include "extensions/browser/api/bluetooth/bluetooth_extension_function.h" #include "extensions/browser/browser_context_keyed_api_factory.h" #include "extensions/browser/event_router.h" @@ -46,7 +46,7 @@ class BluetoothPrivateAPI : public BrowserContextKeyedAPI, content::BrowserContext* browser_context_; }; -namespace api { +namespace core_api { class BluetoothPrivateSetAdapterStateFunction : public BluetoothExtensionFunction { @@ -90,8 +90,8 @@ class BluetoothPrivateSetPairingResponseFunction DISALLOW_COPY_AND_ASSIGN(BluetoothPrivateSetPairingResponseFunction); }; -} // namespace api +} // namespace core_api } // namespace extensions -#endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_PRIVATE_API_H_ +#endif // EXTENSIONS_BROWSER_API_BLUETOOTH_BLUETOOTH_PRIVATE_API_H_ diff --git a/chrome/browser/extensions/api/bluetooth/bluetooth_private_apitest.cc b/extensions/browser/api/bluetooth/bluetooth_private_apitest.cc index 8a03ef6..186462f 100644 --- a/chrome/browser/extensions/api/bluetooth/bluetooth_private_apitest.cc +++ b/extensions/browser/api/bluetooth/bluetooth_private_apitest.cc @@ -5,13 +5,13 @@ #include "base/command_line.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" -#include "chrome/browser/extensions/api/bluetooth/bluetooth_api.h" -#include "chrome/browser/extensions/api/bluetooth/bluetooth_event_router.h" #include "chrome/browser/extensions/extension_apitest.h" -#include "chrome/common/extensions/api/bluetooth_private.h" #include "device/bluetooth/test/mock_bluetooth_adapter.h" #include "device/bluetooth/test/mock_bluetooth_device.h" +#include "extensions/browser/api/bluetooth/bluetooth_api.h" +#include "extensions/browser/api/bluetooth/bluetooth_event_router.h" #include "extensions/browser/event_router.h" +#include "extensions/common/api/bluetooth_private.h" #include "extensions/common/switches.h" #include "testing/gmock/include/gmock/gmock.h" @@ -25,8 +25,10 @@ using testing::ReturnPointee; using testing::WithArgs; using testing::WithoutArgs; -namespace bt = extensions::api::bluetooth; -namespace bt_private = extensions::api::bluetooth_private; +namespace bt = extensions::core_api::bluetooth; +namespace bt_private = extensions::core_api::bluetooth_private; + +namespace extensions { namespace { @@ -46,7 +48,7 @@ class BluetoothPrivateApiTest : public ExtensionApiTest { virtual void SetUpOnMainThread() OVERRIDE { CommandLine::ForCurrentProcess()->AppendSwitchASCII( - extensions::switches::kWhitelistedExtensionID, kTestExtensionId); + switches::kWhitelistedExtensionID, kTestExtensionId); mock_adapter_ = new NiceMock<MockBluetoothAdapter>(); event_router()->SetAdapterForTest(mock_adapter_.get()); mock_device_.reset(new NiceMock<MockBluetoothDevice>(mock_adapter_.get(), @@ -62,9 +64,8 @@ class BluetoothPrivateApiTest : public ExtensionApiTest { virtual void TearDownOnMainThread() OVERRIDE {} - extensions::BluetoothEventRouter* event_router() { - return extensions::BluetoothAPI::Get(browser()->profile()) - ->event_router(); + BluetoothEventRouter* event_router() { + return BluetoothAPI::Get(browser()->profile())->event_router(); } void SetName(const std::string& name, const base::Closure& callback) { @@ -92,10 +93,10 @@ class BluetoothPrivateApiTest : public ExtensionApiTest { scoped_ptr<base::ListValue> args = bt_private::OnPairing::Create(pairing_event); - scoped_ptr<extensions::Event> event( - new extensions::Event(bt_private::OnPairing::kEventName, args.Pass())); - extensions::EventRouter::Get(browser()->profile()) - ->DispatchEventToExtension(kTestExtensionId, event.Pass()); + scoped_ptr<Event> event( + new Event(bt_private::OnPairing::kEventName, args.Pass())); + EventRouter::Get(browser()->profile())->DispatchEventToExtension( + kTestExtensionId, event.Pass()); } void DispatchAuthorizePairingEvent() { @@ -181,3 +182,5 @@ IN_PROC_BROWSER_TEST_F(BluetoothPrivateApiTest, PasskeyPairing) { ASSERT_TRUE(RunComponentExtensionTest("bluetooth_private/passkey_pairing")) << message_; } + +} // namespace extensions diff --git a/chrome/browser/extensions/api/bluetooth_low_energy/OWNERS b/extensions/browser/api/bluetooth_low_energy/OWNERS index 7bf8537..7bf8537 100644 --- a/chrome/browser/extensions/api/bluetooth_low_energy/OWNERS +++ b/extensions/browser/api/bluetooth_low_energy/OWNERS diff --git a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_api.cc b/extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_api.cc index beb6e65..981a8a0 100644 --- a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_api.cc +++ b/extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_api.cc @@ -2,22 +2,22 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_api.h" +#include "extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_api.h" #include "base/bind.h" #include "base/lazy_instance.h" #include "base/strings/stringprintf.h" -#include "chrome/browser/extensions/api/bluetooth_low_energy/utils.h" -#include "chrome/common/extensions/api/bluetooth/bluetooth_manifest_data.h" -#include "chrome/common/extensions/api/bluetooth_low_energy.h" #include "content/public/browser/browser_thread.h" +#include "extensions/browser/api/bluetooth_low_energy/utils.h" #include "extensions/browser/event_router.h" +#include "extensions/common/api/bluetooth/bluetooth_manifest_data.h" +#include "extensions/common/api/bluetooth_low_energy.h" #include "extensions/common/permissions/permissions_data.h" using content::BrowserContext; using content::BrowserThread; -namespace apibtle = extensions::api::bluetooth_low_energy; +namespace apibtle = extensions::core_api::bluetooth_low_energy; namespace extensions { @@ -106,7 +106,7 @@ void BluetoothLowEnergyAPI::Shutdown() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); } -namespace api { +namespace core_api { BluetoothLowEnergyExtensionFunction::BluetoothLowEnergyExtensionFunction() { } @@ -769,5 +769,5 @@ void BluetoothLowEnergyWriteDescriptorValueFunction::ErrorCallback( SendResponse(false); } -} // namespace api +} // namespace core_api } // namespace extensions diff --git a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_api.h b/extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_api.h index 4165169..0d586b0 100644 --- a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_api.h +++ b/extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_api.h @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_API_H_ -#define CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_API_H_ +#ifndef EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_API_H_ +#define EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_API_H_ #include "base/memory/scoped_ptr.h" -#include "chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_event_router.h" +#include "extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_event_router.h" #include "extensions/browser/browser_context_keyed_api_factory.h" #include "extensions/browser/extension_function.h" #include "extensions/browser/extension_function_histogram_value.h" @@ -49,7 +49,7 @@ class BluetoothLowEnergyAPI : public BrowserContextKeyedAPI { DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyAPI); }; -namespace api { +namespace core_api { // Base class for bluetoothLowEnergy API functions. This class handles some of // the common logic involved in all API functions, such as checking for @@ -331,7 +331,7 @@ class BluetoothLowEnergyWriteDescriptorValueFunction std::string instance_id_; }; -} // namespace api +} // namespace core_api } // namespace extensions -#endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_API_H_ +#endif // EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_API_H_ diff --git a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_apitest.cc b/extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_apitest.cc index a04f151..ac09e45 100644 --- a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_apitest.cc +++ b/extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_apitest.cc @@ -3,8 +3,6 @@ // found in the LICENSE file. #include "base/memory/scoped_ptr.h" -#include "chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_api.h" -#include "chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_event_router.h" #include "chrome/browser/extensions/extension_apitest.h" #include "chrome/browser/extensions/extension_function_test_utils.h" #include "chrome/browser/extensions/extension_test_message_listener.h" @@ -15,6 +13,8 @@ #include "device/bluetooth/test/mock_bluetooth_gatt_descriptor.h" #include "device/bluetooth/test/mock_bluetooth_gatt_notify_session.h" #include "device/bluetooth/test/mock_bluetooth_gatt_service.h" +#include "extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_api.h" +#include "extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_event_router.h" #include "testing/gmock/include/gmock/gmock.h" using device::BluetoothUUID; diff --git a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_connection.cc b/extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_connection.cc index 51fd548..c52aea4 100644 --- a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_connection.cc +++ b/extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_connection.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_connection.h" +#include "extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_connection.h" namespace extensions { diff --git a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_connection.h b/extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_connection.h index f0fe124..f1b01fd 100644 --- a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_connection.h +++ b/extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_connection.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_CONNECTION_H_ -#define CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_CONNECTION_H_ +#ifndef EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_CONNECTION_H_ +#define EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_CONNECTION_H_ #include "base/memory/scoped_ptr.h" #include "device/bluetooth/bluetooth_gatt_connection.h" @@ -49,4 +49,4 @@ class BluetoothLowEnergyConnection : public ApiResource { } // namespace extensions -#endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_CONNECTION_H_ +#endif // EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_CONNECTION_H_ diff --git a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_event_router.cc b/extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_event_router.cc index 830bdec..f012ae4 100644 --- a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_event_router.cc +++ b/extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_event_router.cc @@ -2,22 +2,22 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_event_router.h" +#include "extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_event_router.h" #include "base/bind.h" #include "base/logging.h" #include "base/values.h" -#include "chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_connection.h" -#include "chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_notify_session.h" -#include "chrome/browser/extensions/api/bluetooth_low_energy/utils.h" -#include "chrome/common/extensions/api/bluetooth/bluetooth_manifest_data.h" #include "content/public/browser/browser_thread.h" #include "device/bluetooth/bluetooth_adapter_factory.h" #include "device/bluetooth/bluetooth_gatt_characteristic.h" #include "device/bluetooth/bluetooth_gatt_connection.h" #include "device/bluetooth/bluetooth_gatt_descriptor.h" +#include "extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_connection.h" +#include "extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_notify_session.h" +#include "extensions/browser/api/bluetooth_low_energy/utils.h" #include "extensions/browser/event_router.h" #include "extensions/browser/extension_registry.h" +#include "extensions/common/api/bluetooth/bluetooth_manifest_data.h" using content::BrowserThread; @@ -29,7 +29,7 @@ using device::BluetoothGattConnection; using device::BluetoothGattDescriptor; using device::BluetoothGattService; -namespace apibtle = extensions::api::bluetooth_low_energy; +namespace apibtle = extensions::core_api::bluetooth_low_energy; namespace { @@ -517,7 +517,7 @@ BluetoothLowEnergyEventRouter::Status BluetoothLowEnergyEventRouter::GetDescriptor( const Extension* extension, const std::string& instance_id, - api::bluetooth_low_energy::Descriptor* out_descriptor) const { + core_api::bluetooth_low_energy::Descriptor* out_descriptor) const { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(extension); DCHECK(out_descriptor); diff --git a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_event_router.h b/extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_event_router.h index 8445ad3..0cfab18 100644 --- a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_event_router.h +++ b/extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_event_router.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_EVENT_ROUTER_H_ -#define CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_EVENT_ROUTER_H_ +#ifndef EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_EVENT_ROUTER_H_ +#define EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_EVENT_ROUTER_H_ #include <map> #include <set> @@ -13,11 +13,11 @@ #include "base/callback.h" #include "base/memory/linked_ptr.h" #include "base/memory/weak_ptr.h" -#include "chrome/common/extensions/api/bluetooth_low_energy.h" #include "content/public/browser/notification_observer.h" #include "device/bluetooth/bluetooth_adapter.h" #include "device/bluetooth/bluetooth_device.h" #include "device/bluetooth/bluetooth_gatt_service.h" +#include "extensions/common/api/bluetooth_low_energy.h" namespace base { @@ -103,13 +103,14 @@ class BluetoothLowEnergyEventRouter const base::Closure& callback, const ErrorCallback& error_callback); - // Returns the list of api::bluetooth_low_energy::Service objects associated - // with the Bluetooth device with address |device_address| in |out_services|. + // Returns the list of core_api::bluetooth_low_energy::Service objects + // associated with the Bluetooth device with address |device_address| in + // |out_services|. // Returns false, if no device with the given address is known. If the device // is found but it has no GATT services, then returns true and leaves // |out_services| empty. Returns true, on success. |out_services| must not // be NULL. If it is non-empty, then its contents will be cleared. - typedef std::vector<linked_ptr<api::bluetooth_low_energy::Service> > + typedef std::vector<linked_ptr<core_api::bluetooth_low_energy::Service> > ServiceList; bool GetServices(const std::string& device_address, ServiceList* out_services) const; @@ -117,7 +118,7 @@ class BluetoothLowEnergyEventRouter // Populates |out_service| based on GATT service with instance ID // |instance_id|. |out_service| must not be NULL. Status GetService(const std::string& instance_id, - api::bluetooth_low_energy::Service* out_service) const; + core_api::bluetooth_low_energy::Service* out_service) const; // Populates |out_services| with the list of GATT services that are included // by the GATT service with instance ID |instance_id|. Returns false, if not @@ -127,7 +128,7 @@ class BluetoothLowEnergyEventRouter Status GetIncludedServices(const std::string& instance_id, ServiceList* out_services) const; - // Returns the list of api::bluetooth_low_energy::Characteristic objects + // Returns the list of core_api::bluetooth_low_energy::Characteristic objects // associated with the GATT service with instance ID |instance_id| in // |out_characteristics|. Returns false, if no service with the given instance // ID is known. If the service is found but it has no characteristics, then @@ -135,7 +136,8 @@ class BluetoothLowEnergyEventRouter // |out_characteristics| must not be NULL and if it is non-empty, // then its contents will be cleared. |extension| is the extension that made // the call. - typedef std::vector<linked_ptr<api::bluetooth_low_energy::Characteristic> > + typedef std::vector< + linked_ptr<core_api::bluetooth_low_energy::Characteristic> > CharacteristicList; Status GetCharacteristics(const Extension* extension, const std::string& instance_id, @@ -147,16 +149,16 @@ class BluetoothLowEnergyEventRouter Status GetCharacteristic( const Extension* extension, const std::string& instance_id, - api::bluetooth_low_energy::Characteristic* out_characteristic) const; + core_api::bluetooth_low_energy::Characteristic* out_characteristic) const; - // Returns the list of api::bluetooth_low_energy::Descriptor objects + // Returns the list of core_api::bluetooth_low_energy::Descriptor objects // associated with the GATT characteristic with instance ID |instance_id| in // |out_descriptors|. If the characteristic is found but it has no // descriptors, then returns true and leaves |out_descriptors| empty. // |out_descriptors| must not be NULL and if it is non-empty, // then its contents will be cleared. |extension| is the extension that made // the call. - typedef std::vector<linked_ptr<api::bluetooth_low_energy::Descriptor> > + typedef std::vector<linked_ptr<core_api::bluetooth_low_energy::Descriptor> > DescriptorList; Status GetDescriptors(const Extension* extension, const std::string& instance_id, @@ -168,7 +170,7 @@ class BluetoothLowEnergyEventRouter Status GetDescriptor( const Extension* extension, const std::string& instance_id, - api::bluetooth_low_energy::Descriptor* out_descriptor) const; + core_api::bluetooth_low_energy::Descriptor* out_descriptor) const; // Sends a request to read the value of the characteristic with intance ID // |instance_id|. Invokes |callback| on success and |error_callback| on @@ -413,4 +415,4 @@ class BluetoothLowEnergyEventRouter } // namespace extensions -#endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_EVENT_ROUTER_H_ +#endif // EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_EVENT_ROUTER_H_ diff --git a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_notify_session.cc b/extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_notify_session.cc index 281c7cc..bb8cad3 100644 --- a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_notify_session.cc +++ b/extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_notify_session.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_notify_session.h" +#include "extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_notify_session.h" namespace extensions { diff --git a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_notify_session.h b/extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_notify_session.h index 8cac5d9..e2699a4 100644 --- a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_notify_session.h +++ b/extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_notify_session.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_NOTIFY_SESSION_H_ -#define CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_NOTIFY_SESSION_H_ +#ifndef EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_NOTIFY_SESSION_H_ +#define EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_NOTIFY_SESSION_H_ #include <string> @@ -51,4 +51,4 @@ class BluetoothLowEnergyNotifySession : public ApiResource { } // namespace extensions -#endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_NOTIFY_SESSION_H_ +#endif // EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_NOTIFY_SESSION_H_ diff --git a/chrome/browser/extensions/api/bluetooth_low_energy/utils.cc b/extensions/browser/api/bluetooth_low_energy/utils.cc index c9f4b78..33eae2f 100644 --- a/chrome/browser/extensions/api/bluetooth_low_energy/utils.cc +++ b/extensions/browser/api/bluetooth_low_energy/utils.cc @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/api/bluetooth_low_energy/utils.h" +#include "extensions/browser/api/bluetooth_low_energy/utils.h" namespace extensions { -namespace api { +namespace core_api { namespace bluetooth_low_energy { namespace { @@ -52,5 +52,5 @@ scoped_ptr<base::DictionaryValue> DescriptorToValue(Descriptor* from) { } } // namespace bluetooth_low_energy -} // namespace api +} // namespace core_api } // namespace extensions diff --git a/chrome/browser/extensions/api/bluetooth_low_energy/utils.h b/extensions/browser/api/bluetooth_low_energy/utils.h index b58a6c5..35b40c6 100644 --- a/chrome/browser/extensions/api/bluetooth_low_energy/utils.h +++ b/extensions/browser/api/bluetooth_low_energy/utils.h @@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_UTILS_H_ -#define CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_UTILS_H_ +#ifndef EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_UTILS_H_ +#define EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_UTILS_H_ #include "base/memory/scoped_ptr.h" #include "base/values.h" -#include "chrome/common/extensions/api/bluetooth_low_energy.h" +#include "extensions/common/api/bluetooth_low_energy.h" namespace extensions { -namespace api { +namespace core_api { namespace bluetooth_low_energy { // TODO(armansito): Remove these functions once the described bug is fixed. @@ -28,7 +28,7 @@ scoped_ptr<base::DictionaryValue> CharacteristicToValue(Characteristic* from); scoped_ptr<base::DictionaryValue> DescriptorToValue(Descriptor* from); } // namespace bluetooth_low_energy -} // namespace api +} // namespace core_api } // namespace extensions -#endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_UTILS_H_ +#endif // EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_UTILS_H_ diff --git a/chrome/browser/extensions/api/bluetooth_socket/OWNERS b/extensions/browser/api/bluetooth_socket/OWNERS index 53dafd5..53dafd5 100644 --- a/chrome/browser/extensions/api/bluetooth_socket/OWNERS +++ b/extensions/browser/api/bluetooth_socket/OWNERS diff --git a/chrome/browser/extensions/api/bluetooth_socket/bluetooth_api_socket.cc b/extensions/browser/api/bluetooth_socket/bluetooth_api_socket.cc index da0c5e0..8dbde0e 100644 --- a/chrome/browser/extensions/api/bluetooth_socket/bluetooth_api_socket.cc +++ b/extensions/browser/api/bluetooth_socket/bluetooth_api_socket.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/api/bluetooth_socket/bluetooth_api_socket.h" +#include "extensions/browser/api/bluetooth_socket/bluetooth_api_socket.h" #include "device/bluetooth/bluetooth_socket.h" #include "net/base/io_buffer.h" diff --git a/chrome/browser/extensions/api/bluetooth_socket/bluetooth_api_socket.h b/extensions/browser/api/bluetooth_socket/bluetooth_api_socket.h index 8e6976e..3d0efd4 100644 --- a/chrome/browser/extensions/api/bluetooth_socket/bluetooth_api_socket.h +++ b/extensions/browser/api/bluetooth_socket/bluetooth_api_socket.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_SOCKET_BLUETOOTH_API_SOCKET_H_ -#define CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_SOCKET_BLUETOOTH_API_SOCKET_H_ +#ifndef EXTENSIONS_BROWSER_API_BLUETOOTH_SOCKET_BLUETOOTH_API_SOCKET_H_ +#define EXTENSIONS_BROWSER_API_BLUETOOTH_SOCKET_BLUETOOTH_API_SOCKET_H_ #include <string> @@ -158,4 +158,4 @@ class BluetoothApiSocket : public ApiResource { } // namespace extensions -#endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_SOCKET_BLUETOOTH_API_SOCKET_H_ +#endif // EXTENSIONS_BROWSER_API_BLUETOOTH_SOCKET_BLUETOOTH_API_SOCKET_H_ diff --git a/chrome/browser/extensions/api/bluetooth_socket/bluetooth_socket_api.cc b/extensions/browser/api/bluetooth_socket/bluetooth_socket_api.cc index cbd8f83..77d19d1 100644 --- a/chrome/browser/extensions/api/bluetooth_socket/bluetooth_socket_api.cc +++ b/extensions/browser/api/bluetooth_socket/bluetooth_socket_api.cc @@ -2,27 +2,30 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/api/bluetooth_socket/bluetooth_socket_api.h" +#include "extensions/browser/api/bluetooth_socket/bluetooth_socket_api.h" #include <stdint.h> -#include "chrome/browser/extensions/api/bluetooth_socket/bluetooth_api_socket.h" -#include "chrome/browser/extensions/api/bluetooth_socket/bluetooth_socket_event_dispatcher.h" -#include "chrome/common/extensions/api/bluetooth/bluetooth_manifest_data.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h" #include "device/bluetooth/bluetooth_adapter.h" #include "device/bluetooth/bluetooth_adapter_factory.h" #include "device/bluetooth/bluetooth_device.h" #include "device/bluetooth/bluetooth_socket.h" +#include "extensions/browser/api/bluetooth_socket/bluetooth_api_socket.h" +#include "extensions/browser/api/bluetooth_socket/bluetooth_socket_event_dispatcher.h" +#include "extensions/common/api/bluetooth/bluetooth_manifest_data.h" #include "extensions/common/permissions/permissions_data.h" #include "net/base/io_buffer.h" using content::BrowserThread; using extensions::BluetoothApiSocket; -using extensions::api::bluetooth_socket::ListenOptions; -using extensions::api::bluetooth_socket::SocketInfo; -using extensions::api::bluetooth_socket::SocketProperties; +using extensions::core_api::bluetooth_socket::ListenOptions; +using extensions::core_api::bluetooth_socket::SocketInfo; +using extensions::core_api::bluetooth_socket::SocketProperties; + +namespace extensions { +namespace core_api { namespace { @@ -71,10 +74,10 @@ void SetSocketProperties(BluetoothApiSocket* socket, } } -extensions::api::BluetoothSocketEventDispatcher* GetSocketEventDispatcher( +BluetoothSocketEventDispatcher* GetSocketEventDispatcher( content::BrowserContext* browser_context) { - extensions::api::BluetoothSocketEventDispatcher* socket_event_dispatcher = - extensions::api::BluetoothSocketEventDispatcher::Get(browser_context); + BluetoothSocketEventDispatcher* socket_event_dispatcher = + BluetoothSocketEventDispatcher::Get(browser_context); DCHECK(socket_event_dispatcher) << "There is no socket event dispatcher. " "If this assertion is failing during a test, then it is likely that " @@ -113,9 +116,6 @@ bool IsValidPsm(int psm) { } // namespace -namespace extensions { -namespace api { - BluetoothSocketAsyncApiFunction::BluetoothSocketAsyncApiFunction() {} BluetoothSocketAsyncApiFunction::~BluetoothSocketAsyncApiFunction() {} @@ -674,5 +674,5 @@ void BluetoothSocketGetSocketsFunction::Work() { results_ = bluetooth_socket::GetSockets::Results::Create(socket_infos); } -} // namespace api +} // namespace core_api } // namespace extensions diff --git a/chrome/browser/extensions/api/bluetooth_socket/bluetooth_socket_api.h b/extensions/browser/api/bluetooth_socket/bluetooth_socket_api.h index 34da64b..d809a0a 100644 --- a/chrome/browser/extensions/api/bluetooth_socket/bluetooth_socket_api.h +++ b/extensions/browser/api/bluetooth_socket/bluetooth_socket_api.h @@ -2,21 +2,21 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_SOCKET_BLUETOOTH_SOCKET_API_H_ -#define CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_SOCKET_BLUETOOTH_SOCKET_API_H_ +#ifndef EXTENSIONS_BROWSER_API_BLUETOOTH_SOCKET_BLUETOOTH_SOCKET_API_H_ +#define EXTENSIONS_BROWSER_API_BLUETOOTH_SOCKET_BLUETOOTH_SOCKET_API_H_ #include <string> #include "base/containers/hash_tables.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" -#include "chrome/browser/extensions/api/bluetooth_socket/bluetooth_api_socket.h" -#include "chrome/common/extensions/api/bluetooth_socket.h" #include "device/bluetooth/bluetooth_adapter.h" #include "extensions/browser/api/api_resource_manager.h" #include "extensions/browser/api/async_api_function.h" +#include "extensions/browser/api/bluetooth_socket/bluetooth_api_socket.h" #include "extensions/browser/extension_function.h" #include "extensions/browser/extension_function_histogram_value.h" +#include "extensions/common/api/bluetooth_socket.h" namespace device { class BluetoothSocket; @@ -28,7 +28,7 @@ class IOBuffer; namespace extensions { -namespace api { +namespace core_api { class BluetoothSocketEventDispatcher; @@ -346,7 +346,7 @@ class BluetoothSocketGetSocketsFunction virtual void Work() OVERRIDE; }; -} // namespace api +} // namespace core_api } // namespace extensions -#endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_SOCKET_BLUETOOTH_SOCKET_API_H_ +#endif // EXTENSIONS_BROWSER_API_BLUETOOTH_SOCKET_BLUETOOTH_SOCKET_API_H_ diff --git a/chrome/browser/extensions/api/bluetooth_socket/bluetooth_socket_apitest.cc b/extensions/browser/api/bluetooth_socket/bluetooth_socket_apitest.cc index 7ed4132..4fefdc5 100644 --- a/chrome/browser/extensions/api/bluetooth_socket/bluetooth_socket_apitest.cc +++ b/extensions/browser/api/bluetooth_socket/bluetooth_socket_apitest.cc @@ -6,7 +6,6 @@ #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" -#include "chrome/browser/extensions/api/bluetooth_socket/bluetooth_socket_api.h" #include "chrome/browser/extensions/extension_apitest.h" #include "chrome/browser/extensions/extension_function_test_utils.h" #include "chrome/browser/extensions/extension_service.h" @@ -18,6 +17,7 @@ #include "device/bluetooth/test/mock_bluetooth_adapter.h" #include "device/bluetooth/test/mock_bluetooth_device.h" #include "device/bluetooth/test/mock_bluetooth_socket.h" +#include "extensions/browser/api/bluetooth_socket/bluetooth_socket_api.h" #include "testing/gmock/include/gmock/gmock.h" using device::BluetoothAdapter; @@ -31,7 +31,7 @@ using device::MockBluetoothSocket; using extensions::Extension; namespace utils = extension_function_test_utils; -namespace api = extensions::api; +namespace api = extensions::core_api; namespace { diff --git a/chrome/browser/extensions/api/bluetooth_socket/bluetooth_socket_event_dispatcher.cc b/extensions/browser/api/bluetooth_socket/bluetooth_socket_event_dispatcher.cc index e96d3fc..51ca9b0 100644 --- a/chrome/browser/extensions/api/bluetooth_socket/bluetooth_socket_event_dispatcher.cc +++ b/extensions/browser/api/bluetooth_socket/bluetooth_socket_event_dispatcher.cc @@ -2,20 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/api/bluetooth_socket/bluetooth_socket_event_dispatcher.h" +#include "extensions/browser/api/bluetooth_socket/bluetooth_socket_event_dispatcher.h" -#include "chrome/browser/browser_process.h" -#include "chrome/browser/extensions/api/bluetooth_socket/bluetooth_api_socket.h" -#include "chrome/common/extensions/api/bluetooth_socket.h" #include "device/bluetooth/bluetooth_device.h" #include "device/bluetooth/bluetooth_socket.h" +#include "extensions/browser/api/bluetooth_socket/bluetooth_api_socket.h" #include "extensions/browser/event_router.h" +#include "extensions/common/api/bluetooth_socket.h" #include "net/base/io_buffer.h" -#include "net/base/net_errors.h" namespace { -namespace bluetooth_socket = extensions::api::bluetooth_socket; +namespace bluetooth_socket = extensions::core_api::bluetooth_socket; using extensions::BluetoothApiSocket; int kDefaultBufferSize = 4096; @@ -55,7 +53,7 @@ bluetooth_socket::AcceptError MapAcceptErrorReason( } // namespace namespace extensions { -namespace api { +namespace core_api { using content::BrowserThread; @@ -368,5 +366,5 @@ void BluetoothSocketEventDispatcher::DispatchEvent( router->DispatchEventToExtension(extension_id, event.Pass()); } -} // namespace api +} // namespace core_api } // namespace extensions diff --git a/chrome/browser/extensions/api/bluetooth_socket/bluetooth_socket_event_dispatcher.h b/extensions/browser/api/bluetooth_socket/bluetooth_socket_event_dispatcher.h index eceaf4c..50c246a 100644 --- a/chrome/browser/extensions/api/bluetooth_socket/bluetooth_socket_event_dispatcher.h +++ b/extensions/browser/api/bluetooth_socket/bluetooth_socket_event_dispatcher.h @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_SOCKET_BLUETOOTH_SOCKET_EVENT_DISPATCHER_H_ -#define CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_SOCKET_BLUETOOTH_SOCKET_EVENT_DISPATCHER_H_ +#ifndef EXTENSIONS_BROWSER_API_BLUETOOTH_SOCKET_BLUETOOTH_SOCKET_EVENT_DISPATCHER_H_ +#define EXTENSIONS_BROWSER_API_BLUETOOTH_SOCKET_BLUETOOTH_SOCKET_EVENT_DISPATCHER_H_ -#include "chrome/browser/extensions/api/bluetooth_socket/bluetooth_api_socket.h" #include "extensions/browser/api/api_resource_manager.h" +#include "extensions/browser/api/bluetooth_socket/bluetooth_api_socket.h" #include "extensions/browser/browser_context_keyed_api_factory.h" namespace content { @@ -24,7 +24,7 @@ class BluetoothApiSocket; } namespace extensions { -namespace api { +namespace core_api { // Dispatch events related to "bluetooth" sockets from callback on native socket // instances. There is one instance per browser context. @@ -113,7 +113,7 @@ class BluetoothSocketEventDispatcher scoped_refptr<SocketData> sockets_; }; -} // namespace api +} // namespace core_api } // namespace extensions -#endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_SOCKET_BLUETOOTH_SOCKET_EVENT_DISPATCHER_H_ +#endif // EXTENSIONS_BROWSER_API_BLUETOOTH_SOCKET_BLUETOOTH_SOCKET_EVENT_DISPATCHER_H_ diff --git a/extensions/common/BUILD.gn b/extensions/common/BUILD.gn index ab22d4c..7c26d6c 100644 --- a/extensions/common/BUILD.gn +++ b/extensions/common/BUILD.gn @@ -8,6 +8,12 @@ import("//build/config/features.gni") source_set("common") { sources = [ "api/messaging/message.h", + "api/bluetooth/bluetooth_manifest_data.cc", + "api/bluetooth/bluetooth_manifest_data.h", + "api/bluetooth/bluetooth_manifest_handler.cc", + "api/bluetooth/bluetooth_manifest_handler.h", + "api/bluetooth/bluetooth_manifest_permission.cc", + "api/bluetooth/bluetooth_manifest_permission.h", "api/sockets/sockets_manifest_data.cc", "api/sockets/sockets_manifest_data.h", "api/sockets/sockets_manifest_handler.cc", @@ -207,10 +213,17 @@ source_set("common") { ] deps += [ + "//device/bluetooth", "//device/usb", ] } else { sources -= [ + "api/bluetooth/bluetooth_manifest_data.cc", + "api/bluetooth/bluetooth_manifest_data.h", + "api/bluetooth/bluetooth_manifest_handler.cc", + "api/bluetooth/bluetooth_manifest_handler.h", + "api/bluetooth/bluetooth_manifest_permission.cc", + "api/bluetooth/bluetooth_manifest_permission.h", "api/messaging/message.h", "api/sockets/sockets_manifest_data.cc", "api/sockets/sockets_manifest_data.h", diff --git a/extensions/common/DEPS b/extensions/common/DEPS index 9cfa5de..bef368e1 100644 --- a/extensions/common/DEPS +++ b/extensions/common/DEPS @@ -1,4 +1,5 @@ include_rules = [ + "+device/bluetooth", # For BluetoothPermission "+device/usb", "+grit/extensions_strings.h", "+libxml", diff --git a/chrome/common/extensions/api/bluetooth.idl b/extensions/common/api/bluetooth.idl index 1febc8b..1febc8b 100644 --- a/chrome/common/extensions/api/bluetooth.idl +++ b/extensions/common/api/bluetooth.idl diff --git a/chrome/common/extensions/api/bluetooth/bluetooth_manifest_data.cc b/extensions/common/api/bluetooth/bluetooth_manifest_data.cc index e7b9213..4d777cf 100644 --- a/chrome/common/extensions/api/bluetooth/bluetooth_manifest_data.cc +++ b/extensions/common/api/bluetooth/bluetooth_manifest_data.cc @@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/extensions/api/bluetooth/bluetooth_manifest_data.h" +#include "extensions/common/api/bluetooth/bluetooth_manifest_data.h" -#include "chrome/common/extensions/api/bluetooth/bluetooth_manifest_permission.h" +#include "extensions/common/api/bluetooth/bluetooth_manifest_permission.h" #include "extensions/common/manifest_constants.h" namespace extensions { diff --git a/chrome/common/extensions/api/bluetooth/bluetooth_manifest_data.h b/extensions/common/api/bluetooth/bluetooth_manifest_data.h index 30ea7b8..191a1ec 100644 --- a/chrome/common/extensions/api/bluetooth/bluetooth_manifest_data.h +++ b/extensions/common/api/bluetooth/bluetooth_manifest_data.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_COMMON_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_MANIFEST_DATA_H_ -#define CHROME_COMMON_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_MANIFEST_DATA_H_ +#ifndef EXTENSIONS_COMMON_API_BLUETOOTH_BLUETOOTH_MANIFEST_DATA_H_ +#define EXTENSIONS_COMMON_API_BLUETOOTH_BLUETOOTH_MANIFEST_DATA_H_ #include <vector> @@ -58,4 +58,4 @@ struct BluetoothPermissionRequest { } // namespace extensions -#endif // CHROME_COMMON_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_MANIFEST_DATA_H_ +#endif // EXTENSIONS_COMMON_API_BLUETOOTH_BLUETOOTH_MANIFEST_DATA_H_ diff --git a/chrome/common/extensions/api/bluetooth/bluetooth_manifest_handler.cc b/extensions/common/api/bluetooth/bluetooth_manifest_handler.cc index e2b9cf3..da143fa 100644 --- a/chrome/common/extensions/api/bluetooth/bluetooth_manifest_handler.cc +++ b/extensions/common/api/bluetooth/bluetooth_manifest_handler.cc @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/extensions/api/bluetooth/bluetooth_manifest_handler.h" +#include "extensions/common/api/bluetooth/bluetooth_manifest_handler.h" -#include "chrome/common/extensions/api/bluetooth/bluetooth_manifest_data.h" -#include "chrome/common/extensions/api/bluetooth/bluetooth_manifest_permission.h" +#include "extensions/common/api/bluetooth/bluetooth_manifest_data.h" +#include "extensions/common/api/bluetooth/bluetooth_manifest_permission.h" #include "extensions/common/extension.h" #include "extensions/common/manifest_constants.h" diff --git a/chrome/common/extensions/api/bluetooth/bluetooth_manifest_handler.h b/extensions/common/api/bluetooth/bluetooth_manifest_handler.h index 2c93502..cd4224e 100644 --- a/chrome/common/extensions/api/bluetooth/bluetooth_manifest_handler.h +++ b/extensions/common/api/bluetooth/bluetooth_manifest_handler.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_COMMON_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_MANIFEST_HANDLER_H_ -#define CHROME_COMMON_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_MANIFEST_HANDLER_H_ +#ifndef EXTENSIONS_COMMON_API_BLUETOOTH_BLUETOOTH_MANIFEST_HANDLER_H_ +#define EXTENSIONS_COMMON_API_BLUETOOTH_BLUETOOTH_MANIFEST_HANDLER_H_ #include <string> #include <vector> @@ -38,4 +38,4 @@ class BluetoothManifestHandler : public ManifestHandler { } // namespace extensions -#endif // CHROME_COMMON_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_MANIFEST_HANDLER_H_ +#endif // EXTENSIONS_COMMON_API_BLUETOOTH_BLUETOOTH_MANIFEST_HANDLER_H_ diff --git a/chrome/common/extensions/api/bluetooth/bluetooth_manifest_permission.cc b/extensions/common/api/bluetooth/bluetooth_manifest_permission.cc index 8313cae..e441e55 100644 --- a/chrome/common/extensions/api/bluetooth/bluetooth_manifest_permission.cc +++ b/extensions/common/api/bluetooth/bluetooth_manifest_permission.cc @@ -2,19 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/extensions/api/bluetooth/bluetooth_manifest_permission.h" +#include "extensions/common/api/bluetooth/bluetooth_manifest_permission.h" #include "base/memory/scoped_ptr.h" #include "base/stl_util.h" #include "base/strings/utf_string_conversions.h" #include "base/values.h" -#include "chrome/common/extensions/api/bluetooth/bluetooth_manifest_data.h" -#include "chrome/common/extensions/api/manifest_types.h" -#include "chrome/grit/generated_resources.h" #include "device/bluetooth/bluetooth_uuid.h" +#include "extensions/common/api/bluetooth/bluetooth_manifest_data.h" +#include "extensions/common/api/extensions_manifest_types.h" #include "extensions/common/error_utils.h" #include "extensions/common/extension_messages.h" #include "extensions/common/manifest_constants.h" +#include "grit/extensions_strings.h" #include "ipc/ipc_message.h" #include "ui/base/l10n/l10n_util.h" @@ -66,8 +66,8 @@ BluetoothManifestPermission::~BluetoothManifestPermission() {} scoped_ptr<BluetoothManifestPermission> BluetoothManifestPermission::FromValue( const base::Value& value, base::string16* error) { - scoped_ptr<api::manifest_types::Bluetooth> bluetooth = - api::manifest_types::Bluetooth::FromValue(value, error); + scoped_ptr<core_api::extensions_manifest_types::Bluetooth> bluetooth = + core_api::extensions_manifest_types::Bluetooth::FromValue(value, error); if (!bluetooth) return scoped_ptr<BluetoothManifestPermission>(); @@ -153,7 +153,7 @@ bool BluetoothManifestPermission::FromValue(const base::Value* value) { } scoped_ptr<base::Value> BluetoothManifestPermission::ToValue() const { - api::manifest_types::Bluetooth bluetooth; + core_api::extensions_manifest_types::Bluetooth bluetooth; bluetooth.uuids.reset(new std::vector<std::string>(uuids_.begin(), uuids_.end())); return bluetooth.ToValue().PassAs<base::Value>(); diff --git a/chrome/common/extensions/api/bluetooth/bluetooth_manifest_permission.h b/extensions/common/api/bluetooth/bluetooth_manifest_permission.h index 5c22645..4bbad21 100644 --- a/chrome/common/extensions/api/bluetooth/bluetooth_manifest_permission.h +++ b/extensions/common/api/bluetooth/bluetooth_manifest_permission.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_COMMON_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_MANIFEST_PERMISSION_H_ -#define CHROME_COMMON_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_MANIFEST_PERMISSION_H_ +#ifndef EXTENSIONS_COMMON_API_BLUETOOTH_BLUETOOTH_MANIFEST_PERMISSION_H_ +#define EXTENSIONS_COMMON_API_BLUETOOTH_BLUETOOTH_MANIFEST_PERMISSION_H_ #include <set> #include <vector> @@ -66,4 +66,4 @@ class BluetoothManifestPermission : public ManifestPermission { } // namespace extensions -#endif // CHROME_COMMON_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_MANIFEST_PERMISSION_H_ +#endif // EXTENSIONS_COMMON_API_BLUETOOTH_BLUETOOTH_MANIFEST_PERMISSION_H_ diff --git a/chrome/common/extensions/api/bluetooth_low_energy.idl b/extensions/common/api/bluetooth_low_energy.idl index 517a813..517a813 100644 --- a/chrome/common/extensions/api/bluetooth_low_energy.idl +++ b/extensions/common/api/bluetooth_low_energy.idl diff --git a/chrome/common/extensions/api/bluetooth_private.json b/extensions/common/api/bluetooth_private.json index d805724..20c82f1 100644 --- a/chrome/common/extensions/api/bluetooth_private.json +++ b/extensions/common/api/bluetooth_private.json @@ -3,7 +3,7 @@ "namespace": "bluetoothPrivate", "description": " Use the <code>chrome.bluetoothPrivate</code> API to control the Bluetooth\n adapter state and handle device pairing.", "compiler_options": { - "implemented_in": "chrome/browser/extensions/api/bluetooth/bluetooth_private_api.h" + "implemented_in": "extensions/browser/api/bluetooth/bluetooth_private_api.h" }, "functions": [ { diff --git a/chrome/common/extensions/api/bluetooth_socket.idl b/extensions/common/api/bluetooth_socket.idl index cb95c02..cb95c02 100644 --- a/chrome/common/extensions/api/bluetooth_socket.idl +++ b/extensions/common/api/bluetooth_socket.idl diff --git a/extensions/common/api/extensions_manifest_types.json b/extensions/common/api/extensions_manifest_types.json index 00262692..6e8e7ee 100644 --- a/extensions/common/api/extensions_manifest_types.json +++ b/extensions/common/api/extensions_manifest_types.json @@ -98,6 +98,32 @@ } } } + }, + { + "id": "bluetooth", + "type": "object", + "description": "The <code>bluetooth</code> manifest property give permission to an app to use the $(ref:bluetooth) API. A list of UUIDs can be optionally specified to enable communication with devices.", + "properties": { + "uuids": { + "description": "The <code>uuids</code> manifest property declares the list of protocols, profiles and services that an app can communicate using.", + "optional": true, + "type": "array", + "items": { + "description": "<p>The list specified as UUID strings.</p>", + "type": "string" + } + }, + "socket": { + "type": "boolean", + "description": "If <code>true</code>, gives permission to an app to use the $(ref:bluetoothSocket) API", + "optional": true + }, + "low_energy": { + "type": "boolean", + "description": "If <code>true</code>, gives permission to an app to use the $(ref:bluetoothLowEnergy) API", + "optional": true + } + } } ] } diff --git a/extensions/common/api/schemas.gypi b/extensions/common/api/schemas.gypi index 52370c9..9d9c2be 100644 --- a/extensions/common/api/schemas.gypi +++ b/extensions/common/api/schemas.gypi @@ -15,6 +15,10 @@ 'main_schema_files': [ 'app_runtime.idl', 'app_view_internal.json', + 'bluetooth.idl', + 'bluetooth_low_energy.idl', + 'bluetooth_private.json', + 'bluetooth_socket.idl', 'cast_channel.idl', 'dns.idl', 'extensions_manifest_types.json', diff --git a/extensions/extensions.gyp b/extensions/extensions.gyp index ad33421..4ce60a6 100644 --- a/extensions/extensions.gyp +++ b/extensions/extensions.gyp @@ -37,6 +37,12 @@ ], 'sources': [ # Note: sources list duplicated in GN build. + 'common/api/bluetooth/bluetooth_manifest_data.cc', + 'common/api/bluetooth/bluetooth_manifest_data.h', + 'common/api/bluetooth/bluetooth_manifest_handler.cc', + 'common/api/bluetooth/bluetooth_manifest_handler.h', + 'common/api/bluetooth/bluetooth_manifest_permission.cc', + 'common/api/bluetooth/bluetooth_manifest_permission.h', 'common/api/messaging/message.h', 'common/api/sockets/sockets_manifest_data.cc', 'common/api/sockets/sockets_manifest_data.h', @@ -215,6 +221,7 @@ 'conditions': [ ['enable_extensions==1', { 'dependencies': [ + '../device/bluetooth/bluetooth.gyp:device_bluetooth', # For Mojo generated headers for generated_api.cc. '../device/serial/serial.gyp:device_serial_mojo', '../device/usb/usb.gyp:device_usb', @@ -224,6 +231,12 @@ ], }, { # enable_extensions == 0 'sources!': [ + 'common/api/bluetooth/bluetooth_manifest_data.cc', + 'common/api/bluetooth/bluetooth_manifest_data.h', + 'common/api/bluetooth/bluetooth_manifest_handler.cc', + 'common/api/bluetooth/bluetooth_manifest_handler.h', + 'common/api/bluetooth/bluetooth_manifest_permission.cc', + 'common/api/bluetooth/bluetooth_manifest_permission.h', 'common/api/messaging/message.h', 'common/api/sockets/sockets_manifest_data.cc', 'common/api/sockets/sockets_manifest_data.h', @@ -260,6 +273,7 @@ '../components/components.gyp:usb_service', '../components/components.gyp:web_modal', '../content/content.gyp:content_browser', + '../device/bluetooth/bluetooth.gyp:device_bluetooth', '../device/serial/serial.gyp:device_serial', '../skia/skia.gyp:skia', '../third_party/leveldatabase/leveldatabase.gyp:leveldatabase', @@ -294,6 +308,34 @@ 'browser/api/guest_view/guest_view_internal_api.h', 'browser/api/async_api_function.cc', 'browser/api/async_api_function.h', + 'browser/api/bluetooth/bluetooth_api.cc', + 'browser/api/bluetooth/bluetooth_api.h', + 'browser/api/bluetooth/bluetooth_api_pairing_delegate.cc', + 'browser/api/bluetooth/bluetooth_api_pairing_delegate.h', + 'browser/api/bluetooth/bluetooth_api_utils.cc', + 'browser/api/bluetooth/bluetooth_api_utils.h', + 'browser/api/bluetooth/bluetooth_event_router.cc', + 'browser/api/bluetooth/bluetooth_event_router.h', + 'browser/api/bluetooth/bluetooth_extension_function.cc', + 'browser/api/bluetooth/bluetooth_extension_function.h', + 'browser/api/bluetooth/bluetooth_private_api.cc', + 'browser/api/bluetooth/bluetooth_private_api.h', + 'browser/api/bluetooth_low_energy/bluetooth_low_energy_api.cc', + 'browser/api/bluetooth_low_energy/bluetooth_low_energy_api.h', + 'browser/api/bluetooth_low_energy/bluetooth_low_energy_connection.cc', + 'browser/api/bluetooth_low_energy/bluetooth_low_energy_connection.h', + 'browser/api/bluetooth_low_energy/bluetooth_low_energy_event_router.cc', + 'browser/api/bluetooth_low_energy/bluetooth_low_energy_event_router.h', + 'browser/api/bluetooth_low_energy/bluetooth_low_energy_notify_session.cc', + 'browser/api/bluetooth_low_energy/bluetooth_low_energy_notify_session.h', + 'browser/api/bluetooth_low_energy/utils.cc', + 'browser/api/bluetooth_low_energy/utils.h', + 'browser/api/bluetooth_socket/bluetooth_api_socket.cc', + 'browser/api/bluetooth_socket/bluetooth_api_socket.h', + 'browser/api/bluetooth_socket/bluetooth_socket_api.cc', + 'browser/api/bluetooth_socket/bluetooth_socket_api.h', + 'browser/api/bluetooth_socket/bluetooth_socket_event_dispatcher.cc', + 'browser/api/bluetooth_socket/bluetooth_socket_event_dispatcher.h', 'browser/api/cast_channel/cast_auth_util.cc', 'browser/api/cast_channel/cast_auth_util.h', 'browser/api/cast_channel/cast_channel_api.cc', @@ -580,6 +622,7 @@ ], 'dependencies!': [ '../components/components.gyp:usb_service', + '../device/bluetooth/bluetooth.gyp:device_bluetooth', '../device/serial/serial.gyp:device_serial', ], }], diff --git a/extensions/extensions_strings.grd b/extensions/extensions_strings.grd index 603e99f..f499f6c 100644 --- a/extensions/extensions_strings.grd +++ b/extensions/extensions_strings.grd @@ -199,7 +199,15 @@ <message name="IDS_EXTENSION_MANIFEST_INVALID" desc=""> Manifest file is invalid. </message> - + + <!-- Bluetooth access permissions. Please keep alphabetized. --> + <message name="IDS_EXTENSION_PROMPT_WARNING_BLUETOOTH" desc="Permission string for general access to the Bluetooth API."> + Access information about Bluetooth devices paired with your system and discover nearby Bluetooth devices. + </message> + <message name="IDS_EXTENSION_PROMPT_WARNING_BLUETOOTH_DEVICES" desc="Permission string for implementing Bluetooth profiles."> + Send messages to and receive messages from Bluetooth devices. + </message> + <!-- Host access permissions. Please keep alphabetized. --> <message name="IDS_EXTENSION_PROMPT_WARNING_1_HOST" desc="Permission string for access to data on one website."> Read and change your data on <ph name="WEBSITE_1">$1<ex>www.google.com</ex></ph> @@ -277,7 +285,7 @@ <message name="IDS_EXTENSION_PROMPT_WARNING_SOCKET_SPECIFIC_HOSTS" desc="Permission string for access to multiple specific computers on the local network or internet."> Exchange data with the computers named: <ph name="HOSTNAMES">$1<ex>foo.example.com bar.example.com</ex></ph> </message> - + <!-- Device API strings. Please keep alphabetized. --> <message name="IDS_EXTENSION_PROMPT_WARNING_HID" desc="Permission string for access to HID devices."> Access your input devices |