OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_DNS_DNS_CLIENT_H_ | 5 #ifndef NET_DNS_DNS_CLIENT_H_ |
6 #define NET_DNS_DNS_CLIENT_H_ | 6 #define NET_DNS_DNS_CLIENT_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
| 10 #include "base/values.h" |
10 #include "net/base/net_export.h" | 11 #include "net/base/net_export.h" |
11 #include "net/base/rand_callback.h" | 12 #include "net/base/rand_callback.h" |
12 | 13 |
13 namespace net { | 14 namespace net { |
14 | 15 |
15 class AddressSorter; | 16 class AddressSorter; |
16 class ClientSocketFactory; | 17 class ClientSocketFactory; |
17 struct DnsConfig; | 18 struct DnsConfig; |
18 class DnsTransactionFactory; | 19 class DnsTransactionFactory; |
19 class NetLog; | 20 class NetLog; |
(...skipping 11 matching lines...) Expand all Loading... |
31 | 32 |
32 // Returns NULL if the current config is not valid. | 33 // Returns NULL if the current config is not valid. |
33 virtual const DnsConfig* GetConfig() const = 0; | 34 virtual const DnsConfig* GetConfig() const = 0; |
34 | 35 |
35 // Returns NULL if the current config is not valid. | 36 // Returns NULL if the current config is not valid. |
36 virtual DnsTransactionFactory* GetTransactionFactory() = 0; | 37 virtual DnsTransactionFactory* GetTransactionFactory() = 0; |
37 | 38 |
38 // Returns NULL if the current config is not valid. | 39 // Returns NULL if the current config is not valid. |
39 virtual AddressSorter* GetAddressSorter() = 0; | 40 virtual AddressSorter* GetAddressSorter() = 0; |
40 | 41 |
| 42 // Does nothing if the current config is not valid. |
| 43 virtual void ApplyPersistentData(const base::Value& data) = 0; |
| 44 |
| 45 // Returns std::unique_ptr<const Value>(NULL) if the current config is not |
| 46 // valid. |
| 47 virtual std::unique_ptr<const base::Value> GetPersistentData() const = 0; |
| 48 |
41 // Creates default client. | 49 // Creates default client. |
42 static std::unique_ptr<DnsClient> CreateClient(NetLog* net_log); | 50 static std::unique_ptr<DnsClient> CreateClient(NetLog* net_log); |
43 | 51 |
44 // Creates a client for testing. Allows using a mock ClientSocketFactory and | 52 // Creates a client for testing. Allows using a mock ClientSocketFactory and |
45 // a deterministic random number generator. |socket_factory| must outlive | 53 // a deterministic random number generator. |socket_factory| must outlive |
46 // the returned DnsClient. | 54 // the returned DnsClient. |
47 static std::unique_ptr<DnsClient> CreateClientForTesting( | 55 static std::unique_ptr<DnsClient> CreateClientForTesting( |
48 NetLog* net_log, | 56 NetLog* net_log, |
49 ClientSocketFactory* socket_factory, | 57 ClientSocketFactory* socket_factory, |
50 const RandIntCallback& rand_int_callback); | 58 const RandIntCallback& rand_int_callback); |
51 }; | 59 }; |
52 | 60 |
53 } // namespace net | 61 } // namespace net |
54 | 62 |
55 #endif // NET_DNS_DNS_CLIENT_H_ | 63 #endif // NET_DNS_DNS_CLIENT_H_ |
56 | 64 |
OLD | NEW |