diff options
Diffstat (limited to 'netwerk')
-rw-r--r-- | netwerk/base/moz.build | 5 | ||||
-rw-r--r-- | netwerk/dns/mdns/libmdns/moz.build | 10 | ||||
-rw-r--r-- | netwerk/standalone/moz.build | 2 | ||||
-rw-r--r-- | netwerk/wifi/moz.build | 11 | ||||
-rw-r--r-- | netwerk/wifi/nsWifiMonitorGonk.cpp | 181 |
5 files changed, 5 insertions, 204 deletions
diff --git a/netwerk/base/moz.build b/netwerk/base/moz.build index 5de1eea81..3198d746c 100644 --- a/netwerk/base/moz.build +++ b/netwerk/base/moz.build @@ -182,11 +182,6 @@ EXPORTS.mozilla.net += [ 'ReferrerPolicy.h', ] -if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk': - EXPORTS += [ - 'NetStatistics.h', - ] - UNIFIED_SOURCES += [ 'ArrayBufferInputStream.cpp', 'BackgroundFileSaver.cpp', diff --git a/netwerk/dns/mdns/libmdns/moz.build b/netwerk/dns/mdns/libmdns/moz.build index d2dca4955..efad64d64 100644 --- a/netwerk/dns/mdns/libmdns/moz.build +++ b/netwerk/dns/mdns/libmdns/moz.build @@ -4,8 +4,7 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa' or \ - (CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk' and CONFIG['ANDROID_VERSION'] >= '16'): +if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': UNIFIED_SOURCES += [ 'MDNSResponderOperator.cpp', 'MDNSResponderReply.cpp', @@ -16,13 +15,6 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa' or \ '/netwerk/base', ] - if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk': - LOCAL_INCLUDES += [ - '%' + '%s/%s' % (CONFIG['ANDROID_SOURCE'], d) for d in [ - 'external/mdnsresponder/mDNSShared', - ] - ] - else: EXTRA_COMPONENTS += [ 'nsDNSServiceDiscovery.js', diff --git a/netwerk/standalone/moz.build b/netwerk/standalone/moz.build index d06711533..b5651da76 100644 --- a/netwerk/standalone/moz.build +++ b/netwerk/standalone/moz.build @@ -4,7 +4,7 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -if CONFIG['OS_TARGET'] != 'WINNT' and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk': +if CONFIG['OS_TARGET'] != 'WINNT': Library('necko_standalone') src_list = [ diff --git a/netwerk/wifi/moz.build b/netwerk/wifi/moz.build index e3edb0842..28149cb78 100644 --- a/netwerk/wifi/moz.build +++ b/netwerk/wifi/moz.build @@ -16,14 +16,9 @@ UNIFIED_SOURCES += [ 'nsWifiAccessPoint.cpp', ] -if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk': - UNIFIED_SOURCES += [ - 'nsWifiMonitorGonk.cpp', - ] -else: - UNIFIED_SOURCES += [ - 'nsWifiMonitor.cpp', - ] +UNIFIED_SOURCES += [ + 'nsWifiMonitor.cpp', +] if CONFIG['OS_ARCH'] == 'Darwin': UNIFIED_SOURCES += [ diff --git a/netwerk/wifi/nsWifiMonitorGonk.cpp b/netwerk/wifi/nsWifiMonitorGonk.cpp deleted file mode 100644 index 017750549..000000000 --- a/netwerk/wifi/nsWifiMonitorGonk.cpp +++ /dev/null @@ -1,181 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "nsCOMPtr.h" -#include "nsComponentManagerUtils.h" -#include "nsServiceManagerUtils.h" -#include "nsThreadUtils.h" -#include "nsXPCOM.h" -#include "nsXPCOMCID.h" -#include "nsIObserver.h" -#include "nsIObserverService.h" -#include "nsWifiMonitor.h" -#include "nsWifiAccessPoint.h" - -#include "nsServiceManagerUtils.h" -#include "nsComponentManagerUtils.h" -#include "mozilla/Services.h" - -#include "nsIInterfaceRequestor.h" -#include "nsIInterfaceRequestorUtils.h" - -using namespace mozilla; - -LazyLogModule gWifiMonitorLog("WifiMonitor"); - -NS_IMPL_ISUPPORTS(nsWifiMonitor, - nsIWifiMonitor, - nsIObserver, - nsIWifiScanResultsReady) - -nsWifiMonitor::nsWifiMonitor() -{ - nsCOMPtr<nsIObserverService> obsSvc = mozilla::services::GetObserverService(); - if (obsSvc) { - obsSvc->AddObserver(this, "xpcom-shutdown", false); - } - LOG(("@@@@@ wifimonitor created\n")); -} - -nsWifiMonitor::~nsWifiMonitor() -{ -} - -NS_IMETHODIMP -nsWifiMonitor::StartWatching(nsIWifiListener *aListener) -{ - LOG(("@@@@@ nsWifiMonitor::StartWatching\n")); - NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); - if (!aListener) { - return NS_ERROR_NULL_POINTER; - } - - mListeners.AppendElement(nsWifiListener(new nsMainThreadPtrHolder<nsIWifiListener>(aListener))); - - if (!mTimer) { - mTimer = do_CreateInstance("@mozilla.org/timer;1"); - mTimer->Init(this, 5000, nsITimer::TYPE_REPEATING_SLACK); - } - StartScan(); - return NS_OK; -} - -NS_IMETHODIMP -nsWifiMonitor::StopWatching(nsIWifiListener *aListener) -{ - LOG(("@@@@@ nsWifiMonitor::StopWatching\n")); - NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); - if (!aListener) { - return NS_ERROR_NULL_POINTER; - } - - for (uint32_t i = 0; i < mListeners.Length(); i++) { - if (mListeners[i].mListener == aListener) { - mListeners.RemoveElementAt(i); - break; - } - } - - if (mListeners.Length() == 0) { - ClearTimer(); - } - return NS_OK; -} - -void -nsWifiMonitor::StartScan() -{ - nsCOMPtr<nsIInterfaceRequestor> ir = do_GetService("@mozilla.org/telephony/system-worker-manager;1"); - nsCOMPtr<nsIWifi> wifi = do_GetInterface(ir); - if (!wifi) { - return; - } - wifi->GetWifiScanResults(this); -} - -NS_IMETHODIMP -nsWifiMonitor::Observe(nsISupports *subject, const char *topic, - const char16_t *data) -{ - if (!strcmp(topic, "timer-callback")) { - LOG(("timer callback\n")); - StartScan(); - return NS_OK; - } - - if (!strcmp(topic, "xpcom-shutdown")) { - LOG(("Shutting down\n")); - ClearTimer(); - return NS_OK; - } - - return NS_ERROR_UNEXPECTED; -} - -NS_IMETHODIMP -nsWifiMonitor::Onready(uint32_t count, nsIWifiScanResult **results) -{ - NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); - LOG(("@@@@@ About to send data to the wifi listeners\n")); - - nsCOMArray<nsWifiAccessPoint> accessPoints; - - for (uint32_t i = 0; i < count; i++) { - RefPtr<nsWifiAccessPoint> ap = new nsWifiAccessPoint(); - - nsString temp; - results[i]->GetBssid(temp); - // 00:00:00:00:00:00 --> 00-00-00-00-00-00 - for (int32_t x=0; x<6; x++) { - temp.ReplaceSubstring(NS_LITERAL_STRING(":"), NS_LITERAL_STRING("-")); // would it be too much to ask for a ReplaceAll()? - } - - nsCString mac; - mac.AssignWithConversion(temp); - - results[i]->GetSsid(temp); - - nsCString ssid; - ssid.AssignWithConversion(temp); - - uint32_t signal; - results[i]->GetSignalStrength(&signal); - - ap->setSignal(signal); - ap->setMacRaw(mac.get()); - ap->setSSIDRaw(ssid.get(), ssid.Length()); - - accessPoints.AppendObject(ap); - } - - bool accessPointsChanged = !AccessPointsEqual(accessPoints, mLastAccessPoints); - ReplaceArray(mLastAccessPoints, accessPoints); - - nsTArray<nsIWifiAccessPoint*> ac; - uint32_t resultCount = mLastAccessPoints.Count(); - for (uint32_t i = 0; i < resultCount; i++) { - ac.AppendElement(mLastAccessPoints[i]); - } - - for (uint32_t i = 0; i < mListeners.Length(); i++) { - if (!mListeners[i].mHasSentData || accessPointsChanged) { - mListeners[i].mHasSentData = true; - mListeners[i].mListener->OnChange(ac.Elements(), ac.Length()); - } - } - return NS_OK; -} - -NS_IMETHODIMP -nsWifiMonitor::Onfailure() -{ - NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); - LOG(("@@@@@ About to send error to the wifi listeners\n")); - for (uint32_t i = 0; i < mListeners.Length(); i++) { - mListeners[i].mListener->OnError(NS_ERROR_UNEXPECTED); - } - - ClearTimer(); - return NS_OK; -} |