Bug 994601: fix undefined 'RequestSettingValue' and 'nsIRILNetworkInterface' in Flatfish build. r=kanru

This commit is contained in:
Vicamo Yang 2014-04-11 22:28:01 +08:00
parent a13d595ddb
commit 0eff675a4f
2 changed files with 20 additions and 25 deletions

View File

@ -54,16 +54,10 @@ static const char* kNetworkConnStateChangedTopic = "network-connection-state-cha
// While most methods of GonkGPSGeolocationProvider should only be
// called from main thread, we deliberately put the Init and ShutdownGPS
// methods off main thread to avoid blocking.
#ifdef MOZ_B2G_RIL
NS_IMPL_ISUPPORTS3(GonkGPSGeolocationProvider,
nsIGeolocationProvider,
nsIObserver,
nsISettingsServiceCallback)
#else
NS_IMPL_ISUPPORTS2(GonkGPSGeolocationProvider,
nsIGeolocationProvider,
nsIObserver)
#endif
/* static */ GonkGPSGeolocationProvider* GonkGPSGeolocationProvider::sSingleton = nullptr;
GpsCallbacks GonkGPSGeolocationProvider::mCallbacks = {
@ -382,6 +376,8 @@ GonkGPSGeolocationProvider::SetAGpsDataConn(nsAString& aApn)
}
}
#endif // MOZ_B2G_RIL
void
GonkGPSGeolocationProvider::RequestSettingValue(char* aKey)
{
@ -396,6 +392,7 @@ GonkGPSGeolocationProvider::RequestSettingValue(char* aKey)
lock->Get(aKey, this);
}
#ifdef MOZ_B2G_RIL
void
GonkGPSGeolocationProvider::RequestDataConnection()
{
@ -791,32 +788,33 @@ GonkGPSGeolocationProvider::Observe(nsISupports* aSubject,
{
MOZ_ASSERT(NS_IsMainThread());
if (strcmp(aTopic, kNetworkConnStateChangedTopic)) {
return NS_OK;
}
#ifdef MOZ_B2G_RIL
if (!strcmp(aTopic, kNetworkConnStateChangedTopic)) {
nsCOMPtr<nsIRilNetworkInterface> iface = do_QueryInterface(aSubject);
if (!iface) {
return NS_OK;
}
nsCOMPtr<nsIRilNetworkInterface> iface = do_QueryInterface(aSubject);
if (!iface) {
return NS_OK;
RequestSettingValue("ril.supl.apn");
}
#endif
RequestSettingValue("ril.supl.apn");
return NS_OK;
}
#ifdef MOZ_B2G_RIL
/** nsISettingsServiceCallback **/
NS_IMETHODIMP
GonkGPSGeolocationProvider::Handle(const nsAString& aName,
JS::Handle<JS::Value> aResult)
{
JSContext *cx = nsContentUtils::GetCurrentJSContext();
NS_ENSURE_TRUE(cx, NS_OK);
#ifdef MOZ_B2G_RIL
if (aName.EqualsLiteral("ril.supl.apn")) {
// When we get the APN, we attempt to call data_call_open of AGPS.
if (aResult.isString()) {
JSContext *cx = nsContentUtils::GetCurrentJSContext();
NS_ENSURE_TRUE(cx, NS_OK);
// NB: No need to enter a compartment to read the contents of a string.
nsDependentJSString apn;
apn.init(cx, aResult.toString());
@ -824,7 +822,9 @@ GonkGPSGeolocationProvider::Handle(const nsAString& aName,
SetAGpsDataConn(apn);
}
}
} else if (aName.EqualsLiteral(SETTING_DEBUG_ENABLED)) {
} else
#endif // MOZ_B2G_RIL
if (aName.EqualsLiteral(SETTING_DEBUG_ENABLED)) {
if (!aResult.isBoolean()) {
return NS_ERROR_FAILURE;
}
@ -838,4 +838,3 @@ GonkGPSGeolocationProvider::HandleError(const nsAString& aErrorMessage)
{
return NS_OK;
}
#endif // MOZ_B2G_RIL

View File

@ -23,8 +23,8 @@
#include "nsIObserver.h"
#ifdef MOZ_B2G_RIL
#include "nsIRadioInterfaceLayer.h"
#include "nsISettingsService.h"
#endif
#include "nsISettingsService.h"
class nsIThread;
@ -36,17 +36,13 @@ class nsIThread;
class GonkGPSGeolocationProvider : public nsIGeolocationProvider
, public nsIObserver
#ifdef MOZ_B2G_RIL
, public nsISettingsServiceCallback
#endif
{
public:
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSIGEOLOCATIONPROVIDER
NS_DECL_NSIOBSERVER
#ifdef MOZ_B2G_RIL
NS_DECL_NSISETTINGSSERVICECALLBACK
#endif
static already_AddRefed<GonkGPSGeolocationProvider> GetSingleton();
@ -83,13 +79,13 @@ private:
void StartGPS();
void ShutdownGPS();
void InjectLocation(double latitude, double longitude, float accuracy);
void RequestSettingValue(char* aKey);
#ifdef MOZ_B2G_RIL
void SetupAGPS();
int32_t GetDataConnectionState();
void SetAGpsDataConn(nsAString& aApn);
void RequestDataConnection();
void ReleaseDataConnection();
void RequestSettingValue(char* aKey);
void RequestSetID(uint32_t flags);
void SetReferenceLocation();
#endif