1 /* -*- Mode: c++; c-basic-offset: 2; tab-width: 20; indent-tabs-mode: nil; -*-
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef GeckoNetworkManager_h
7 #define GeckoNetworkManager_h
9 #include "nsAppShell.h"
11 #include "nsINetworkLinkService.h"
13 #include "mozilla/java/GeckoNetworkManagerNatives.h"
14 #include "mozilla/Services.h"
18 class GeckoNetworkManager final
19 : public java::GeckoNetworkManager::Natives
<GeckoNetworkManager
> {
20 GeckoNetworkManager() = delete;
23 static void OnConnectionChanged(int32_t aType
, jni::String::Param aSubType
,
24 bool aIsWifi
, int32_t aGateway
) {
25 hal::NotifyNetworkChange(hal::NetworkInformation(aType
, aIsWifi
, aGateway
));
27 nsCOMPtr
<nsIObserverService
> os
= services::GetObserverService();
29 os
->NotifyObservers(nullptr, NS_NETWORK_LINK_TYPE_TOPIC
,
30 aSubType
->ToString().get());
34 static void OnStatusChanged(jni::String::Param aStatus
) {
35 nsCOMPtr
<nsIObserverService
> os
= mozilla::services::GetObserverService();
37 os
->NotifyObservers(nullptr, NS_NETWORK_LINK_TOPIC
,
38 aStatus
->ToString().get());
43 } // namespace mozilla
45 #endif // GeckoNetworkManager_h