| Index: trunk/src/chrome/browser/extensions/api/bluetooth/bluetooth_api.cc
|
| ===================================================================
|
| --- trunk/src/chrome/browser/extensions/api/bluetooth/bluetooth_api.cc (revision 261569)
|
| +++ trunk/src/chrome/browser/extensions/api/bluetooth/bluetooth_api.cc (working copy)
|
| @@ -19,6 +19,7 @@
|
| #include "device/bluetooth/bluetooth_profile.h"
|
| #include "device/bluetooth/bluetooth_service_record.h"
|
| #include "device/bluetooth/bluetooth_socket.h"
|
| +#include "device/bluetooth/bluetooth_utils.h"
|
| #include "extensions/browser/event_router.h"
|
| #include "extensions/browser/extension_system.h"
|
| #include "extensions/common/permissions/permissions_data.h"
|
| @@ -133,9 +134,7 @@
|
| scoped_ptr<AddProfile::Params> params(AddProfile::Params::Create(*args_));
|
| EXTENSION_FUNCTION_VALIDATE(params.get() != NULL);
|
|
|
| - device::BluetoothUUID uuid(params->profile.uuid);
|
| -
|
| - if (!uuid.IsValid()) {
|
| + if (!BluetoothDevice::IsUUIDValid(params->profile.uuid)) {
|
| SetError(kInvalidUuid);
|
| return false;
|
| }
|
| @@ -146,7 +145,7 @@
|
| return false;
|
| }
|
|
|
| - uuid_ = uuid;
|
| + uuid_ = device::bluetooth_utils::CanonicalUuid(params->profile.uuid);
|
|
|
| if (GetEventRouter(browser_context())->HasProfile(uuid_)) {
|
| SetError(kProfileAlreadyRegistered);
|
| @@ -217,13 +216,14 @@
|
| scoped_ptr<RemoveProfile::Params> params(
|
| RemoveProfile::Params::Create(*args_));
|
|
|
| - device::BluetoothUUID uuid(params->profile.uuid);
|
| -
|
| - if (!uuid.IsValid()) {
|
| + if (!BluetoothDevice::IsUUIDValid(params->profile.uuid)) {
|
| SetError(kInvalidUuid);
|
| return false;
|
| }
|
|
|
| + std::string uuid =
|
| + device::bluetooth_utils::CanonicalUuid(params->profile.uuid);
|
| +
|
| if (!GetEventRouter(browser_context())->HasProfile(uuid)) {
|
| SetError(kProfileNotFound);
|
| return false;
|
| @@ -303,9 +303,7 @@
|
| EXTENSION_FUNCTION_VALIDATE(params.get() != NULL);
|
| const bluetooth::ConnectOptions& options = params->options;
|
|
|
| - device::BluetoothUUID uuid(options.profile.uuid);
|
| -
|
| - if (!uuid.IsValid()) {
|
| + if (!BluetoothDevice::IsUUIDValid(options.profile.uuid)) {
|
| SetError(kInvalidUuid);
|
| SendResponse(false);
|
| return false;
|
| @@ -318,6 +316,9 @@
|
| return false;
|
| }
|
|
|
| + std::string uuid = device::bluetooth_utils::CanonicalUuid(
|
| + options.profile.uuid);
|
| +
|
| BluetoothProfile* bluetooth_profile =
|
| GetEventRouter(browser_context())->GetProfile(uuid);
|
| if (!bluetooth_profile) {
|
|
|