Bug 1540028 [wpt PR 16099] - Catch more exceptions in Document-createElement-namespac...
[gecko.git] / widget / android / GeckoNetworkManager.h
blob3dc9a0d5ac6cf408c4294f5117915e12c1fb7692
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 "GeneratedJNINatives.h"
10 #include "nsAppShell.h"
11 #include "nsCOMPtr.h"
12 #include "nsINetworkLinkService.h"
14 #include "mozilla/Services.h"
16 namespace mozilla {
18 class GeckoNetworkManager final
19 : public java::GeckoNetworkManager::Natives<GeckoNetworkManager> {
20 GeckoNetworkManager() = delete;
22 public:
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();
28 if (os) {
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();
36 if (os) {
37 os->NotifyObservers(nullptr, NS_NETWORK_LINK_TOPIC,
38 aStatus->ToString().get());
43 } // namespace mozilla
45 #endif // GeckoNetworkManager_h