xref: /aosp_15_r20/external/cronet/net/base/network_change_notifier_factory.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2011 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_BASE_NETWORK_CHANGE_NOTIFIER_FACTORY_H_
6 #define NET_BASE_NETWORK_CHANGE_NOTIFIER_FACTORY_H_
7 
8 #include <memory>
9 
10 #include "net/base/net_export.h"
11 #include "net/base/network_change_notifier.h"
12 
13 namespace net {
14 
15 // NetworkChangeNotifierFactory provides a mechanism for overriding the default
16 // instance creation process of NetworkChangeNotifier.
17 class NET_EXPORT NetworkChangeNotifierFactory {
18  public:
19   NetworkChangeNotifierFactory() = default;
20   virtual ~NetworkChangeNotifierFactory() = default;
21   virtual std::unique_ptr<NetworkChangeNotifier> CreateInstanceWithInitialTypes(
22       NetworkChangeNotifier::ConnectionType initial_type,
23       NetworkChangeNotifier::ConnectionSubtype initial_subtype) = 0;
CreateInstance()24   std::unique_ptr<NetworkChangeNotifier> CreateInstance() {
25     return CreateInstanceWithInitialTypes(
26         NetworkChangeNotifier::kDefaultInitialConnectionType,
27         NetworkChangeNotifier::kDefaultInitialConnectionSubtype);
28   }
29 };
30 
31 }  // namespace net
32 
33 #endif  // NET_BASE_NETWORK_CHANGE_NOTIFIER_FACTORY_H_
34