Bug 1142132: Move helper classes of HFP manager into manager's namespace, r=shuang

Keeping helper classes in Bluetooth's C++ namespace creates collisions
between symbols of different managers' helpers. Moving HFP helpers into
the namespace of |BluetoothHfpManager| fixes this problem for HFP.
This commit is contained in:
Thomas Zimmermann 2015-03-12 13:07:32 +01:00
Родитель e8112815d6
Коммит 888dc86930
2 изменённых файлов: 63 добавлений и 39 удалений

Просмотреть файл

@ -273,13 +273,14 @@ BluetoothHfpManager::Init()
return true;
}
class CleanupInitResultHandler MOZ_FINAL : public BluetoothHandsfreeResultHandler
class BluetoothHfpManager::CleanupInitResultHandler MOZ_FINAL
: public BluetoothHandsfreeResultHandler
{
public:
CleanupInitResultHandler(BluetoothHandsfreeInterface* aInterface,
BluetoothProfileResultHandler* aRes)
: mInterface(aInterface)
, mRes(aRes)
: mInterface(aInterface)
, mRes(aRes)
{
MOZ_ASSERT(mInterface);
}
@ -322,11 +323,12 @@ private:
nsRefPtr<BluetoothProfileResultHandler> mRes;
};
class InitResultHandlerRunnable MOZ_FINAL : public nsRunnable
class BluetoothHfpManager::InitResultHandlerRunnable MOZ_FINAL
: public nsRunnable
{
public:
InitResultHandlerRunnable(CleanupInitResultHandler* aRes)
: mRes(aRes)
: mRes(aRes)
{
MOZ_ASSERT(mRes);
}
@ -341,13 +343,14 @@ private:
nsRefPtr<CleanupInitResultHandler> mRes;
};
class OnErrorProfileResultHandlerRunnable MOZ_FINAL : public nsRunnable
class BluetoothHfpManager::OnErrorProfileResultHandlerRunnable MOZ_FINAL
: public nsRunnable
{
public:
OnErrorProfileResultHandlerRunnable(BluetoothProfileResultHandler* aRes,
nsresult aRv)
: mRes(aRes)
, mRv(aRv)
: mRes(aRes)
, mRv(aRv)
{
MOZ_ASSERT(mRes);
}
@ -426,11 +429,12 @@ BluetoothHfpManager::~BluetoothHfpManager()
hal::UnregisterBatteryObserver(this);
}
class CleanupResultHandler MOZ_FINAL : public BluetoothHandsfreeResultHandler
class BluetoothHfpManager::CleanupResultHandler MOZ_FINAL
: public BluetoothHandsfreeResultHandler
{
public:
CleanupResultHandler(BluetoothProfileResultHandler* aRes)
: mRes(aRes)
: mRes(aRes)
{ }
void OnError(BluetoothStatus aStatus) MOZ_OVERRIDE
@ -456,11 +460,12 @@ private:
nsRefPtr<BluetoothProfileResultHandler> mRes;
};
class DeinitResultHandlerRunnable MOZ_FINAL : public nsRunnable
class BluetoothHfpManager::DeinitResultHandlerRunnable MOZ_FINAL
: public nsRunnable
{
public:
DeinitResultHandlerRunnable(BluetoothProfileResultHandler* aRes)
: mRes(aRes)
: mRes(aRes)
{
MOZ_ASSERT(mRes);
}
@ -606,8 +611,8 @@ BluetoothHfpManager::NotifyDialer(const nsAString& aCommand)
BT_ENSURE_TRUE_VOID_BROADCAST_SYSMSG(type, parameters);
}
class VolumeControlResultHandler MOZ_FINAL
: public BluetoothHandsfreeResultHandler
class BluetoothHfpManager::VolumeControlResultHandler MOZ_FINAL
: public BluetoothHandsfreeResultHandler
{
public:
void OnError(BluetoothStatus aStatus) MOZ_OVERRIDE
@ -743,8 +748,8 @@ BluetoothHfpManager::HandleShutdown()
sBluetoothHfpManager = nullptr;
}
class ClccResponseResultHandler MOZ_FINAL
: public BluetoothHandsfreeResultHandler
class BluetoothHfpManager::ClccResponseResultHandler MOZ_FINAL
: public BluetoothHandsfreeResultHandler
{
public:
void OnError(BluetoothStatus aStatus) MOZ_OVERRIDE
@ -780,8 +785,8 @@ BluetoothHfpManager::SendCLCC(Call& aCall, int aIndex)
aCall.mType, mDeviceAddress, new ClccResponseResultHandler());
}
class FormattedAtResponseResultHandler MOZ_FINAL
: public BluetoothHandsfreeResultHandler
class BluetoothHfpManager::FormattedAtResponseResultHandler MOZ_FINAL
: public BluetoothHandsfreeResultHandler
{
public:
void OnError(BluetoothStatus aStatus) MOZ_OVERRIDE
@ -800,8 +805,8 @@ BluetoothHfpManager::SendLine(const char* aMessage)
aMessage, mDeviceAddress, new FormattedAtResponseResultHandler());
}
class AtResponseResultHandler MOZ_FINAL
: public BluetoothHandsfreeResultHandler
class BluetoothHfpManager::AtResponseResultHandler MOZ_FINAL
: public BluetoothHandsfreeResultHandler
{
public:
void OnError(BluetoothStatus aStatus) MOZ_OVERRIDE
@ -820,8 +825,8 @@ BluetoothHfpManager::SendResponse(BluetoothHandsfreeAtResponse aResponseCode)
aResponseCode, 0, mDeviceAddress, new AtResponseResultHandler());
}
class PhoneStateChangeResultHandler MOZ_FINAL
: public BluetoothHandsfreeResultHandler
class BluetoothHfpManager::PhoneStateChangeResultHandler MOZ_FINAL
: public BluetoothHandsfreeResultHandler
{
public:
void OnError(BluetoothStatus aStatus) MOZ_OVERRIDE
@ -852,8 +857,8 @@ BluetoothHfpManager::UpdatePhoneCIND(uint32_t aCallIndex)
new PhoneStateChangeResultHandler());
}
class DeviceStatusNotificationResultHandler MOZ_FINAL
: public BluetoothHandsfreeResultHandler
class BluetoothHfpManager::DeviceStatusNotificationResultHandler MOZ_FINAL
: public BluetoothHandsfreeResultHandler
{
public:
void OnError(BluetoothStatus aStatus) MOZ_OVERRIDE
@ -1108,8 +1113,8 @@ BluetoothHfpManager::ToggleCalls()
nsITelephonyService::CALL_STATE_CONNECTED;
}
class ConnectAudioResultHandler MOZ_FINAL
: public BluetoothHandsfreeResultHandler
class BluetoothHfpManager::ConnectAudioResultHandler MOZ_FINAL
: public BluetoothHandsfreeResultHandler
{
public:
void OnError(BluetoothStatus aStatus) MOZ_OVERRIDE
@ -1134,8 +1139,8 @@ BluetoothHfpManager::ConnectSco()
return true;
}
class DisconnectAudioResultHandler MOZ_FINAL
: public BluetoothHandsfreeResultHandler
class BluetoothHfpManager::DisconnectAudioResultHandler MOZ_FINAL
: public BluetoothHandsfreeResultHandler
{
public:
void OnError(BluetoothStatus aStatus) MOZ_OVERRIDE
@ -1180,11 +1185,12 @@ BluetoothHfpManager::OnConnectError()
mDeviceAddress.Truncate();
}
class ConnectResultHandler MOZ_FINAL : public BluetoothHandsfreeResultHandler
class BluetoothHfpManager::ConnectResultHandler MOZ_FINAL
: public BluetoothHandsfreeResultHandler
{
public:
ConnectResultHandler(BluetoothHfpManager* aHfpManager)
: mHfpManager(aHfpManager)
: mHfpManager(aHfpManager)
{
MOZ_ASSERT(mHfpManager);
}
@ -1233,11 +1239,12 @@ BluetoothHfpManager::OnDisconnectError()
mController->NotifyCompletion(NS_LITERAL_STRING(ERR_CONNECTION_FAILED));
}
class DisconnectResultHandler MOZ_FINAL : public BluetoothHandsfreeResultHandler
class BluetoothHfpManager::DisconnectResultHandler MOZ_FINAL
: public BluetoothHandsfreeResultHandler
{
public:
DisconnectResultHandler(BluetoothHfpManager* aHfpManager)
: mHfpManager(aHfpManager)
: mHfpManager(aHfpManager)
{
MOZ_ASSERT(mHfpManager);
}
@ -1510,8 +1517,8 @@ BluetoothHfpManager::CnumNotification(const nsAString& aBdAddress)
SendResponse(HFP_AT_RESPONSE_OK);
}
class CindResponseResultHandler MOZ_FINAL
: public BluetoothHandsfreeResultHandler
class BluetoothHfpManager::CindResponseResultHandler MOZ_FINAL
: public BluetoothHandsfreeResultHandler
{
public:
void OnError(BluetoothStatus aStatus) MOZ_OVERRIDE
@ -1540,8 +1547,8 @@ BluetoothHfpManager::CindNotification(const nsAString& aBdAddress)
new CindResponseResultHandler());
}
class CopsResponseResultHandler MOZ_FINAL
: public BluetoothHandsfreeResultHandler
class BluetoothHfpManager::CopsResponseResultHandler MOZ_FINAL
: public BluetoothHandsfreeResultHandler
{
public:
void OnError(BluetoothStatus aStatus) MOZ_OVERRIDE

Просмотреть файл

@ -141,11 +141,28 @@ protected:
virtual ~BluetoothHfpManager();
private:
class GetVolumeTask;
class CloseScoTask;
class AtResponseResultHandler;
class CindResponseResultHandler;
class ConnectAudioResultHandler;
class ConnectResultHandler;
class CopsResponseResultHandler;
class ClccResponseResultHandler;
class CleanupInitResultHandler;
class CleanupResultHandler;
class CloseScoRunnable;
class RespondToBLDNTask;
class CloseScoTask;
class DeinitResultHandlerRunnable;
class DeviceStatusNotificationResultHandler;
class DisconnectAudioResultHandler;
class DisconnectResultHandler;
class FormattedAtResponseResultHandler;
class GetVolumeTask;
class InitResultHandlerRunnable;
class MainThreadTask;
class OnErrorProfileResultHandlerRunnable;
class PhoneStateChangeResultHandler;
class RespondToBLDNTask;
class VolumeControlResultHandler;
friend class BluetoothHfpManagerObserver;
friend class GetVolumeTask;