xref: /aosp_15_r20/external/cronet/net/android/network_change_notifier_factory_android.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2012 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef NET_ANDROID_NETWORK_CHANGE_NOTIFIER_FACTORY_ANDROID_H_
6 #define NET_ANDROID_NETWORK_CHANGE_NOTIFIER_FACTORY_ANDROID_H_
7 
8 #include <memory>
9 
10 #include "base/compiler_specific.h"
11 #include "net/android/network_change_notifier_delegate_android.h"
12 #include "net/base/net_export.h"
13 #include "net/base/network_change_notifier_factory.h"
14 
15 namespace net {
16 
17 class NetworkChangeNotifier;
18 class NetworkChangeNotifierDelegateAndroid;
19 
20 // NetworkChangeNotifierFactory creates Android-specific specialization of
21 // NetworkChangeNotifier. See network_change_notifier_android.h for more
22 // details.
23 class NET_EXPORT NetworkChangeNotifierFactoryAndroid :
24     public NetworkChangeNotifierFactory {
25  public:
26   // Must be called on the JNI thread.
27   NetworkChangeNotifierFactoryAndroid();
28 
29   NetworkChangeNotifierFactoryAndroid(
30       const NetworkChangeNotifierFactoryAndroid&) = delete;
31   NetworkChangeNotifierFactoryAndroid& operator=(
32       const NetworkChangeNotifierFactoryAndroid&) = delete;
33 
34   // Must be called on the JNI thread.
35   ~NetworkChangeNotifierFactoryAndroid() override;
36 
37   // NetworkChangeNotifierFactory:
38   std::unique_ptr<NetworkChangeNotifier> CreateInstanceWithInitialTypes(
39       NetworkChangeNotifier::ConnectionType /*initial_type*/,
40       NetworkChangeNotifier::ConnectionSubtype /*initial_subtype*/) override;
41 
42  private:
43   // Delegate passed to the instances created by this class.
44   NetworkChangeNotifierDelegateAndroid delegate_;
45 };
46 
47 }  // namespace net
48 
49 #endif  // NET_ANDROID_NETWORK_CHANGE_NOTIFIER_FACTORY_ANDROID_H_
50